| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """ | 5 """ |
| 6 Recipe for testing with the AndroidWebViewShell using system WebView. | 6 Recipe for running AndroidWebViewShell instrumentation layout tests using |
| 7 system WebView. |
| 7 """ | 8 """ |
| 8 | 9 |
| 9 from infra.libs.infra_types import freeze | 10 from infra.libs.infra_types import freeze |
| 10 | 11 |
| 11 DEPS = [ | 12 DEPS = [ |
| 12 'adb', | 13 'adb', |
| 13 'bot_update', | 14 'bot_update', |
| 14 'chromium', | 15 'chromium', |
| 15 'chromium_android', | 16 'chromium_android', |
| 16 'gclient', | 17 'gclient', |
| 17 'json', | 18 'json', |
| 18 'path', | 19 'path', |
| 19 'properties', | 20 'properties', |
| 20 'python', | 21 'python', |
| 21 'step', | 22 'step', |
| 22 ] | 23 ] |
| 23 | 24 |
| 24 REPO_URL = 'https://chromium.googlesource.com/chromium/src.git' | 25 REPO_URL = 'https://chromium.googlesource.com/chromium/src.git' |
| 25 | 26 |
| 26 WEBVIEW_APK = 'SystemWebView.apk' | 27 WEBVIEW_APK = 'SystemWebView.apk' |
| 27 WEBVIEW_PACKAGE = 'com.android.webview' | 28 WEBVIEW_PACKAGE = 'com.android.webview' |
| 28 | 29 |
| 29 WEBVIEW_SHELL_APK = 'AndroidWebViewShell.apk' | 30 WEBVIEW_SHELL_APK = 'AndroidWebViewShell.apk' |
| 30 WEBVIEW_SHELL_PACKAGE = 'org.chromium.webview_shell' | 31 WEBVIEW_SHELL_PACKAGE = 'org.chromium.webview_shell' |
| 31 | 32 |
| 33 INSTRUMENTATION_TESTS = freeze([ |
| 34 { |
| 35 'test': 'AndroidWebViewShell', |
| 36 'gyp_target': 'android_webview_shell_apk', |
| 37 'kwargs': { |
| 38 'install_apk': { |
| 39 'package': 'org.chromium.webview_shell', |
| 40 'apk': 'AndroidWebViewShell.apk' |
| 41 }, |
| 42 'isolate_file_path': |
| 43 'android_webview/android_webview_shell_test_apk.isolate', |
| 44 }, |
| 45 }, |
| 46 ]) |
| 47 |
| 48 |
| 32 def RunSteps(api): | 49 def RunSteps(api): |
| 33 api.chromium_android.configure_from_properties('webview_perf', | 50 api.chromium_android.configure_from_properties('webview_perf', |
| 34 REPO_NAME='src', | 51 REPO_NAME='src', |
| 35 REPO_URL=REPO_URL, | 52 REPO_URL=REPO_URL, |
| 36 INTERNAL=False, | 53 INTERNAL=False, |
| 37 BUILD_CONFIG='Release') | 54 BUILD_CONFIG='Release') |
| 38 | 55 |
| 39 # Sync code. | 56 # Sync code. |
| 40 api.gclient.set_config('perf') | 57 api.gclient.set_config('perf') |
| 41 api.gclient.apply_config('android') | 58 api.gclient.apply_config('android') |
| 42 api.bot_update.ensure_checkout(force=True) | 59 api.bot_update.ensure_checkout(force=True) |
| 43 api.chromium_android.clean_local_files() | 60 api.chromium_android.clean_local_files() |
| 44 | 61 |
| 45 # Gyp the chromium checkout. | 62 # Gyp the chromium checkout. |
| 46 api.chromium.runhooks() | 63 api.chromium.runhooks() |
| 47 | 64 |
| 48 # Build the WebView apk, WebView shell and Android testing tools. | 65 # Build the WebView apk, WebView shell and Android testing tools. |
| 49 api.chromium.compile(targets=['system_webview_apk', | 66 api.chromium.compile(targets=['system_webview_apk', |
| 50 'android_webview_shell_apk', | 67 'android_webview_shell_apk', |
| 51 'android_tools']) | 68 'android_tools']) |
| 52 | 69 |
| 53 api.chromium_android.spawn_logcat_monitor() | 70 api.chromium_android.spawn_logcat_monitor() |
| 54 api.chromium_android.device_status_check() | 71 api.chromium_android.device_status_check() |
| 55 api.chromium_android.provision_devices( | 72 api.chromium_android.provision_devices( |
| 56 min_battery_level=95, disable_network=True, disable_java_debug=True, | 73 min_battery_level=95, disable_network=True, disable_java_debug=True, |
| 57 reboot_timeout=180) | 74 reboot_timeout=180) |
| 58 | 75 |
| 59 # Install WebView | 76 # Install system WebView. |
| 60 api.chromium_android.adb_install_apk(WEBVIEW_APK, WEBVIEW_PACKAGE) | 77 api.chromium_android.adb_install_apk(WEBVIEW_APK, WEBVIEW_PACKAGE) |
| 61 | 78 |
| 62 # Install the telemetry shell. | 79 # Install the WebViewShell. |
| 63 api.chromium_android.adb_install_apk(WEBVIEW_SHELL_APK, | 80 api.chromium_android.adb_install_apk(WEBVIEW_SHELL_APK, WEBVIEW_SHELL_PACKAGE) |
| 64 WEBVIEW_SHELL_PACKAGE) | |
| 65 | 81 |
| 66 # TODO: Run the tests here. | |
| 67 api.adb.list_devices() | 82 api.adb.list_devices() |
| 68 | 83 |
| 84 # Run the instrumentation tests from the package. |
| 85 run_tests(api) |
| 86 |
| 69 api.chromium_android.logcat_dump() | 87 api.chromium_android.logcat_dump() |
| 70 api.chromium_android.stack_tool_steps() | 88 api.chromium_android.stack_tool_steps() |
| 71 api.chromium_android.test_report() | 89 api.chromium_android.test_report() |
| 72 | 90 |
| 91 def run_tests(api): |
| 92 droid = api.chromium_android |
| 93 for suite in INSTRUMENTATION_TESTS: |
| 94 droid.run_instrumentation_suite(suite['test'], verbose=True, |
| 95 **suite.get('kwargs', {})) |
| 96 |
| 73 def GenTests(api): | 97 def GenTests(api): |
| 74 yield api.test('basic') + api.properties.scheduled() | 98 yield api.test('basic') + api.properties.scheduled() |
| OLD | NEW |