Skip to content
Permalink
Browse files

[WebLayer] Add WebLayer shell run script

Now to run the WebLayer shell on Android all you have to do is:

  $ autoninja -C out/foo run_weblayer_shell
  $ out/foo/bin/run_weblayer_shell

Change-Id: Icc6e1d771a6e83387c4d7fec989ddbb043f4575c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787855
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693881}
  • Loading branch information
clarkduvall authored and Commit Bot committed Sep 5, 2019
1 parent e909d9b commit 96c642ca52e474ffc2c9a5e12c6c9cace4ae3039
Showing with 75 additions and 0 deletions.
  1. +15 −0 weblayer/shell/README.md
  2. +17 −0 weblayer/shell/android/BUILD.gn
  3. +43 −0 weblayer/tools/run_weblayer_shell.py
@@ -0,0 +1,15 @@
# WebLayer Shell

This directory contains a minimal shell that runs WebLayer.

To build and run on desktop:
```
autoninja -C out/Default weblayer_shell
out/Default/weblayer_shell
```

To build and run on Android:
```
autoninja -C out/Default run_weblayer_shell
out/Default/bin/run_weblayer_shell
```
@@ -107,3 +107,20 @@ android_apk("weblayer_support_apk") {
android_manifest_dep = ":weblayer_support_manifest"
shared_libraries = [ "//weblayer:libweblayer" ]
}

generate_wrapper("run_weblayer_shell") {
testonly = true
wrapper_script = "$root_out_dir/bin/run_weblayer_shell"
executable = "//weblayer/tools/run_weblayer_shell.py"
executable_args = [
"--shell-apk-path",
"@WrappedPath(apks/WebLayerShell.apk)",
"--support-apk-path",
"@WrappedPath(apks/WebLayerSupport.apk)",
]

deps = [
":weblayer_shell_apk",
":weblayer_support_apk",
]
}
@@ -0,0 +1,43 @@
#!/usr/bin/env python
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import argparse
import sys
import os

sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
'build', 'android'))
import devil_chromium
from devil.android import device_utils

def main():
parser = argparse.ArgumentParser()
parser.add_argument('--shell-apk-path', type=os.path.abspath, required=True,
help='Absolute path to the WebLayer shell APK to use.')
parser.add_argument('--support-apk-path', type=os.path.abspath, required=True,
help='Absolute path to the WebLayer support APK to use.')
parser.add_argument('-d', '--device', dest='devices', action='append',
default=[],
help='Target device for apk to install on. Enter multiple'
' times for multiple devices.')
args = parser.parse_args()

devil_chromium.Initialize()
devices = device_utils.DeviceUtils.HealthyDevices(device_arg=args.devices)

def install(device):
print 'Installing %s...' % args.shell_apk_path
device.Install(args.shell_apk_path, reinstall=True, allow_downgrade=True)
print 'Success'
print 'Installing %s...' % args.support_apk_path
device.Install(args.support_apk_path, reinstall=True, allow_downgrade=True)
print 'Success'

device.adb.Shell('monkey -p org.chromium.weblayer.shell 1')

device_utils.DeviceUtils.parallel(devices).pMap(install)

if __name__ == '__main__':
sys.exit(main())

0 comments on commit 96c642c

Please sign in to comment.
You can’t perform that action at this time.