diff paraspace/tests/injection_test.py @ 149:d4533a59c694

inject_classdefs() also inject relative _DEX_StringIds.
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 15 Aug 2011 21:51:39 +0800
parents c4324c3461e8
children 1eb1b2ca5de4
line wrap: on
line diff
--- a/paraspace/tests/injection_test.py	Mon Aug 15 19:32:46 2011 +0800
+++ b/paraspace/tests/injection_test.py	Mon Aug 15 21:51:39 2011 +0800
@@ -181,8 +181,8 @@
 
 def collect_types_in_method_test():
     from paraspace.dex_deptracker import prepare_dep_decls
-    from paraspace.injection import collect_typeidxs_in_method
-    from paraspace.injection import collect_typeidxs_mentioned_by_class
+    from paraspace.injection import collect_typeidxs_stridxs_in_method
+    from paraspace.injection import collect_typeidxs_stridxs_mentioned_by_class
     from paraspace.dexfile import DEXFile_linked
     
     _install_dexfile_4_deptracker()
@@ -203,15 +203,17 @@
 
     init_method = fakefile_linked.find_method_name('<init>', fakefile_def)
 
-    typeidxs = collect_typeidxs_in_method(fakefile_linked, init_method)
+    typeidxs, stridxs = \
+        collect_typeidxs_stridxs_in_method(fakefile_linked, init_method)
     assert len(typeidxs) == 1
 
     typeid = fakefile_linked.find_typeid_idx(typeidxs[0])
     typeid_name = DEXFile_linked.get_typeid_name(typeid)
     assert typeid_name == 'Ljava/io/File;'
     
-    typeidxs = collect_typeidxs_mentioned_by_class(fakefile_linked,
-                                                   fakefile_def)
+    typeidxs, stridxs = \
+        collect_typeidxs_stridxs_mentioned_by_class(fakefile_linked, \
+                                                        fakefile_def)
     assert len(typeidxs) == 1
 
     typeid = fakefile_linked.find_typeid_idx(typeidxs[0])
@@ -261,9 +263,10 @@
     assert fakefile_dataheader.directMethodsSize == 1
     assert fakefile_dataheader.virtualMethodsSize == 0
 
-    classdefs, typeids = dexfile_insert_classdefs_relative(helloworld_linked,
-                                                           fakefile_linked,
-                                                           [fakefile_def])
+    classdefs, typeids, strids = \
+        dexfile_insert_classdefs_relative(helloworld_linked, \
+                                              fakefile_linked, \
+                                              [fakefile_def])
     assert classdefs
     assert len(classdefs) == 1
     assert classdefs[0] != fakefile_def