OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import argparse | |
7 import os | |
8 import subprocess | |
9 import sys | |
10 | |
11 root_path = os.path.realpath( | |
12 os.path.join( | |
13 os.path.dirname( | |
14 os.path.realpath(__file__)), | |
15 os.pardir, | |
16 os.pardir, | |
17 os.pardir)) | |
18 | |
19 def _BuildShellCommand(args): | |
20 sdk_version = subprocess.check_output(["cat", | |
21 "third_party/mojo/src/mojo/public/VERSION"], cwd=root_path) | |
22 build_dir = os.path.join(root_path, args.build_dir) | |
23 | |
24 shell_command = [os.path.join(build_dir, "mojo_shell")] | |
25 | |
26 options = [] | |
27 options.append( | |
28 "--origin=https://storage.googleapis.com/mojo/services/linux-x64/%s" % | |
29 sdk_version) | |
30 options.append("--url-mappings=mojo:html_viewer=file://%s/html_viewer.mojo" % | |
31 build_dir) | |
32 options.append('--args-for=mojo:kiosk_wm %s' % args.url) | |
33 | |
34 app_to_run = "mojo:kiosk_wm" | |
35 | |
36 return shell_command + options + [app_to_run] | |
37 | |
38 def main(): | |
39 parser = argparse.ArgumentParser( | |
40 description="View a URL with HTMLViewer in the Kiosk window manager. " | |
41 "You must have built //mojo/services/html_viewer and " | |
42 "//mojo/services/network first. Note that this will " | |
43 "currently often fail spectacularly due to lack of binary " | |
44 "stability in Mojo.") | |
45 parser.add_argument( | |
46 "--build-dir", | |
47 help="Path to the dir containing the linux-x64 binaries relative to the " | |
48 "repo root (default: %(default)s)", | |
49 default="out/Release") | |
50 parser.add_argument("url", | |
51 help="The URL to be viewed") | |
52 | |
53 args = parser.parse_args() | |
54 return subprocess.call(_BuildShellCommand(args)) | |
55 | |
56 if __name__ == '__main__': | |
57 sys.exit(main()) | |
OLD | NEW |