summaryrefslogtreecommitdiff
path: root/scripts/manifest_fixer_test.py
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2019-02-05 21:55:21 -0800
committer Colin Cross <ccross@android.com> 2019-02-08 15:24:47 +0000
commite4246abd7f456eb4119f2cffc01bdfca852584b5 (patch)
treeda9d75703d09106d677b1d5b8976a6cdc601e6ce /scripts/manifest_fixer_test.py
parent129b9ceeb147099a62c46b4ff74670bb1670e34b (diff)
Make manifest and APK agree on uncompressed native libs
Only put uncompressed native libs in an APK if the min_sdk_version supports it (>= 23, Marshmallow), and set android:extractNativeLibs="false" in the AndroidManifest.xml so that the platform won't extract them anyways. Bug: 117618214 Test: m checkbuild Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
Diffstat (limited to 'scripts/manifest_fixer_test.py')
-rwxr-xr-xscripts/manifest_fixer_test.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/manifest_fixer_test.py b/scripts/manifest_fixer_test.py
index 1d8de5565..4ad9afaf3 100755
--- a/scripts/manifest_fixer_test.py
+++ b/scripts/manifest_fixer_test.py
@@ -381,5 +381,48 @@ class UseEmbeddedDexTest(unittest.TestCase):
manifest_input = self.manifest_tmpl % self.use_embedded_dex('false')
self.assertRaises(RuntimeError, self.run_test, manifest_input)
+
+class AddExtractNativeLibsTest(unittest.TestCase):
+ """Unit tests for add_extract_native_libs function."""
+
+ def run_test(self, input_manifest, value):
+ doc = minidom.parseString(input_manifest)
+ manifest_fixer.add_extract_native_libs(doc, value)
+ output = StringIO.StringIO()
+ manifest_fixer.write_xml(output, doc)
+ return output.getvalue()
+
+ manifest_tmpl = (
+ '<?xml version="1.0" encoding="utf-8"?>\n'
+ '<manifest xmlns:android="http://schemas.android.com/apk/res/android">\n'
+ ' <application%s/>\n'
+ '</manifest>\n')
+
+ def extract_native_libs(self, value):
+ return ' android:extractNativeLibs="%s"' % value
+
+ def test_set_true(self):
+ manifest_input = self.manifest_tmpl % ''
+ expected = self.manifest_tmpl % self.extract_native_libs('true')
+ output = self.run_test(manifest_input, True)
+ self.assertEqual(output, expected)
+
+ def test_set_false(self):
+ manifest_input = self.manifest_tmpl % ''
+ expected = self.manifest_tmpl % self.extract_native_libs('false')
+ output = self.run_test(manifest_input, False)
+ self.assertEqual(output, expected)
+
+ def test_match(self):
+ manifest_input = self.manifest_tmpl % self.extract_native_libs('true')
+ expected = manifest_input
+ output = self.run_test(manifest_input, True)
+ self.assertEqual(output, expected)
+
+ def test_conflict(self):
+ manifest_input = self.manifest_tmpl % self.extract_native_libs('true')
+ self.assertRaises(RuntimeError, self.run_test, manifest_input, False)
+
+
if __name__ == '__main__':
unittest.main()