Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance_test.py

Issue 2935503002: List Java Instru Test Information From JUnit Runner (Closed)
Patch Set: compiling error fix Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for instrumentation_test_instance.""" 6 """Unit tests for instrumentation_test_instance."""
7 7
8 # pylint: disable=protected-access 8 # pylint: disable=protected-access
9 9
10 import collections 10 import collections
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 'Feature': {'value': ['Bar']}, 137 'Feature': {'value': ['Bar']},
138 'SmallTest': None, 138 'SmallTest': None,
139 }, 139 },
140 'class': 'org.chromium.test.SampleTest2', 140 'class': 'org.chromium.test.SampleTest2',
141 'method': 'testMethod1', 141 'method': 'testMethod1',
142 'is_junit4': True, 142 'is_junit4': True,
143 }, 143 },
144 ] 144 ]
145 145
146 o._test_jar = 'path/to/test.jar' 146 o._test_jar = 'path/to/test.jar'
147 o._test_runner_junit4 = 'J4Runner' 147 o._junit4_runner_class = 'J4Runner'
148 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 148 with mock.patch(
149 return_value=raw_tests): 149 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
150 return_value=raw_tests):
150 actual_tests = o.GetTests() 151 actual_tests = o.GetTests()
151 152
152 self.assertEquals(actual_tests, expected_tests) 153 self.assertEquals(actual_tests, expected_tests)
153 154
154 def testGetTests_simpleGtestFilter(self): 155 def testGetTests_simpleGtestFilter(self):
155 o = self.createTestInstance() 156 o = self.createTestInstance()
156 raw_tests = [ 157 raw_tests = [
157 { 158 {
158 'annotations': {'Feature': {'value': ['Foo']}}, 159 'annotations': {'Feature': {'value': ['Foo']}},
159 'class': 'org.chromium.test.SampleTest', 160 'class': 'org.chromium.test.SampleTest',
(...skipping 18 matching lines...) Expand all
178 'SmallTest': None, 179 'SmallTest': None,
179 }, 180 },
180 'class': 'org.chromium.test.SampleTest', 181 'class': 'org.chromium.test.SampleTest',
181 'is_junit4': True, 182 'is_junit4': True,
182 'method': 'testMethod1', 183 'method': 'testMethod1',
183 }, 184 },
184 ] 185 ]
185 186
186 o._test_filter = 'org.chromium.test.SampleTest.testMethod1' 187 o._test_filter = 'org.chromium.test.SampleTest.testMethod1'
187 o._test_jar = 'path/to/test.jar' 188 o._test_jar = 'path/to/test.jar'
188 o._test_runner_junit4 = 'J4Runner' 189 o._junit4_runner_class = 'J4Runner'
189 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 190 with mock.patch(
190 return_value=raw_tests): 191 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
192 return_value=raw_tests):
191 actual_tests = o.GetTests() 193 actual_tests = o.GetTests()
192 194
193 self.assertEquals(actual_tests, expected_tests) 195 self.assertEquals(actual_tests, expected_tests)
196
197 def testGetTests_simpleGtestUnqualifiedNameFilter(self):
198 o = self.createTestInstance()
199 raw_tests = [
200 {
201 'annotations': {'Feature': {'value': ['Foo']}},
202 'class': 'org.chromium.test.SampleTest',
203 'superclass': 'java.lang.Object',
204 'methods': [
205 {
206 'annotations': {'SmallTest': None},
207 'method': 'testMethod1',
208 },
209 {
210 'annotations': {'MediumTest': None},
211 'method': 'testMethod2',
212 },
213 ],
214 }
215 ]
216
217 expected_tests = [
218 {
219 'annotations': {
220 'Feature': {'value': ['Foo']},
221 'SmallTest': None,
222 },
223 'class': 'org.chromium.test.SampleTest',
224 'is_junit4': True,
225 'method': 'testMethod1',
226 },
227 ]
228
229 o._test_filter = 'SampleTest.testMethod1'
230 o._test_jar = 'path/to/test.jar'
231 o._junit4_runner_class = 'J4Runner'
232 with mock.patch(
233 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
234 return_value=raw_tests):
235 actual_tests = o.GetTests()
236
237 self.assertEquals(actual_tests, expected_tests)
238
239 def testGetTests_parameterizedTestGtestFilter(self):
240 o = self.createTestInstance()
241 raw_tests = [
242 {
243 'annotations': {'Feature': {'value': ['Foo']}},
244 'class': 'org.chromium.test.SampleTest',
245 'superclass': 'java.lang.Object',
246 'methods': [
247 {
248 'annotations': {'SmallTest': None},
249 'method': 'testMethod1',
250 },
251 {
252 'annotations': {'SmallTest': None},
253 'method': 'testMethod1__sandboxed_mode',
254 },
255 ],
256 },
257 {
258 'annotations': {'Feature': {'value': ['Bar']}},
259 'class': 'org.chromium.test.SampleTest2',
260 'superclass': 'java.lang.Object',
261 'methods': [
262 {
263 'annotations': {'SmallTest': None},
264 'method': 'testMethod1',
265 },
266 ],
267 }
268 ]
269
270 expected_tests = [
271 {
272 'annotations': {
273 'Feature': {'value': ['Foo']},
274 'SmallTest': None,
275 },
276 'class': 'org.chromium.test.SampleTest',
277 'method': 'testMethod1',
278 'is_junit4': True,
279 },
280 {
281 'annotations': {
282 'Feature': {'value': ['Foo']},
283 'SmallTest': None,
284 },
285 'class': 'org.chromium.test.SampleTest',
286 'method': 'testMethod1__sandboxed_mode',
287 'is_junit4': True,
288 },
289 ]
290
291 o._test_jar = 'path/to/test.jar'
292 o._junit4_runner_class = 'J4Runner'
293 o._test_filter = 'org.chromium.test.SampleTest.testMethod1'
294 with mock.patch(
295 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
296 return_value=raw_tests):
297 actual_tests = o.GetTests()
298
299 self.assertEquals(actual_tests, expected_tests)
194 300
195 def testGetTests_wildcardGtestFilter(self): 301 def testGetTests_wildcardGtestFilter(self):
196 o = self.createTestInstance() 302 o = self.createTestInstance()
197 raw_tests = [ 303 raw_tests = [
198 { 304 {
199 'annotations': {'Feature': {'value': ['Foo']}}, 305 'annotations': {'Feature': {'value': ['Foo']}},
200 'class': 'org.chromium.test.SampleTest', 306 'class': 'org.chromium.test.SampleTest',
201 'superclass': 'java.lang.Object', 307 'superclass': 'java.lang.Object',
202 'methods': [ 308 'methods': [
203 { 309 {
(...skipping 26 matching lines...) Expand all
230 'SmallTest': None, 336 'SmallTest': None,
231 }, 337 },
232 'class': 'org.chromium.test.SampleTest2', 338 'class': 'org.chromium.test.SampleTest2',
233 'is_junit4': True, 339 'is_junit4': True,
234 'method': 'testMethod1', 340 'method': 'testMethod1',
235 }, 341 },
236 ] 342 ]
237 343
238 o._test_filter = 'org.chromium.test.SampleTest2.*' 344 o._test_filter = 'org.chromium.test.SampleTest2.*'
239 o._test_jar = 'path/to/test.jar' 345 o._test_jar = 'path/to/test.jar'
240 o._test_runner_junit4 = 'J4Runner' 346 o._junit4_runner_class = 'J4Runner'
241 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 347 with mock.patch(
242 return_value=raw_tests): 348 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
349 return_value=raw_tests):
243 actual_tests = o.GetTests() 350 actual_tests = o.GetTests()
244 351
245 self.assertEquals(actual_tests, expected_tests) 352 self.assertEquals(actual_tests, expected_tests)
246 353
247 def testGetTests_negativeGtestFilter(self): 354 def testGetTests_negativeGtestFilter(self):
248 o = self.createTestInstance() 355 o = self.createTestInstance()
249 raw_tests = [ 356 raw_tests = [
250 { 357 {
251 'annotations': {'Feature': {'value': ['Foo']}}, 358 'annotations': {'Feature': {'value': ['Foo']}},
252 'class': 'org.chromium.test.SampleTest', 359 'class': 'org.chromium.test.SampleTest',
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 'SmallTest': None, 398 'SmallTest': None,
292 }, 399 },
293 'class': 'org.chromium.test.SampleTest2', 400 'class': 'org.chromium.test.SampleTest2',
294 'is_junit4': True, 401 'is_junit4': True,
295 'method': 'testMethod1', 402 'method': 'testMethod1',
296 }, 403 },
297 ] 404 ]
298 405
299 o._test_filter = '*-org.chromium.test.SampleTest.testMethod1' 406 o._test_filter = '*-org.chromium.test.SampleTest.testMethod1'
300 o._test_jar = 'path/to/test.jar' 407 o._test_jar = 'path/to/test.jar'
301 o._test_runner_junit4 = 'J4Runner' 408 o._junit4_runner_class = 'J4Runner'
302 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 409 with mock.patch(
303 return_value=raw_tests): 410 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
411 return_value=raw_tests):
304 actual_tests = o.GetTests() 412 actual_tests = o.GetTests()
305 413
306 self.assertEquals(actual_tests, expected_tests) 414 self.assertEquals(actual_tests, expected_tests)
307 415
308 def testGetTests_annotationFilter(self): 416 def testGetTests_annotationFilter(self):
309 o = self.createTestInstance() 417 o = self.createTestInstance()
310 raw_tests = [ 418 raw_tests = [
311 { 419 {
312 'annotations': {'Feature': {'value': ['Foo']}}, 420 'annotations': {'Feature': {'value': ['Foo']}},
313 'class': 'org.chromium.test.SampleTest', 421 'class': 'org.chromium.test.SampleTest',
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 'SmallTest': None, 460 'SmallTest': None,
353 }, 461 },
354 'class': 'org.chromium.test.SampleTest2', 462 'class': 'org.chromium.test.SampleTest2',
355 'is_junit4': True, 463 'is_junit4': True,
356 'method': 'testMethod1', 464 'method': 'testMethod1',
357 }, 465 },
358 ] 466 ]
359 467
360 o._annotations = [('SmallTest', None)] 468 o._annotations = [('SmallTest', None)]
361 o._test_jar = 'path/to/test.jar' 469 o._test_jar = 'path/to/test.jar'
362 o._test_runner_junit4 = 'J4Runner' 470 o._junit4_runner_class = 'J4Runner'
363 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 471 with mock.patch(
364 return_value=raw_tests): 472 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
473 return_value=raw_tests):
365 actual_tests = o.GetTests() 474 actual_tests = o.GetTests()
366 475
367 self.assertEquals(actual_tests, expected_tests) 476 self.assertEquals(actual_tests, expected_tests)
368 477
369 def testGetTests_excludedAnnotationFilter(self): 478 def testGetTests_excludedAnnotationFilter(self):
370 o = self.createTestInstance() 479 o = self.createTestInstance()
371 raw_tests = [ 480 raw_tests = [
372 { 481 {
373 'annotations': {'Feature': {'value': ['Foo']}}, 482 'annotations': {'Feature': {'value': ['Foo']}},
374 'class': 'org.chromium.test.SampleTest', 483 'class': 'org.chromium.test.SampleTest',
(...skipping 29 matching lines...) Expand all
404 'MediumTest': None, 513 'MediumTest': None,
405 }, 514 },
406 'class': 'org.chromium.test.SampleTest', 515 'class': 'org.chromium.test.SampleTest',
407 'is_junit4': False, 516 'is_junit4': False,
408 'method': 'testMethod2', 517 'method': 'testMethod2',
409 }, 518 },
410 ] 519 ]
411 520
412 o._excluded_annotations = [('SmallTest', None)] 521 o._excluded_annotations = [('SmallTest', None)]
413 o._test_jar = 'path/to/test.jar' 522 o._test_jar = 'path/to/test.jar'
414 o._test_runner_junit4 = 'J4Runner' 523 o._junit4_runner_class = 'J4Runner'
415 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 524 with mock.patch(
416 return_value=raw_tests): 525 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
526 return_value=raw_tests):
417 actual_tests = o.GetTests() 527 actual_tests = o.GetTests()
418 528
419 self.assertEquals(actual_tests, expected_tests) 529 self.assertEquals(actual_tests, expected_tests)
420 530
421 def testGetTests_annotationSimpleValueFilter(self): 531 def testGetTests_annotationSimpleValueFilter(self):
422 o = self.createTestInstance() 532 o = self.createTestInstance()
423 raw_tests = [ 533 raw_tests = [
424 { 534 {
425 'annotations': {'Feature': {'value': ['Foo']}}, 535 'annotations': {'Feature': {'value': ['Foo']}},
426 'class': 'org.chromium.test.SampleTest', 536 'class': 'org.chromium.test.SampleTest',
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 'TestValue': '1', 576 'TestValue': '1',
467 }, 577 },
468 'class': 'org.chromium.test.SampleTest', 578 'class': 'org.chromium.test.SampleTest',
469 'is_junit4': False, 579 'is_junit4': False,
470 'method': 'testMethod1', 580 'method': 'testMethod1',
471 }, 581 },
472 ] 582 ]
473 583
474 o._annotations = [('TestValue', '1')] 584 o._annotations = [('TestValue', '1')]
475 o._test_jar = 'path/to/test.jar' 585 o._test_jar = 'path/to/test.jar'
476 o._test_runner_junit4 = 'J4Runner' 586 o._junit4_runner_class = 'J4Runner'
477 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 587 with mock.patch(
478 return_value=raw_tests): 588 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
589 return_value=raw_tests):
479 actual_tests = o.GetTests() 590 actual_tests = o.GetTests()
480 591
481 self.assertEquals(actual_tests, expected_tests) 592 self.assertEquals(actual_tests, expected_tests)
482 593
483 def testGetTests_annotationDictValueFilter(self): 594 def testGetTests_annotationDictValueFilter(self):
484 o = self.createTestInstance() 595 o = self.createTestInstance()
485 raw_tests = [ 596 raw_tests = [
486 { 597 {
487 'annotations': {'Feature': {'value': ['Foo']}}, 598 'annotations': {'Feature': {'value': ['Foo']}},
488 'class': 'org.chromium.test.SampleTest', 599 'class': 'org.chromium.test.SampleTest',
(...skipping 29 matching lines...) Expand all
518 'SmallTest': None, 629 'SmallTest': None,
519 }, 630 },
520 'class': 'org.chromium.test.SampleTest2', 631 'class': 'org.chromium.test.SampleTest2',
521 'is_junit4': True, 632 'is_junit4': True,
522 'method': 'testMethod1', 633 'method': 'testMethod1',
523 }, 634 },
524 ] 635 ]
525 636
526 o._annotations = [('Feature', 'Bar')] 637 o._annotations = [('Feature', 'Bar')]
527 o._test_jar = 'path/to/test.jar' 638 o._test_jar = 'path/to/test.jar'
528 o._test_runner_junit4 = 'J4Runner' 639 o._junit4_runner_class = 'J4Runner'
529 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 640 with mock.patch(
530 return_value=raw_tests): 641 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
642 return_value=raw_tests):
531 actual_tests = o.GetTests() 643 actual_tests = o.GetTests()
532 644
533 self.assertEquals(actual_tests, expected_tests) 645 self.assertEquals(actual_tests, expected_tests)
534 646
647 def testGetTestName(self):
648 test = {
649 'annotations': {
650 'RunWith': {'value': 'class J4Runner'},
651 'SmallTest': {},
652 'Test': {'expected': 'class org.junit.Test$None',
653 'timeout': '0'},
654 'UiThreadTest': {}},
655 'class': 'org.chromium.TestA',
656 'is_junit4': True,
657 'method': 'testSimple'}
658 unqualified_class_test = {
659 'class': test['class'].split('.')[-1],
660 'method': test['method']
661 }
662
663 self.assertEquals(
664 instrumentation_test_instance.GetTestName(test, sep='.'),
665 'org.chromium.TestA.testSimple')
666 self.assertEquals(
667 instrumentation_test_instance.GetTestName(
668 unqualified_class_test, sep='.'),
669 'TestA.testSimple')
670
671 def testGetUniqueTestName(self):
672 test = {
673 'annotations': {
674 'RunWith': {'value': 'class J4Runner'},
675 'SmallTest': {},
676 'Test': {'expected': 'class org.junit.Test$None', 'timeout': '0'},
677 'UiThreadTest': {}},
678 'class': 'org.chromium.TestA',
679 'flags': ['enable_features=abc'],
680 'is_junit4': True,
681 'method': 'testSimple'}
682 self.assertEquals(
683 instrumentation_test_instance.GetUniqueTestName(
684 test, sep='.'),
685 'org.chromium.TestA.testSimple with enable_features=abc')
686
687 def testGetTestNameWithoutParameterPostfix(self):
688 test = {
689 'annotations': {
690 'RunWith': {'value': 'class J4Runner'},
691 'SmallTest': {},
692 'Test': {'expected': 'class org.junit.Test$None', 'timeout': '0'},
693 'UiThreadTest': {}},
694 'class': 'org.chromium.TestA__sandbox_mode',
695 'flags': 'enable_features=abc',
696 'is_junit4': True,
697 'method': 'testSimple'}
698 unqualified_class_test = {
699 'class': test['class'].split('.')[-1],
700 'method': test['method']
701 }
702 self.assertEquals(
703 instrumentation_test_instance.GetTestNameWithoutParameterPostfix(
704 test, sep='.'),
705 'org.chromium.TestA')
706 self.assertEquals(
707 instrumentation_test_instance.GetTestNameWithoutParameterPostfix(
708 unqualified_class_test, sep='.'),
709 'TestA')
710
535 def testGetTests_multipleAnnotationValuesRequested(self): 711 def testGetTests_multipleAnnotationValuesRequested(self):
536 o = self.createTestInstance() 712 o = self.createTestInstance()
537 raw_tests = [ 713 raw_tests = [
538 { 714 {
539 'annotations': {'Feature': {'value': ['Foo']}}, 715 'annotations': {'Feature': {'value': ['Foo']}},
540 'class': 'org.chromium.test.SampleTest', 716 'class': 'org.chromium.test.SampleTest',
541 'superclass': 'junit.framework.TestCase', 717 'superclass': 'junit.framework.TestCase',
542 'methods': [ 718 'methods': [
543 { 719 {
544 'annotations': {'SmallTest': None}, 720 'annotations': {'SmallTest': None},
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 'SmallTest': None, 758 'SmallTest': None,
583 }, 759 },
584 'class': 'org.chromium.test.SampleTest2', 760 'class': 'org.chromium.test.SampleTest2',
585 'is_junit4': False, 761 'is_junit4': False,
586 'method': 'testMethod1', 762 'method': 'testMethod1',
587 }, 763 },
588 ] 764 ]
589 765
590 o._annotations = [('Feature', 'Bar'), ('Feature', 'Baz')] 766 o._annotations = [('Feature', 'Bar'), ('Feature', 'Baz')]
591 o._test_jar = 'path/to/test.jar' 767 o._test_jar = 'path/to/test.jar'
592 o._test_runner_junit4 = 'J4Runner' 768 o._junit4_runner_class = 'J4Runner'
593 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 769 with mock.patch(
594 return_value=raw_tests): 770 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
771 return_value=raw_tests):
595 actual_tests = o.GetTests() 772 actual_tests = o.GetTests()
596 773
597 self.assertEquals(actual_tests, expected_tests) 774 self.assertEquals(actual_tests, expected_tests)
598 775
599 def testGenerateTestResults_noStatus(self): 776 def testGenerateTestResults_noStatus(self):
600 results = instrumentation_test_instance.GenerateTestResults( 777 results = instrumentation_test_instance.GenerateTestResults(
601 None, None, [], 0, 1000) 778 None, None, [], 0, 1000)
602 self.assertEqual([], results) 779 self.assertEqual([], results)
603 780
604 def testGenerateTestResults_testPassed(self): 781 def testGenerateTestResults_testPassed(self):
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 { 934 {
758 'annotations': { 935 'annotations': {
759 'CommandLineParameter': {'value': ['', 'enable-features=abc']}, 936 'CommandLineParameter': {'value': ['', 'enable-features=abc']},
760 'MediumTest': None}, 937 'MediumTest': None},
761 'class': 'org.chromium.test.SampleTest', 938 'class': 'org.chromium.test.SampleTest',
762 'flags': ['--enable-features=abc'], 939 'flags': ['--enable-features=abc'],
763 'is_junit4': True, 940 'is_junit4': True,
764 'method': 'testMethod2'}] 941 'method': 'testMethod2'}]
765 942
766 o._test_jar = 'path/to/test.jar' 943 o._test_jar = 'path/to/test.jar'
767 o._test_runner_junit4 = 'J4Runner' 944 o._junit4_runner_class = 'J4Runner'
768 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 945 with mock.patch(
769 return_value=raw_tests): 946 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
947 return_value=raw_tests):
770 actual_tests = o.GetTests() 948 actual_tests = o.GetTests()
771 self.assertEquals(actual_tests, expected_tests) 949 self.assertEquals(actual_tests, expected_tests)
772 950
773 def testCommandLineParameterization_skipped(self): 951 def testCommandLineParameterization_skipped(self):
774 o = self.createTestInstance() 952 o = self.createTestInstance()
775 raw_tests = [ 953 raw_tests = [
776 { 954 {
777 'annotations': {'CommandLineParameter': { 955 'annotations': {'CommandLineParameter': {
778 'value': ['', 'enable-features=abc']}}, 956 'value': ['', 'enable-features=abc']}},
779 'class': 'org.chromium.test.SampleTest', 957 'class': 'org.chromium.test.SampleTest',
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 { 991 {
814 'annotations': { 992 'annotations': {
815 'CommandLineParameter': {'value': ['', 'enable-features=abc']}, 993 'CommandLineParameter': {'value': ['', 'enable-features=abc']},
816 'MediumTest': None}, 994 'MediumTest': None},
817 'class': 'org.chromium.test.SampleTest', 995 'class': 'org.chromium.test.SampleTest',
818 'flags': ['--enable-features=abc'], 996 'flags': ['--enable-features=abc'],
819 'is_junit4': True, 997 'is_junit4': True,
820 'method': 'testMethod2'}] 998 'method': 'testMethod2'}]
821 999
822 o._test_jar = 'path/to/test.jar' 1000 o._test_jar = 'path/to/test.jar'
823 o._test_runner_junit4 = 'J4Runner' 1001 o._junit4_runner_class = 'J4Runner'
824 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', 1002 with mock.patch(
825 return_value=raw_tests): 1003 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner',
1004 return_value=raw_tests):
826 actual_tests = o.GetTests() 1005 actual_tests = o.GetTests()
827 self.assertEquals(actual_tests, expected_tests) 1006 self.assertEquals(actual_tests, expected_tests)
828 1007
829 if __name__ == '__main__': 1008 if __name__ == '__main__':
830 unittest.main(verbosity=2) 1009 unittest.main(verbosity=2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698