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 add_logging_parent_test(self, input_manifest, logging_parent=None): argument
246 def uses_logging_parent(self, logging_parent=None): argument
255 def test_no_logging_parent(self): argument
257 manifest_input = self.manifest_tmpl % ''
258 expected = self.manifest_tmpl % self.uses_logging_parent()
259 output = self.add_logging_parent_test(manifest_input)
260 self.assertEqual(output, expected)
262 def test_logging_parent(self): argument
264 manifest_input = self.manifest_tmpl % ''
265 expected = self.manifest_tmpl % self.uses_logging_parent('FOO')
266 output = self.add_logging_parent_test(manifest_input, 'FOO')
267 self.assertEqual(output, expected)
273 def run_test(self, input_manifest, new_uses_libraries): argument
288 def uses_libraries(self, name_required_pairs): argument
297 def test_empty(self): argument
299 manifest_input = self.manifest_tmpl % self.uses_libraries([
303 output = self.run_test(manifest_input, [])
304 self.assertEqual(output, expected)
306 def test_not_overwrite(self): argument
308 manifest_input = self.manifest_tmpl % self.uses_libraries([
312 output = self.run_test(manifest_input, ['foo', 'bar'])
313 self.assertEqual(output, expected)
315 def test_add(self): argument
317 manifest_input = self.manifest_tmpl % self.uses_libraries([
320 expected = self.manifest_tmpl % self.uses_libraries([
325 output = self.run_test(manifest_input, ['bar', 'baz', 'qux'])
326 self.assertEqual(output, expected)
328 def test_no_application(self): argument
335 expected = self.manifest_tmpl % self.uses_libraries([
338 output = self.run_test(manifest_input, ['foo', 'bar'])
339 self.assertEqual(output, expected)
341 def test_empty_application(self): argument
349 expected = self.manifest_tmpl % self.uses_libraries([
352 output = self.run_test(manifest_input, ['foo', 'bar'])
353 self.assertEqual(output, expected)
359 def run_test(self, input_manifest): argument
372 def uses_non_sdk_api(self, value): argument
375 def test_set_true(self): argument
377 manifest_input = self.manifest_tmpl % self.uses_non_sdk_api(False)
378 expected = self.manifest_tmpl % self.uses_non_sdk_api(True)
379 output = self.run_test(manifest_input)
380 self.assertEqual(output, expected)
382 def test_already_set(self): argument
384 manifest_input = self.manifest_tmpl % self.uses_non_sdk_api(True)
386 output = self.run_test(manifest_input)
387 self.assertEqual(output, expected)
393 def run_test(self, input_manifest): argument
406 def use_embedded_dex(self, value): argument
409 def test_manifest_with_undeclared_preference(self): argument
410 manifest_input = self.manifest_tmpl % ''
411 expected = self.manifest_tmpl % self.use_embedded_dex('true')
412 output = self.run_test(manifest_input)
413 self.assertEqual(output, expected)
415 def test_manifest_with_use_embedded_dex(self): argument
416 manifest_input = self.manifest_tmpl % self.use_embedded_dex('true')
418 output = self.run_test(manifest_input)
419 self.assertEqual(output, expected)
421 def test_manifest_with_not_use_embedded_dex(self): argument
422 manifest_input = self.manifest_tmpl % self.use_embedded_dex('false')
423 self.assertRaises(RuntimeError, self.run_test, manifest_input)
429 def run_test(self, input_manifest, value): argument
442 def extract_native_libs(self, value): argument
445 def test_set_true(self): argument
446 manifest_input = self.manifest_tmpl % ''
447 expected = self.manifest_tmpl % self.extract_native_libs('true')
448 output = self.run_test(manifest_input, True)
449 self.assertEqual(output, expected)
451 def test_set_false(self): argument
452 manifest_input = self.manifest_tmpl % ''
453 expected = self.manifest_tmpl % self.extract_native_libs('false')
454 output = self.run_test(manifest_input, False)
455 self.assertEqual(output, expected)
457 def test_match(self): argument
458 manifest_input = self.manifest_tmpl % self.extract_native_libs('true')
460 output = self.run_test(manifest_input, True)
461 self.assertEqual(output, expected)
463 def test_conflict(self): argument
464 manifest_input = self.manifest_tmpl % self.extract_native_libs('true')
465 self.assertRaises(RuntimeError, self.run_test, manifest_input, False)
471 def run_test(self, input_manifest): argument
484 def test_no_application(self): argument
485 manifest_input = self.manifest_tmpl % ''
486 expected = self.manifest_tmpl % ' <application android:hasCode="false"/>\n'
487 output = self.run_test(manifest_input)
488 self.assertEqual(output, expected)
490 def test_has_application_no_has_code(self): argument
491 manifest_input = self.manifest_tmpl % ' <application/>\n'
492 expected = self.manifest_tmpl % ' <application android:hasCode="false"/>\n'
493 output = self.run_test(manifest_input)
494 self.assertEqual(output, expected)
496 def test_has_application_has_code_false(self): argument
498 manifest_input = self.manifest_tmpl % ' <application android:hasCode="false"/>\n'
499 output = self.run_test(manifest_input)
500 self.assertEqual(output, manifest_input)
502 def test_has_application_has_code_true(self): argument
505 manifest_input = self.manifest_tmpl % ' <application android:hasCode="true"/>\n'
506 output = self.run_test(manifest_input)
507 self.assertEqual(output, manifest_input)