Commit fd9048cf authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

wpt: clean up run_android_wpt script

Chromedriver is responsible for writing the flags file, so
there is no need for run_android_wpt to do it.

BUG=1049426
TEST=none

Change-Id: Ib77b06756a9e6ea6c35995e4ea86a0476f9630bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2056754
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarAndrew Luo <aluo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741684}
parent 1e28a640
...@@ -47,7 +47,6 @@ import devil_chromium ...@@ -47,7 +47,6 @@ import devil_chromium
from devil import devil_env from devil import devil_env
from devil.android import apk_helper from devil.android import apk_helper
from devil.android import device_utils from devil.android import device_utils
from devil.android import flag_changer
from devil.android.tools import system_app from devil.android.tools import system_app
from devil.android.tools import webview_app from devil.android.tools import webview_app
...@@ -65,16 +64,8 @@ WEBLAYER_SUPPORT_PKG = 'org.chromium.weblayer.support' ...@@ -65,16 +64,8 @@ WEBLAYER_SUPPORT_PKG = 'org.chromium.weblayer.support'
HOST_RESOLVER_ARGS = ['--host-resolver-rules=MAP nonexistent.*.test ~NOTFOUND,' HOST_RESOLVER_ARGS = ['--host-resolver-rules=MAP nonexistent.*.test ~NOTFOUND,'
' MAP *.test 127.0.0.1'] ' MAP *.test 127.0.0.1']
# WebLayer has popup protection enabled by default that prevents # List of supported products.
# chromedriver from opening test windows. PRODUCTS = ['android_weblayer', 'android_webview', 'chrome_android']
DISABLE_POPUP_ARGS = ['--disable-popup-blocking']
# Browsers on debug and eng devices read command-line-flags from special files
# during startup.
FLAGS_FILE_MAP = {'android_weblayer': 'weblayer-command-line',
'android_webview': 'webview-command-line',
'chrome_android': 'chrome-command-line'}
class PassThroughArgs(argparse.Action): class PassThroughArgs(argparse.Action):
pass_through_args = [] pass_through_args = []
...@@ -162,6 +153,8 @@ class WPTAndroidAdapter(common.BaseIsolatedScriptArgsAdapter): ...@@ -162,6 +153,8 @@ class WPTAndroidAdapter(common.BaseIsolatedScriptArgsAdapter):
return rest_args return rest_args
def add_extra_arguments(self, parser): def add_extra_arguments(self, parser):
# TODO: |pass_through_args| are broke and need to be supplied by way of
# --binary-arg".
class BinaryPassThroughArgs(PassThroughArgs): class BinaryPassThroughArgs(PassThroughArgs):
pass_through_args = self.pass_through_binary_args pass_through_args = self.pass_through_binary_args
class WPTPassThroughArgs(PassThroughArgs): class WPTPassThroughArgs(PassThroughArgs):
...@@ -178,7 +171,7 @@ class WPTAndroidAdapter(common.BaseIsolatedScriptArgsAdapter): ...@@ -178,7 +171,7 @@ class WPTAndroidAdapter(common.BaseIsolatedScriptArgsAdapter):
parser.add_argument('--test-type', default='testharness', parser.add_argument('--test-type', default='testharness',
help='Specify to experiment with other test types.' help='Specify to experiment with other test types.'
' Currently only the default is expected to work.') ' Currently only the default is expected to work.')
parser.add_argument('--product', choices = FLAGS_FILE_MAP.keys(), parser.add_argument('--product', choices=PRODUCTS,
required=True) required=True)
parser.add_argument('--apk', help='Apk to install during test. Defaults to' parser.add_argument('--apk', help='Apk to install during test. Defaults to'
' the on-device WebView provider or Chrome.') ' the on-device WebView provider or Chrome.')
...@@ -348,25 +341,17 @@ def main(): ...@@ -348,25 +341,17 @@ def main():
# sharding support via swarming infra. # sharding support via swarming infra.
device = device_utils.DeviceUtils.HealthyDevices()[0] device = device_utils.DeviceUtils.HealthyDevices()[0]
flags_file = FLAGS_FILE_MAP[adapter.options.product]
all_flags = HOST_RESOLVER_ARGS + adapter.pass_through_binary_args
if adapter.options.product == 'android_weblayer':
all_flags += DISABLE_POPUP_ARGS
logger.info('Setting flags in ' + flags_file + ' to: ' + str(all_flags))
flags = flag_changer.CustomCommandLineFlags(device, flags_file, all_flags)
# WPT setup for chrome and webview requires that PATH contains adb. # WPT setup for chrome and webview requires that PATH contains adb.
platform_tools_path = os.path.dirname(devil_env.config.FetchPath('adb')) platform_tools_path = os.path.dirname(devil_env.config.FetchPath('adb'))
os.environ['PATH'] = ':'.join([platform_tools_path] + os.environ['PATH'] = ':'.join([platform_tools_path] +
os.environ['PATH'].split(':')) os.environ['PATH'].split(':'))
with flags: if adapter.options.product == 'android_weblayer':
if adapter.options.product == 'android_weblayer': run_android_weblayer(device, adapter)
run_android_weblayer(device, adapter) elif adapter.options.product == 'android_webview':
elif adapter.options.product == 'android_webview': run_android_webview(device, adapter)
run_android_webview(device, adapter) elif adapter.options.product == 'chrome_android':
elif adapter.options.product == 'chrome_android': run_chrome_android(device, adapter)
run_chrome_android(device, adapter)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment