OLD | NEW |
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 Loading... |
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 o._tests_from_runner = raw_tests |
149 return_value=raw_tests): | 149 actual_tests = o.GetTests() |
150 actual_tests = o.GetTests() | |
151 | 150 |
152 self.assertEquals(actual_tests, expected_tests) | 151 self.assertEquals(actual_tests, expected_tests) |
153 | 152 |
154 def testGetTests_simpleGtestFilter(self): | 153 def testGetTests_simpleGtestFilter(self): |
155 o = self.createTestInstance() | 154 o = self.createTestInstance() |
156 raw_tests = [ | 155 raw_tests = [ |
157 { | 156 { |
158 'annotations': {'Feature': {'value': ['Foo']}}, | 157 'annotations': {'Feature': {'value': ['Foo']}}, |
159 'class': 'org.chromium.test.SampleTest', | 158 'class': 'org.chromium.test.SampleTest', |
160 'superclass': 'java.lang.Object', | 159 'superclass': 'java.lang.Object', |
(...skipping 17 matching lines...) Expand all Loading... |
178 'SmallTest': None, | 177 'SmallTest': None, |
179 }, | 178 }, |
180 'class': 'org.chromium.test.SampleTest', | 179 'class': 'org.chromium.test.SampleTest', |
181 'is_junit4': True, | 180 'is_junit4': True, |
182 'method': 'testMethod1', | 181 'method': 'testMethod1', |
183 }, | 182 }, |
184 ] | 183 ] |
185 | 184 |
186 o._test_filter = 'org.chromium.test.SampleTest.testMethod1' | 185 o._test_filter = 'org.chromium.test.SampleTest.testMethod1' |
187 o._test_jar = 'path/to/test.jar' | 186 o._test_jar = 'path/to/test.jar' |
188 o._test_runner_junit4 = 'J4Runner' | 187 o._junit4_runner_class = 'J4Runner' |
189 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 188 o._tests_from_runner = raw_tests |
190 return_value=raw_tests): | 189 actual_tests = o.GetTests() |
191 actual_tests = o.GetTests() | |
192 | 190 |
193 self.assertEquals(actual_tests, expected_tests) | 191 self.assertEquals(actual_tests, expected_tests) |
194 | 192 |
| 193 def testGetTests_simpleGtestUnqualifiedNameFilter(self): |
| 194 o = self.createTestInstance() |
| 195 raw_tests = [ |
| 196 { |
| 197 'annotations': {'Feature': {'value': ['Foo']}}, |
| 198 'class': 'org.chromium.test.SampleTest', |
| 199 'superclass': 'java.lang.Object', |
| 200 'methods': [ |
| 201 { |
| 202 'annotations': {'SmallTest': None}, |
| 203 'method': 'testMethod1', |
| 204 }, |
| 205 { |
| 206 'annotations': {'MediumTest': None}, |
| 207 'method': 'testMethod2', |
| 208 }, |
| 209 ], |
| 210 } |
| 211 ] |
| 212 |
| 213 expected_tests = [ |
| 214 { |
| 215 'annotations': { |
| 216 'Feature': {'value': ['Foo']}, |
| 217 'SmallTest': None, |
| 218 }, |
| 219 'class': 'org.chromium.test.SampleTest', |
| 220 'is_junit4': True, |
| 221 'method': 'testMethod1', |
| 222 }, |
| 223 ] |
| 224 |
| 225 o._test_filter = 'SampleTest.testMethod1' |
| 226 o._test_jar = 'path/to/test.jar' |
| 227 o._junit4_runner_class = 'J4Runner' |
| 228 o._tests_from_runner = raw_tests |
| 229 actual_tests = o.GetTests() |
| 230 |
| 231 self.assertEquals(actual_tests, expected_tests) |
| 232 |
| 233 def testGetTests_parameterizedTestGtestFilter(self): |
| 234 o = self.createTestInstance() |
| 235 raw_tests = [ |
| 236 { |
| 237 'annotations': {'Feature': {'value': ['Foo']}}, |
| 238 'class': 'org.chromium.test.SampleTest', |
| 239 'superclass': 'java.lang.Object', |
| 240 'methods': [ |
| 241 { |
| 242 'annotations': {'SmallTest': None}, |
| 243 'method': 'testMethod1', |
| 244 }, |
| 245 { |
| 246 'annotations': {'SmallTest': None}, |
| 247 'method': 'testMethod1__sandboxed_mode', |
| 248 }, |
| 249 ], |
| 250 }, |
| 251 { |
| 252 'annotations': {'Feature': {'value': ['Bar']}}, |
| 253 'class': 'org.chromium.test.SampleTest2', |
| 254 'superclass': 'java.lang.Object', |
| 255 'methods': [ |
| 256 { |
| 257 'annotations': {'SmallTest': None}, |
| 258 'method': 'testMethod1', |
| 259 }, |
| 260 ], |
| 261 } |
| 262 ] |
| 263 |
| 264 expected_tests = [ |
| 265 { |
| 266 'annotations': { |
| 267 'Feature': {'value': ['Foo']}, |
| 268 'SmallTest': None, |
| 269 }, |
| 270 'class': 'org.chromium.test.SampleTest', |
| 271 'method': 'testMethod1', |
| 272 'is_junit4': True, |
| 273 }, |
| 274 { |
| 275 'annotations': { |
| 276 'Feature': {'value': ['Foo']}, |
| 277 'SmallTest': None, |
| 278 }, |
| 279 'class': 'org.chromium.test.SampleTest', |
| 280 'method': 'testMethod1__sandboxed_mode', |
| 281 'is_junit4': True, |
| 282 }, |
| 283 ] |
| 284 |
| 285 o._test_jar = 'path/to/test.jar' |
| 286 o._junit4_runner_class = 'J4Runner' |
| 287 o._test_filter = 'org.chromium.test.SampleTest.testMethod1' |
| 288 o._tests_from_runner = raw_tests |
| 289 actual_tests = o.GetTests() |
| 290 |
| 291 self.assertEquals(actual_tests, expected_tests) |
| 292 |
195 def testGetTests_wildcardGtestFilter(self): | 293 def testGetTests_wildcardGtestFilter(self): |
196 o = self.createTestInstance() | 294 o = self.createTestInstance() |
197 raw_tests = [ | 295 raw_tests = [ |
198 { | 296 { |
199 'annotations': {'Feature': {'value': ['Foo']}}, | 297 'annotations': {'Feature': {'value': ['Foo']}}, |
200 'class': 'org.chromium.test.SampleTest', | 298 'class': 'org.chromium.test.SampleTest', |
201 'superclass': 'java.lang.Object', | 299 'superclass': 'java.lang.Object', |
202 'methods': [ | 300 'methods': [ |
203 { | 301 { |
204 'annotations': {'SmallTest': None}, | 302 'annotations': {'SmallTest': None}, |
(...skipping 25 matching lines...) Expand all Loading... |
230 'SmallTest': None, | 328 'SmallTest': None, |
231 }, | 329 }, |
232 'class': 'org.chromium.test.SampleTest2', | 330 'class': 'org.chromium.test.SampleTest2', |
233 'is_junit4': True, | 331 'is_junit4': True, |
234 'method': 'testMethod1', | 332 'method': 'testMethod1', |
235 }, | 333 }, |
236 ] | 334 ] |
237 | 335 |
238 o._test_filter = 'org.chromium.test.SampleTest2.*' | 336 o._test_filter = 'org.chromium.test.SampleTest2.*' |
239 o._test_jar = 'path/to/test.jar' | 337 o._test_jar = 'path/to/test.jar' |
240 o._test_runner_junit4 = 'J4Runner' | 338 o._junit4_runner_class = 'J4Runner' |
241 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 339 o._tests_from_runner = raw_tests |
242 return_value=raw_tests): | 340 actual_tests = o.GetTests() |
243 actual_tests = o.GetTests() | |
244 | 341 |
245 self.assertEquals(actual_tests, expected_tests) | 342 self.assertEquals(actual_tests, expected_tests) |
246 | 343 |
247 def testGetTests_negativeGtestFilter(self): | 344 def testGetTests_negativeGtestFilter(self): |
248 o = self.createTestInstance() | 345 o = self.createTestInstance() |
249 raw_tests = [ | 346 raw_tests = [ |
250 { | 347 { |
251 'annotations': {'Feature': {'value': ['Foo']}}, | 348 'annotations': {'Feature': {'value': ['Foo']}}, |
252 'class': 'org.chromium.test.SampleTest', | 349 'class': 'org.chromium.test.SampleTest', |
253 'superclass': 'java.lang.Object', | 350 'superclass': 'java.lang.Object', |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 'SmallTest': None, | 388 'SmallTest': None, |
292 }, | 389 }, |
293 'class': 'org.chromium.test.SampleTest2', | 390 'class': 'org.chromium.test.SampleTest2', |
294 'is_junit4': True, | 391 'is_junit4': True, |
295 'method': 'testMethod1', | 392 'method': 'testMethod1', |
296 }, | 393 }, |
297 ] | 394 ] |
298 | 395 |
299 o._test_filter = '*-org.chromium.test.SampleTest.testMethod1' | 396 o._test_filter = '*-org.chromium.test.SampleTest.testMethod1' |
300 o._test_jar = 'path/to/test.jar' | 397 o._test_jar = 'path/to/test.jar' |
301 o._test_runner_junit4 = 'J4Runner' | 398 o._junit4_runner_class = 'J4Runner' |
302 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 399 o._tests_from_runner = raw_tests |
303 return_value=raw_tests): | 400 actual_tests = o.GetTests() |
304 actual_tests = o.GetTests() | |
305 | 401 |
306 self.assertEquals(actual_tests, expected_tests) | 402 self.assertEquals(actual_tests, expected_tests) |
307 | 403 |
308 def testGetTests_annotationFilter(self): | 404 def testGetTests_annotationFilter(self): |
309 o = self.createTestInstance() | 405 o = self.createTestInstance() |
310 raw_tests = [ | 406 raw_tests = [ |
311 { | 407 { |
312 'annotations': {'Feature': {'value': ['Foo']}}, | 408 'annotations': {'Feature': {'value': ['Foo']}}, |
313 'class': 'org.chromium.test.SampleTest', | 409 'class': 'org.chromium.test.SampleTest', |
314 'superclass': 'java.lang.Object', | 410 'superclass': 'java.lang.Object', |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 'SmallTest': None, | 448 'SmallTest': None, |
353 }, | 449 }, |
354 'class': 'org.chromium.test.SampleTest2', | 450 'class': 'org.chromium.test.SampleTest2', |
355 'is_junit4': True, | 451 'is_junit4': True, |
356 'method': 'testMethod1', | 452 'method': 'testMethod1', |
357 }, | 453 }, |
358 ] | 454 ] |
359 | 455 |
360 o._annotations = [('SmallTest', None)] | 456 o._annotations = [('SmallTest', None)] |
361 o._test_jar = 'path/to/test.jar' | 457 o._test_jar = 'path/to/test.jar' |
362 o._test_runner_junit4 = 'J4Runner' | 458 o._junit4_runner_class = 'J4Runner' |
363 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 459 o._tests_from_runner = raw_tests |
364 return_value=raw_tests): | 460 actual_tests = o.GetTests() |
365 actual_tests = o.GetTests() | |
366 | 461 |
367 self.assertEquals(actual_tests, expected_tests) | 462 self.assertEquals(actual_tests, expected_tests) |
368 | 463 |
369 def testGetTests_excludedAnnotationFilter(self): | 464 def testGetTests_excludedAnnotationFilter(self): |
370 o = self.createTestInstance() | 465 o = self.createTestInstance() |
371 raw_tests = [ | 466 raw_tests = [ |
372 { | 467 { |
373 'annotations': {'Feature': {'value': ['Foo']}}, | 468 'annotations': {'Feature': {'value': ['Foo']}}, |
374 'class': 'org.chromium.test.SampleTest', | 469 'class': 'org.chromium.test.SampleTest', |
375 'superclass': 'junit.framework.TestCase', | 470 'superclass': 'junit.framework.TestCase', |
(...skipping 28 matching lines...) Expand all Loading... |
404 'MediumTest': None, | 499 'MediumTest': None, |
405 }, | 500 }, |
406 'class': 'org.chromium.test.SampleTest', | 501 'class': 'org.chromium.test.SampleTest', |
407 'is_junit4': False, | 502 'is_junit4': False, |
408 'method': 'testMethod2', | 503 'method': 'testMethod2', |
409 }, | 504 }, |
410 ] | 505 ] |
411 | 506 |
412 o._excluded_annotations = [('SmallTest', None)] | 507 o._excluded_annotations = [('SmallTest', None)] |
413 o._test_jar = 'path/to/test.jar' | 508 o._test_jar = 'path/to/test.jar' |
414 o._test_runner_junit4 = 'J4Runner' | 509 o._junit4_runner_class = 'J4Runner' |
415 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 510 o._tests_from_runner = raw_tests |
416 return_value=raw_tests): | 511 actual_tests = o.GetTests() |
417 actual_tests = o.GetTests() | |
418 | 512 |
419 self.assertEquals(actual_tests, expected_tests) | 513 self.assertEquals(actual_tests, expected_tests) |
420 | 514 |
421 def testGetTests_annotationSimpleValueFilter(self): | 515 def testGetTests_annotationSimpleValueFilter(self): |
422 o = self.createTestInstance() | 516 o = self.createTestInstance() |
423 raw_tests = [ | 517 raw_tests = [ |
424 { | 518 { |
425 'annotations': {'Feature': {'value': ['Foo']}}, | 519 'annotations': {'Feature': {'value': ['Foo']}}, |
426 'class': 'org.chromium.test.SampleTest', | 520 'class': 'org.chromium.test.SampleTest', |
427 'superclass': 'junit.framework.TestCase', | 521 'superclass': 'junit.framework.TestCase', |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 'TestValue': '1', | 560 'TestValue': '1', |
467 }, | 561 }, |
468 'class': 'org.chromium.test.SampleTest', | 562 'class': 'org.chromium.test.SampleTest', |
469 'is_junit4': False, | 563 'is_junit4': False, |
470 'method': 'testMethod1', | 564 'method': 'testMethod1', |
471 }, | 565 }, |
472 ] | 566 ] |
473 | 567 |
474 o._annotations = [('TestValue', '1')] | 568 o._annotations = [('TestValue', '1')] |
475 o._test_jar = 'path/to/test.jar' | 569 o._test_jar = 'path/to/test.jar' |
476 o._test_runner_junit4 = 'J4Runner' | 570 o._junit4_runner_class = 'J4Runner' |
477 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 571 o._tests_from_runner = raw_tests |
478 return_value=raw_tests): | 572 actual_tests = o.GetTests() |
479 actual_tests = o.GetTests() | |
480 | 573 |
481 self.assertEquals(actual_tests, expected_tests) | 574 self.assertEquals(actual_tests, expected_tests) |
482 | 575 |
483 def testGetTests_annotationDictValueFilter(self): | 576 def testGetTests_annotationDictValueFilter(self): |
484 o = self.createTestInstance() | 577 o = self.createTestInstance() |
485 raw_tests = [ | 578 raw_tests = [ |
486 { | 579 { |
487 'annotations': {'Feature': {'value': ['Foo']}}, | 580 'annotations': {'Feature': {'value': ['Foo']}}, |
488 'class': 'org.chromium.test.SampleTest', | 581 'class': 'org.chromium.test.SampleTest', |
489 'superclass': 'java.lang.Object', | 582 'superclass': 'java.lang.Object', |
(...skipping 28 matching lines...) Expand all Loading... |
518 'SmallTest': None, | 611 'SmallTest': None, |
519 }, | 612 }, |
520 'class': 'org.chromium.test.SampleTest2', | 613 'class': 'org.chromium.test.SampleTest2', |
521 'is_junit4': True, | 614 'is_junit4': True, |
522 'method': 'testMethod1', | 615 'method': 'testMethod1', |
523 }, | 616 }, |
524 ] | 617 ] |
525 | 618 |
526 o._annotations = [('Feature', 'Bar')] | 619 o._annotations = [('Feature', 'Bar')] |
527 o._test_jar = 'path/to/test.jar' | 620 o._test_jar = 'path/to/test.jar' |
528 o._test_runner_junit4 = 'J4Runner' | 621 o._junit4_runner_class = 'J4Runner' |
529 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 622 o._tests_from_runner = raw_tests |
530 return_value=raw_tests): | 623 actual_tests = o.GetTests() |
531 actual_tests = o.GetTests() | |
532 | 624 |
533 self.assertEquals(actual_tests, expected_tests) | 625 self.assertEquals(actual_tests, expected_tests) |
534 | 626 |
| 627 def testGetTestName(self): |
| 628 test = { |
| 629 'annotations': { |
| 630 'RunWith': {'value': 'class J4Runner'}, |
| 631 'SmallTest': {}, |
| 632 'Test': {'expected': 'class org.junit.Test$None', |
| 633 'timeout': '0'}, |
| 634 'UiThreadTest': {}}, |
| 635 'class': 'org.chromium.TestA', |
| 636 'is_junit4': True, |
| 637 'method': 'testSimple'} |
| 638 unqualified_class_test = { |
| 639 'class': test['class'].split('.')[-1], |
| 640 'method': test['method'] |
| 641 } |
| 642 |
| 643 self.assertEquals( |
| 644 instrumentation_test_instance.GetTestName(test, sep='.'), |
| 645 'org.chromium.TestA.testSimple') |
| 646 self.assertEquals( |
| 647 instrumentation_test_instance.GetTestName( |
| 648 unqualified_class_test, sep='.'), |
| 649 'TestA.testSimple') |
| 650 |
| 651 def testGetUniqueTestName(self): |
| 652 test = { |
| 653 'annotations': { |
| 654 'RunWith': {'value': 'class J4Runner'}, |
| 655 'SmallTest': {}, |
| 656 'Test': {'expected': 'class org.junit.Test$None', 'timeout': '0'}, |
| 657 'UiThreadTest': {}}, |
| 658 'class': 'org.chromium.TestA', |
| 659 'flags': ['enable_features=abc'], |
| 660 'is_junit4': True, |
| 661 'method': 'testSimple'} |
| 662 self.assertEquals( |
| 663 instrumentation_test_instance.GetUniqueTestName( |
| 664 test, sep='.'), |
| 665 'org.chromium.TestA.testSimple with enable_features=abc') |
| 666 |
| 667 def testGetTestNameWithoutParameterPostfix(self): |
| 668 test = { |
| 669 'annotations': { |
| 670 'RunWith': {'value': 'class J4Runner'}, |
| 671 'SmallTest': {}, |
| 672 'Test': {'expected': 'class org.junit.Test$None', 'timeout': '0'}, |
| 673 'UiThreadTest': {}}, |
| 674 'class': 'org.chromium.TestA__sandbox_mode', |
| 675 'flags': 'enable_features=abc', |
| 676 'is_junit4': True, |
| 677 'method': 'testSimple'} |
| 678 unqualified_class_test = { |
| 679 'class': test['class'].split('.')[-1], |
| 680 'method': test['method'] |
| 681 } |
| 682 self.assertEquals( |
| 683 instrumentation_test_instance.GetTestNameWithoutParameterPostfix( |
| 684 test, sep='.'), |
| 685 'org.chromium.TestA') |
| 686 self.assertEquals( |
| 687 instrumentation_test_instance.GetTestNameWithoutParameterPostfix( |
| 688 unqualified_class_test, sep='.'), |
| 689 'TestA') |
| 690 |
535 def testGetTests_multipleAnnotationValuesRequested(self): | 691 def testGetTests_multipleAnnotationValuesRequested(self): |
536 o = self.createTestInstance() | 692 o = self.createTestInstance() |
537 raw_tests = [ | 693 raw_tests = [ |
538 { | 694 { |
539 'annotations': {'Feature': {'value': ['Foo']}}, | 695 'annotations': {'Feature': {'value': ['Foo']}}, |
540 'class': 'org.chromium.test.SampleTest', | 696 'class': 'org.chromium.test.SampleTest', |
541 'superclass': 'junit.framework.TestCase', | 697 'superclass': 'junit.framework.TestCase', |
542 'methods': [ | 698 'methods': [ |
543 { | 699 { |
544 'annotations': {'SmallTest': None}, | 700 'annotations': {'SmallTest': None}, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 'SmallTest': None, | 738 'SmallTest': None, |
583 }, | 739 }, |
584 'class': 'org.chromium.test.SampleTest2', | 740 'class': 'org.chromium.test.SampleTest2', |
585 'is_junit4': False, | 741 'is_junit4': False, |
586 'method': 'testMethod1', | 742 'method': 'testMethod1', |
587 }, | 743 }, |
588 ] | 744 ] |
589 | 745 |
590 o._annotations = [('Feature', 'Bar'), ('Feature', 'Baz')] | 746 o._annotations = [('Feature', 'Bar'), ('Feature', 'Baz')] |
591 o._test_jar = 'path/to/test.jar' | 747 o._test_jar = 'path/to/test.jar' |
592 o._test_runner_junit4 = 'J4Runner' | 748 o._junit4_runner_class = 'J4Runner' |
593 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 749 o._tests_from_runner = raw_tests |
594 return_value=raw_tests): | 750 actual_tests = o.GetTests() |
595 actual_tests = o.GetTests() | |
596 | 751 |
597 self.assertEquals(actual_tests, expected_tests) | 752 self.assertEquals(actual_tests, expected_tests) |
598 | 753 |
599 def testGenerateTestResults_noStatus(self): | 754 def testGenerateTestResults_noStatus(self): |
600 results = instrumentation_test_instance.GenerateTestResults( | 755 results = instrumentation_test_instance.GenerateTestResults( |
601 None, None, [], 0, 1000) | 756 None, None, [], 0, 1000) |
602 self.assertEqual([], results) | 757 self.assertEqual([], results) |
603 | 758 |
604 def testGenerateTestResults_testPassed(self): | 759 def testGenerateTestResults_testPassed(self): |
605 statuses = [ | 760 statuses = [ |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 { | 912 { |
758 'annotations': { | 913 'annotations': { |
759 'CommandLineParameter': {'value': ['', 'enable-features=abc']}, | 914 'CommandLineParameter': {'value': ['', 'enable-features=abc']}, |
760 'MediumTest': None}, | 915 'MediumTest': None}, |
761 'class': 'org.chromium.test.SampleTest', | 916 'class': 'org.chromium.test.SampleTest', |
762 'flags': ['--enable-features=abc'], | 917 'flags': ['--enable-features=abc'], |
763 'is_junit4': True, | 918 'is_junit4': True, |
764 'method': 'testMethod2'}] | 919 'method': 'testMethod2'}] |
765 | 920 |
766 o._test_jar = 'path/to/test.jar' | 921 o._test_jar = 'path/to/test.jar' |
767 o._test_runner_junit4 = 'J4Runner' | 922 o._junit4_runner_class = 'J4Runner' |
768 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 923 o._tests_from_runner = raw_tests |
769 return_value=raw_tests): | 924 actual_tests = o.GetTests() |
770 actual_tests = o.GetTests() | |
771 self.assertEquals(actual_tests, expected_tests) | 925 self.assertEquals(actual_tests, expected_tests) |
772 | 926 |
773 def testCommandLineParameterization_skipped(self): | 927 def testCommandLineParameterization_skipped(self): |
774 o = self.createTestInstance() | 928 o = self.createTestInstance() |
775 raw_tests = [ | 929 raw_tests = [ |
776 { | 930 { |
777 'annotations': {'CommandLineParameter': { | 931 'annotations': {'CommandLineParameter': { |
778 'value': ['', 'enable-features=abc']}}, | 932 'value': ['', 'enable-features=abc']}}, |
779 'class': 'org.chromium.test.SampleTest', | 933 'class': 'org.chromium.test.SampleTest', |
780 'superclass': 'java.lang.Object', | 934 'superclass': 'java.lang.Object', |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 { | 967 { |
814 'annotations': { | 968 'annotations': { |
815 'CommandLineParameter': {'value': ['', 'enable-features=abc']}, | 969 'CommandLineParameter': {'value': ['', 'enable-features=abc']}, |
816 'MediumTest': None}, | 970 'MediumTest': None}, |
817 'class': 'org.chromium.test.SampleTest', | 971 'class': 'org.chromium.test.SampleTest', |
818 'flags': ['--enable-features=abc'], | 972 'flags': ['--enable-features=abc'], |
819 'is_junit4': True, | 973 'is_junit4': True, |
820 'method': 'testMethod2'}] | 974 'method': 'testMethod2'}] |
821 | 975 |
822 o._test_jar = 'path/to/test.jar' | 976 o._test_jar = 'path/to/test.jar' |
823 o._test_runner_junit4 = 'J4Runner' | 977 o._junit4_runner_class = 'J4Runner' |
824 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 978 o._tests_from_runner = raw_tests |
825 return_value=raw_tests): | 979 actual_tests = o.GetTests() |
826 actual_tests = o.GetTests() | |
827 self.assertEquals(actual_tests, expected_tests) | 980 self.assertEquals(actual_tests, expected_tests) |
828 | 981 |
829 if __name__ == '__main__': | 982 if __name__ == '__main__': |
830 unittest.main(verbosity=2) | 983 unittest.main(verbosity=2) |
OLD | NEW |