OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import re | 5 import re |
6 import string | 6 import string |
7 | 7 |
8 | 8 |
9 class Test(object): | 9 class Test(object): |
10 """ | 10 """ |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 mock_test_results = { | 1514 mock_test_results = { |
1515 'per_iteration_data': [{'TestA': [{'status': 'SUCCESS'}]}, | 1515 'per_iteration_data': [{'TestA': [{'status': 'SUCCESS'}]}, |
1516 {'TestB': [{'status': 'FAILURE'}]}] | 1516 {'TestB': [{'status': 'FAILURE'}]}] |
1517 } | 1517 } |
1518 api.chromium_android.run_java_unit_test_suite( | 1518 api.chromium_android.run_java_unit_test_suite( |
1519 self.name, verbose=True, suffix=suffix, | 1519 self.name, verbose=True, suffix=suffix, |
1520 json_results_file=json_results_file, | 1520 json_results_file=json_results_file, |
1521 step_test_data=lambda: api.json.test_api.output(mock_test_results)) | 1521 step_test_data=lambda: api.json.test_api.output(mock_test_results)) |
1522 | 1522 |
1523 | 1523 |
1524 # Provide a 1:1 mapping between CamelCase and snake_case instrumentation test | |
1525 # names. This provides a migration path to using swarming+isolates, which | |
1526 # specify additional build targets in src/ instead of here. | |
1527 ANDROID_INSTRUMENTATION_TARGET_MAP = { | |
1528 'AndroidWebViewTest': 'android_webview_test_apk', | |
1529 'ChromePublicTest': 'chrome_public_test_apk', | |
1530 'ChromeSyncShellTest': 'chrome_sync_shell_test_apk', | |
1531 'ChromotingTest': 'remoting_test_apk', | |
1532 'ContentShellTest': 'content_shell_test_apk', | |
1533 'MojoTest': 'mojo_test_apk', | |
1534 'SystemWebViewShellLayoutTest': 'system_webview_shell_layout_test_apk', | |
1535 } | |
1536 | |
1537 | |
1538 class AndroidInstrumentationTest(AndroidTest): | 1524 class AndroidInstrumentationTest(AndroidTest): |
1539 _DEFAULT_SUITES = { | 1525 _DEFAULT_SUITES = { |
1540 'AndroidWebViewTest': { | 1526 'AndroidWebViewTest': { |
| 1527 'compile_target': 'android_webview_test_apk', |
1541 'isolate_file_path': 'android_webview/android_webview_test_apk.isolate', | 1528 'isolate_file_path': 'android_webview/android_webview_test_apk.isolate', |
1542 'apk_under_test': 'AndroidWebView.apk', | 1529 'apk_under_test': 'AndroidWebView.apk', |
1543 'test_apk': 'AndroidWebViewTest.apk', | 1530 'test_apk': 'AndroidWebViewTest.apk', |
1544 }, | 1531 }, |
1545 'ChromePublicTest': { | 1532 'ChromePublicTest': { |
| 1533 'compile_target': 'chrome_public_test_apk', |
1546 'isolate_file_path': 'chrome/chrome_public_test_apk.isolate', | 1534 'isolate_file_path': 'chrome/chrome_public_test_apk.isolate', |
1547 'apk_under_test': 'ChromePublic.apk', | 1535 'apk_under_test': 'ChromePublic.apk', |
1548 'test_apk': 'ChromePublicTest.apk', | 1536 'test_apk': 'ChromePublicTest.apk', |
1549 'additional_apks': [ | 1537 'additional_apks': [ |
1550 'ChromePublicTestSupport.apk', | 1538 'ChromePublicTestSupport.apk', |
1551 'ChromiumNetTestSupport.apk', | 1539 'ChromiumNetTestSupport.apk', |
1552 ], | 1540 ], |
1553 }, | 1541 }, |
1554 'ChromeSyncShellTest': { | 1542 'ChromeSyncShellTest': { |
| 1543 'compile_target': 'chrome_sync_shell_test_apk', |
1555 'isolate_file_path': None, | 1544 'isolate_file_path': None, |
1556 'apk_under_test': 'ChromeSyncShell.apk', | 1545 'apk_under_test': 'ChromeSyncShell.apk', |
1557 'test_apk': 'ChromeSyncShellTest.apk', | 1546 'test_apk': 'ChromeSyncShellTest.apk', |
1558 }, | 1547 }, |
1559 'ChromotingTest': { | 1548 'ChromotingTest': { |
| 1549 'compile_target': 'remoting_test_apk', |
1560 'isolate_file_path': None, | 1550 'isolate_file_path': None, |
1561 'apk_under_test': 'Chromoting.apk', | 1551 'apk_under_test': 'Chromoting.apk', |
1562 'test_apk': 'ChromotingTest.apk', | 1552 'test_apk': 'ChromotingTest.apk', |
1563 }, | 1553 }, |
1564 'ContentShellTest': { | 1554 'ContentShellTest': { |
| 1555 'compile_target': 'content_shell_test_apk', |
1565 'isolate_file_path': 'content/content_shell_test_apk.isolate', | 1556 'isolate_file_path': 'content/content_shell_test_apk.isolate', |
1566 'apk_under_test': 'ContentShell.apk', | 1557 'apk_under_test': 'ContentShell.apk', |
1567 'test_apk': 'ContentShellTest.apk', | 1558 'test_apk': 'ContentShellTest.apk', |
1568 }, | 1559 }, |
1569 'SystemWebViewShellLayoutTest': { | 1560 'SystemWebViewShellLayoutTest': { |
1570 'extra_compile_targets': ['system_webview_apk', | 1561 'compile_target': 'system_webview_shell_layout_test_apk', |
1571 'system_webview_shell_apk', | 1562 'additional_compile_targets': [ |
1572 'android_tools'], | 1563 'system_webview_apk', |
| 1564 'system_webview_shell_apk', |
| 1565 'android_tools' |
| 1566 ], |
1573 'isolate_file_path': ('android_webview/' | 1567 'isolate_file_path': ('android_webview/' |
1574 'system_webview_shell_test_apk.isolate'), | 1568 'system_webview_shell_test_apk.isolate'), |
1575 'apk_under_test': 'SystemWebViewShell.apk', | 1569 'apk_under_test': 'SystemWebViewShell.apk', |
1576 'test_apk': 'SystemWebViewShellLayoutTest.apk', | 1570 'test_apk': 'SystemWebViewShellLayoutTest.apk', |
1577 'additional_apks': ['SystemWebView.apk'], | 1571 'additional_apks': ['SystemWebView.apk'], |
1578 }, | 1572 }, |
1579 'MojoTest': { | 1573 'MojoTest': { |
| 1574 'compile_target': 'mojo_test_apk', |
1580 'isolate_file_path': None, | 1575 'isolate_file_path': None, |
1581 'apk_under_test': None, | 1576 'apk_under_test': None, |
1582 'test_apk': 'MojoTest.apk', | 1577 'test_apk': 'MojoTest.apk', |
1583 } | 1578 } |
1584 } | 1579 } |
1585 | 1580 |
| 1581 _DEFAULT_SUITES_BY_TARGET = { |
| 1582 'android_webview_test_apk': _DEFAULT_SUITES['AndroidWebViewTest'], |
| 1583 'chrome_public_test_apk': _DEFAULT_SUITES['ChromePublicTest'], |
| 1584 'chrome_sync_shell_test_apk': _DEFAULT_SUITES['ChromeSyncShellTest'], |
| 1585 'content_shell_test_apk': _DEFAULT_SUITES['ContentShellTest'], |
| 1586 'mojo_test_apk': _DEFAULT_SUITES['MojoTest'], |
| 1587 'remoting_test_apk': _DEFAULT_SUITES['ChromotingTest'], |
| 1588 'system_webview_shell_layout_test_apk': |
| 1589 _DEFAULT_SUITES['SystemWebViewShellLayoutTest'], |
| 1590 } |
| 1591 |
1586 def __init__(self, name, compile_targets=None, apk_under_test=None, | 1592 def __init__(self, name, compile_targets=None, apk_under_test=None, |
1587 test_apk=None, isolate_file_path=None, timeout_scale=None, | 1593 test_apk=None, isolate_file_path=None, timeout_scale=None, |
1588 flakiness_dashboard='test-results.appspot.com', | 1594 flakiness_dashboard='test-results.appspot.com', |
1589 annotation=None, except_annotation=None, screenshot=False, | 1595 annotation=None, except_annotation=None, screenshot=False, |
1590 verbose=True, tool=None, host_driven_root=None, | 1596 verbose=True, tool=None, host_driven_root=None, |
1591 additional_apks=None): | 1597 additional_apks=None): |
1592 suite_defaults = AndroidInstrumentationTest._DEFAULT_SUITES.get(name, {}) | 1598 suite_defaults = ( |
| 1599 AndroidInstrumentationTest._DEFAULT_SUITES.get(name) |
| 1600 or AndroidInstrumentationTest._DEFAULT_SUITES_BY_TARGET.get(name) |
| 1601 or {}) |
1593 if not compile_targets: | 1602 if not compile_targets: |
1594 compile_targets = [] | 1603 compile_targets = [suite_defaults['compile_target']] |
1595 main_target = ANDROID_INSTRUMENTATION_TARGET_MAP.get(name) | 1604 compile_targets.extend( |
1596 if main_target: | 1605 suite_defaults.get('additional_compile_targets', [])) |
1597 compile_targets.append(main_target) | |
1598 compile_targets.extend(suite_defaults.get('extra_compile_targets', [])) | |
1599 | 1606 |
1600 super(AndroidInstrumentationTest, self).__init__( | 1607 super(AndroidInstrumentationTest, self).__init__( |
1601 name, | 1608 name, |
1602 compile_targets, | 1609 compile_targets, |
1603 isolate_file_path or suite_defaults.get('isolate_file_path')) | 1610 isolate_file_path or suite_defaults.get('isolate_file_path')) |
1604 self._additional_apks = ( | 1611 self._additional_apks = ( |
1605 additional_apks or suite_defaults.get('additional_apks')) | 1612 additional_apks or suite_defaults.get('additional_apks')) |
1606 self._annotation = annotation | 1613 self._annotation = annotation |
1607 self._apk_under_test = ( | 1614 self._apk_under_test = ( |
1608 apk_under_test or suite_defaults.get('apk_under_test')) | 1615 apk_under_test or suite_defaults.get('apk_under_test')) |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 def run(self, api, suffix, test_filter=None): | 1852 def run(self, api, suffix, test_filter=None): |
1846 api.chromium_android.coverage_report(upload=False) | 1853 api.chromium_android.coverage_report(upload=False) |
1847 api.chromium_android.get_changed_lines_for_revision() | 1854 api.chromium_android.get_changed_lines_for_revision() |
1848 api.chromium_android.incremental_coverage_report() | 1855 api.chromium_android.incremental_coverage_report() |
1849 | 1856 |
1850 | 1857 |
1851 GOMA_TESTS = [ | 1858 GOMA_TESTS = [ |
1852 GTestTest('base_unittests'), | 1859 GTestTest('base_unittests'), |
1853 GTestTest('content_unittests'), | 1860 GTestTest('content_unittests'), |
1854 ] | 1861 ] |
OLD | NEW |