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