Lines Matching refs:self
32 def test_sdk(self): argument
34 self.assertTrue(manifest_fixer.compare_version_gt('28', '27'))
35 self.assertFalse(manifest_fixer.compare_version_gt('27', '28'))
36 self.assertFalse(manifest_fixer.compare_version_gt('28', '28'))
38 def test_codename(self): argument
40 self.assertTrue(manifest_fixer.compare_version_gt('Q', 'P'))
41 self.assertFalse(manifest_fixer.compare_version_gt('P', 'Q'))
42 self.assertFalse(manifest_fixer.compare_version_gt('Q', 'Q'))
44 def test_sdk_codename(self): argument
46 self.assertTrue(manifest_fixer.compare_version_gt('Q', '28'))
47 self.assertFalse(manifest_fixer.compare_version_gt('28', 'Q'))
49 def test_compare_numeric(self): argument
51 self.assertTrue(manifest_fixer.compare_version_gt('18', '8'))
57 def raise_min_sdk_version_test(self, input_manifest, min_sdk_version, argument
73 def uses_sdk(self, min=None, target=None, extra=''): argument
83 def test_no_uses_sdk(self): argument
86 manifest_input = self.manifest_tmpl % ''
87 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='28')
88 output = self.raise_min_sdk_version_test(manifest_input, '28', '28', False)
89 self.assertEqual(output, expected)
91 def test_no_min(self): argument
94 manifest_input = self.manifest_tmpl % ' <uses-sdk extra="foo"/>\n'
95 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='28',
97 output = self.raise_min_sdk_version_test(manifest_input, '28', '28', False)
98 self.assertEqual(output, expected)
100 def test_raise_min(self): argument
103 manifest_input = self.manifest_tmpl % self.uses_sdk(min='27')
104 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='28')
105 output = self.raise_min_sdk_version_test(manifest_input, '28', '28', False)
106 self.assertEqual(output, expected)
108 def test_raise(self): argument
111 manifest_input = self.manifest_tmpl % self.uses_sdk(min='27')
112 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='28')
113 output = self.raise_min_sdk_version_test(manifest_input, '28', '28', False)
114 self.assertEqual(output, expected)
116 def test_no_raise_min(self): argument
119 manifest_input = self.manifest_tmpl % self.uses_sdk(min='28')
120 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='27')
121 output = self.raise_min_sdk_version_test(manifest_input, '27', '27', False)
122 self.assertEqual(output, expected)
124 def test_raise_codename(self): argument
127 manifest_input = self.manifest_tmpl % self.uses_sdk(min='28')
128 expected = self.manifest_tmpl % self.uses_sdk(min='P', target='P')
129 output = self.raise_min_sdk_version_test(manifest_input, 'P', 'P', False)
130 self.assertEqual(output, expected)
132 def test_no_raise_codename(self): argument
135 manifest_input = self.manifest_tmpl % self.uses_sdk(min='P')
136 expected = self.manifest_tmpl % self.uses_sdk(min='P', target='28')
137 output = self.raise_min_sdk_version_test(manifest_input, '28', '28', False)
138 self.assertEqual(output, expected)
140 def test_target(self): argument
143 manifest_input = self.manifest_tmpl % self.uses_sdk(min='26', target='27')
144 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='27')
145 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', False)
146 self.assertEqual(output, expected)
148 def test_no_target(self): argument
151 manifest_input = self.manifest_tmpl % self.uses_sdk(min='27')
152 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='29')
153 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', False)
154 self.assertEqual(output, expected)
156 def test_target_no_min(self): argument
159 manifest_input = self.manifest_tmpl % self.uses_sdk(target='27')
160 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='27')
161 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', False)
162 self.assertEqual(output, expected)
164 def test_no_target_no_min(self): argument
167 manifest_input = self.manifest_tmpl % ''
168 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='29')
169 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', False)
170 self.assertEqual(output, expected)
172 def test_library_no_target(self): argument
175 manifest_input = self.manifest_tmpl % self.uses_sdk(min='27')
176 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='15')
177 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True)
178 self.assertEqual(output, expected)
180 def test_library_target_no_min(self): argument
183 manifest_input = self.manifest_tmpl % self.uses_sdk(target='27')
184 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='27')
185 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True)
186 self.assertEqual(output, expected)
188 def test_library_no_target_no_min(self): argument
191 manifest_input = self.manifest_tmpl % ''
192 expected = self.manifest_tmpl % self.uses_sdk(min='28', target='15')
193 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True)
194 self.assertEqual(output, expected)
196 def test_extra(self): argument
199 manifest_input = self.manifest_tmpl % (
205 expected = self.manifest_tmpl % (
210 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', False)
212 self.assertEqual(output, expected)
214 def test_indent(self): argument
217 manifest_input = self.manifest_tmpl % ' <!-- comment -->\n'
220 expected = self.manifest_tmpl % (
224 output = self.raise_min_sdk_version_test(manifest_input, '28', '29', False)
226 self.assertEqual(output, expected)
232 def run_test(self, input_manifest, new_uses_libraries): argument
247 def uses_libraries(self, name_required_pairs): argument
256 def test_empty(self): argument
258 manifest_input = self.manifest_tmpl % self.uses_libraries([
262 output = self.run_test(manifest_input, [])
263 self.assertEqual(output, expected)
265 def test_not_overwrite(self): argument
267 manifest_input = self.manifest_tmpl % self.uses_libraries([
271 output = self.run_test(manifest_input, ['foo', 'bar'])
272 self.assertEqual(output, expected)
274 def test_add(self): argument
276 manifest_input = self.manifest_tmpl % self.uses_libraries([
279 expected = self.manifest_tmpl % self.uses_libraries([
284 output = self.run_test(manifest_input, ['bar', 'baz', 'qux'])
285 self.assertEqual(output, expected)
287 def test_no_application(self): argument
294 expected = self.manifest_tmpl % self.uses_libraries([
297 output = self.run_test(manifest_input, ['foo', 'bar'])
298 self.assertEqual(output, expected)
300 def test_empty_application(self): argument
308 expected = self.manifest_tmpl % self.uses_libraries([
311 output = self.run_test(manifest_input, ['foo', 'bar'])
312 self.assertEqual(output, expected)
318 def run_test(self, input_manifest): argument
331 def uses_non_sdk_api(self, value): argument
334 def test_set_true(self): argument
336 manifest_input = self.manifest_tmpl % self.uses_non_sdk_api(False)
337 expected = self.manifest_tmpl % self.uses_non_sdk_api(True)
338 output = self.run_test(manifest_input)
339 self.assertEqual(output, expected)
341 def test_already_set(self): argument
343 manifest_input = self.manifest_tmpl % self.uses_non_sdk_api(True)
345 output = self.run_test(manifest_input)
346 self.assertEqual(output, expected)
352 def run_test(self, input_manifest): argument
365 def use_embedded_dex(self, value): argument
368 def test_manifest_with_undeclared_preference(self): argument
369 manifest_input = self.manifest_tmpl % ''
370 expected = self.manifest_tmpl % self.use_embedded_dex('true')
371 output = self.run_test(manifest_input)
372 self.assertEqual(output, expected)
374 def test_manifest_with_use_embedded_dex(self): argument
375 manifest_input = self.manifest_tmpl % self.use_embedded_dex('true')
377 output = self.run_test(manifest_input)
378 self.assertEqual(output, expected)
380 def test_manifest_with_not_use_embedded_dex(self): argument
381 manifest_input = self.manifest_tmpl % self.use_embedded_dex('false')
382 self.assertRaises(RuntimeError, self.run_test, manifest_input)
388 def run_test(self, input_manifest, value): argument
401 def extract_native_libs(self, value): argument
404 def test_set_true(self): argument
405 manifest_input = self.manifest_tmpl % ''
406 expected = self.manifest_tmpl % self.extract_native_libs('true')
407 output = self.run_test(manifest_input, True)
408 self.assertEqual(output, expected)
410 def test_set_false(self): argument
411 manifest_input = self.manifest_tmpl % ''
412 expected = self.manifest_tmpl % self.extract_native_libs('false')
413 output = self.run_test(manifest_input, False)
414 self.assertEqual(output, expected)
416 def test_match(self): argument
417 manifest_input = self.manifest_tmpl % self.extract_native_libs('true')
419 output = self.run_test(manifest_input, True)
420 self.assertEqual(output, expected)
422 def test_conflict(self): argument
423 manifest_input = self.manifest_tmpl % self.extract_native_libs('true')
424 self.assertRaises(RuntimeError, self.run_test, manifest_input, False)