Chromium Code Reviews| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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._test_runner_junit4 = '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 19 matching lines...) Expand all Loading... | |
| 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._test_runner_junit4 = '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) |
| 194 | 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._test_runner_junit4 = '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._test_runner_junit4 = '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) | |
| 300 | |
| 301 | |
| 195 def testGetTests_wildcardGtestFilter(self): | 302 def testGetTests_wildcardGtestFilter(self): |
| 196 o = self.createTestInstance() | 303 o = self.createTestInstance() |
| 197 raw_tests = [ | 304 raw_tests = [ |
| 198 { | 305 { |
| 199 'annotations': {'Feature': {'value': ['Foo']}}, | 306 'annotations': {'Feature': {'value': ['Foo']}}, |
| 200 'class': 'org.chromium.test.SampleTest', | 307 'class': 'org.chromium.test.SampleTest', |
| 201 'superclass': 'java.lang.Object', | 308 'superclass': 'java.lang.Object', |
| 202 'methods': [ | 309 'methods': [ |
| 203 { | 310 { |
| 204 'annotations': {'SmallTest': None}, | 311 'annotations': {'SmallTest': None}, |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 231 }, | 338 }, |
| 232 'class': 'org.chromium.test.SampleTest2', | 339 'class': 'org.chromium.test.SampleTest2', |
| 233 'is_junit4': True, | 340 'is_junit4': True, |
| 234 'method': 'testMethod1', | 341 'method': 'testMethod1', |
| 235 }, | 342 }, |
| 236 ] | 343 ] |
| 237 | 344 |
| 238 o._test_filter = 'org.chromium.test.SampleTest2.*' | 345 o._test_filter = 'org.chromium.test.SampleTest2.*' |
| 239 o._test_jar = 'path/to/test.jar' | 346 o._test_jar = 'path/to/test.jar' |
| 240 o._test_runner_junit4 = 'J4Runner' | 347 o._test_runner_junit4 = 'J4Runner' |
| 241 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 348 with mock.patch( |
| 242 return_value=raw_tests): | 349 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner', |
| 350 return_value=raw_tests): | |
| 243 actual_tests = o.GetTests() | 351 actual_tests = o.GetTests() |
| 244 | 352 |
| 245 self.assertEquals(actual_tests, expected_tests) | 353 self.assertEquals(actual_tests, expected_tests) |
| 246 | 354 |
| 247 def testGetTests_negativeGtestFilter(self): | 355 def testGetTests_negativeGtestFilter(self): |
| 248 o = self.createTestInstance() | 356 o = self.createTestInstance() |
| 249 raw_tests = [ | 357 raw_tests = [ |
| 250 { | 358 { |
| 251 'annotations': {'Feature': {'value': ['Foo']}}, | 359 'annotations': {'Feature': {'value': ['Foo']}}, |
| 252 'class': 'org.chromium.test.SampleTest', | 360 'class': 'org.chromium.test.SampleTest', |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 }, | 400 }, |
| 293 'class': 'org.chromium.test.SampleTest2', | 401 'class': 'org.chromium.test.SampleTest2', |
| 294 'is_junit4': True, | 402 'is_junit4': True, |
| 295 'method': 'testMethod1', | 403 'method': 'testMethod1', |
| 296 }, | 404 }, |
| 297 ] | 405 ] |
| 298 | 406 |
| 299 o._test_filter = '*-org.chromium.test.SampleTest.testMethod1' | 407 o._test_filter = '*-org.chromium.test.SampleTest.testMethod1' |
| 300 o._test_jar = 'path/to/test.jar' | 408 o._test_jar = 'path/to/test.jar' |
| 301 o._test_runner_junit4 = 'J4Runner' | 409 o._test_runner_junit4 = 'J4Runner' |
| 302 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 410 with mock.patch( |
| 303 return_value=raw_tests): | 411 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner', |
| 412 return_value=raw_tests): | |
| 304 actual_tests = o.GetTests() | 413 actual_tests = o.GetTests() |
| 305 | 414 |
| 306 self.assertEquals(actual_tests, expected_tests) | 415 self.assertEquals(actual_tests, expected_tests) |
| 307 | 416 |
| 308 def testGetTests_annotationFilter(self): | 417 def testGetTests_annotationFilter(self): |
| 309 o = self.createTestInstance() | 418 o = self.createTestInstance() |
| 310 raw_tests = [ | 419 raw_tests = [ |
| 311 { | 420 { |
| 312 'annotations': {'Feature': {'value': ['Foo']}}, | 421 'annotations': {'Feature': {'value': ['Foo']}}, |
| 313 'class': 'org.chromium.test.SampleTest', | 422 'class': 'org.chromium.test.SampleTest', |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 }, | 462 }, |
| 354 'class': 'org.chromium.test.SampleTest2', | 463 'class': 'org.chromium.test.SampleTest2', |
| 355 'is_junit4': True, | 464 'is_junit4': True, |
| 356 'method': 'testMethod1', | 465 'method': 'testMethod1', |
| 357 }, | 466 }, |
| 358 ] | 467 ] |
| 359 | 468 |
| 360 o._annotations = [('SmallTest', None)] | 469 o._annotations = [('SmallTest', None)] |
| 361 o._test_jar = 'path/to/test.jar' | 470 o._test_jar = 'path/to/test.jar' |
| 362 o._test_runner_junit4 = 'J4Runner' | 471 o._test_runner_junit4 = 'J4Runner' |
| 363 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 472 with mock.patch( |
| 364 return_value=raw_tests): | 473 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner', |
| 474 return_value=raw_tests): | |
| 365 actual_tests = o.GetTests() | 475 actual_tests = o.GetTests() |
| 366 | 476 |
| 367 self.assertEquals(actual_tests, expected_tests) | 477 self.assertEquals(actual_tests, expected_tests) |
| 368 | 478 |
| 369 def testGetTests_excludedAnnotationFilter(self): | 479 def testGetTests_excludedAnnotationFilter(self): |
| 370 o = self.createTestInstance() | 480 o = self.createTestInstance() |
| 371 raw_tests = [ | 481 raw_tests = [ |
| 372 { | 482 { |
| 373 'annotations': {'Feature': {'value': ['Foo']}}, | 483 'annotations': {'Feature': {'value': ['Foo']}}, |
| 374 'class': 'org.chromium.test.SampleTest', | 484 'class': 'org.chromium.test.SampleTest', |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 405 }, | 515 }, |
| 406 'class': 'org.chromium.test.SampleTest', | 516 'class': 'org.chromium.test.SampleTest', |
| 407 'is_junit4': False, | 517 'is_junit4': False, |
| 408 'method': 'testMethod2', | 518 'method': 'testMethod2', |
| 409 }, | 519 }, |
| 410 ] | 520 ] |
| 411 | 521 |
| 412 o._excluded_annotations = [('SmallTest', None)] | 522 o._excluded_annotations = [('SmallTest', None)] |
| 413 o._test_jar = 'path/to/test.jar' | 523 o._test_jar = 'path/to/test.jar' |
| 414 o._test_runner_junit4 = 'J4Runner' | 524 o._test_runner_junit4 = 'J4Runner' |
| 415 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 525 with mock.patch( |
| 416 return_value=raw_tests): | 526 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner', |
| 527 return_value=raw_tests): | |
| 417 actual_tests = o.GetTests() | 528 actual_tests = o.GetTests() |
| 418 | 529 |
| 419 self.assertEquals(actual_tests, expected_tests) | 530 self.assertEquals(actual_tests, expected_tests) |
| 420 | 531 |
| 421 def testGetTests_annotationSimpleValueFilter(self): | 532 def testGetTests_annotationSimpleValueFilter(self): |
| 422 o = self.createTestInstance() | 533 o = self.createTestInstance() |
| 423 raw_tests = [ | 534 raw_tests = [ |
| 424 { | 535 { |
| 425 'annotations': {'Feature': {'value': ['Foo']}}, | 536 'annotations': {'Feature': {'value': ['Foo']}}, |
| 426 'class': 'org.chromium.test.SampleTest', | 537 'class': 'org.chromium.test.SampleTest', |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 }, | 578 }, |
| 468 'class': 'org.chromium.test.SampleTest', | 579 'class': 'org.chromium.test.SampleTest', |
| 469 'is_junit4': False, | 580 'is_junit4': False, |
| 470 'method': 'testMethod1', | 581 'method': 'testMethod1', |
| 471 }, | 582 }, |
| 472 ] | 583 ] |
| 473 | 584 |
| 474 o._annotations = [('TestValue', '1')] | 585 o._annotations = [('TestValue', '1')] |
| 475 o._test_jar = 'path/to/test.jar' | 586 o._test_jar = 'path/to/test.jar' |
| 476 o._test_runner_junit4 = 'J4Runner' | 587 o._test_runner_junit4 = 'J4Runner' |
| 477 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 588 with mock.patch( |
| 478 return_value=raw_tests): | 589 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner', |
| 590 return_value=raw_tests): | |
| 479 actual_tests = o.GetTests() | 591 actual_tests = o.GetTests() |
| 480 | 592 |
| 481 self.assertEquals(actual_tests, expected_tests) | 593 self.assertEquals(actual_tests, expected_tests) |
| 482 | 594 |
| 483 def testGetTests_annotationDictValueFilter(self): | 595 def testGetTests_annotationDictValueFilter(self): |
| 484 o = self.createTestInstance() | 596 o = self.createTestInstance() |
| 485 raw_tests = [ | 597 raw_tests = [ |
| 486 { | 598 { |
| 487 'annotations': {'Feature': {'value': ['Foo']}}, | 599 'annotations': {'Feature': {'value': ['Foo']}}, |
| 488 'class': 'org.chromium.test.SampleTest', | 600 'class': 'org.chromium.test.SampleTest', |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 519 }, | 631 }, |
| 520 'class': 'org.chromium.test.SampleTest2', | 632 'class': 'org.chromium.test.SampleTest2', |
| 521 'is_junit4': True, | 633 'is_junit4': True, |
| 522 'method': 'testMethod1', | 634 'method': 'testMethod1', |
| 523 }, | 635 }, |
| 524 ] | 636 ] |
| 525 | 637 |
| 526 o._annotations = [('Feature', 'Bar')] | 638 o._annotations = [('Feature', 'Bar')] |
| 527 o._test_jar = 'path/to/test.jar' | 639 o._test_jar = 'path/to/test.jar' |
| 528 o._test_runner_junit4 = 'J4Runner' | 640 o._test_runner_junit4 = 'J4Runner' |
| 529 with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle', | 641 with mock.patch( |
| 530 return_value=raw_tests): | 642 _INSTRUMENTATION_TEST_INSTANCE_PATH % 'GetAllTestsFromRunner', |
| 643 return_value=raw_tests): | |
| 531 actual_tests = o.GetTests() | 644 actual_tests = o.GetTests() |
| 532 | 645 |
| 533 self.assertEquals(actual_tests, expected_tests) | 646 self.assertEquals(actual_tests, expected_tests) |
| 534 | 647 |
| 648 def testGetTestName(self): | |
| 649 test = {'annotations': { | |
| 650 'RunWith': {'value': 'class J4Runner'}, | |
|
mikecase (-- gone --)
2017/07/18 23:59:12
intentation looks pretty weird here.
the real yoland
2017/07/19 00:12:49
Done
| |
| 651 'SmallTest': {}, | |
| 652 'Test': {'expected': 'class org.junit.Test$None', | |
| 653 'timeout': '0'}, | |
|
mikecase (-- gone --)
2017/07/18 23:59:12
extra space here.
the real yoland
2017/07/19 00:12:49
Done
| |
| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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._test_runner_junit4 = '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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 704 }), | 881 }), |
| 705 ] | 882 ] |
| 706 results = instrumentation_test_instance.GenerateTestResults( | 883 results = instrumentation_test_instance.GenerateTestResults( |
| 707 None, None, statuses, 0, 1000) | 884 None, None, statuses, 0, 1000) |
| 708 self.assertEqual(1, len(results)) | 885 self.assertEqual(1, len(results)) |
| 709 self.assertEqual(base_test_result.ResultType.SKIP, results[0].GetType()) | 886 self.assertEqual(base_test_result.ResultType.SKIP, results[0].GetType()) |
| 710 | 887 |
| 711 | 888 |
| 712 if __name__ == '__main__': | 889 if __name__ == '__main__': |
| 713 unittest.main(verbosity=2) | 890 unittest.main(verbosity=2) |
| OLD | NEW |