Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: mojo/services/html_viewer/view_url.py

Issue 982523004: Add script to view URL in HTMLViewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded imports Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/html_viewer/view_url.py
diff --git a/mojo/services/html_viewer/view_url.py b/mojo/services/html_viewer/view_url.py
new file mode 100755
index 0000000000000000000000000000000000000000..a543385e5aea4c59531f350d30699165e9de9f68
--- /dev/null
+++ b/mojo/services/html_viewer/view_url.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# Copyright 2015 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 os
+import subprocess
+import sys
+
+root_path = os.path.realpath(
+ os.path.join(
+ os.path.dirname(
+ os.path.realpath(__file__)),
+ os.pardir,
+ os.pardir,
+ os.pardir))
+
+def _BuildShellCommand(args):
+ sdk_version = subprocess.check_output(["cat",
+ "third_party/mojo/src/mojo/public/VERSION"], cwd=root_path)
+ build_dir = os.path.join(root_path, args.build_dir)
+
+ shell_command = [os.path.join(build_dir, "mojo_shell")]
+
+ options = []
+ options.append(
+ "--origin=https://storage.googleapis.com/mojo/services/linux-x64/%s" %
+ sdk_version)
+ options.append("--url-mappings=mojo:html_viewer=file://%s/html_viewer.mojo" %
+ build_dir)
+ options.append('--args-for=mojo:kiosk_wm %s' % args.url)
+
+ app_to_run = "mojo:kiosk_wm"
+
+ return shell_command + options + [app_to_run]
+
+def main():
+ parser = argparse.ArgumentParser(
+ description="View a URL with HTMLViewer in the Kiosk window manager. "
+ "You must have built //mojo/services/html_viewer and "
+ "//mojo/services/network first. Note that this will "
+ "currently often fail spectacularly due to lack of binary "
+ "stability in Mojo.")
+ parser.add_argument(
+ "--build-dir",
+ help="Path to the dir containing the linux-x64 binaries relative to the "
+ "repo root (default: %(default)s)",
+ default="out/Release")
+ parser.add_argument("url",
+ help="The URL to be viewed")
+
+ args = parser.parse_args()
+ return subprocess.call(_BuildShellCommand(args))
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698