diff options
author | xhwang <xhwang@chromium.org> | 2015-03-09 15:04:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-09 22:04:53 +0000 |
commit | 837e35e1ecd8c4ab62a7011471d56c7b9283fb4d (patch) | |
tree | 9c1dd36382dcbab62cd0cf5a9d5c216639e47965 /media/mojo/scripts | |
parent | df1ded81c2c995505495bed90b3cd95cf027edae (diff) | |
download | chromium_src-837e35e1ecd8c4ab62a7011471d56c7b9283fb4d.zip chromium_src-837e35e1ecd8c4ab62a7011471d56c7b9283fb4d.tar.gz chromium_src-837e35e1ecd8c4ab62a7011471d56c7b9283fb4d.tar.bz2 |
Add script to run/test the mojo media renderer.
The script follows mojo/services/html_viewer/view_url.py. See the script for
how to use it.
BUG=410451
TEST=Run the script to test.
Review URL: https://codereview.chromium.org/991963003
Cr-Commit-Position: refs/heads/master@{#319741}
Diffstat (limited to 'media/mojo/scripts')
-rwxr-xr-x | media/mojo/scripts/run_mojo_media_renderer.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/media/mojo/scripts/run_mojo_media_renderer.py b/media/mojo/scripts/run_mojo_media_renderer.py new file mode 100755 index 0000000..738fa9d --- /dev/null +++ b/media/mojo/scripts/run_mojo_media_renderer.py @@ -0,0 +1,72 @@ +#!/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. +# +# The script follows mojo/services/html_viewer/view_url.py and modified it for +# test the mojo media renderer. The page will be rendered in a windowless mode. +# +# TODO(xhwang): Explore the possibility of running this with the Kiosk window +# manager. + +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," + "mojo:media=file://%s/media.mojo" % (build_dir, build_dir)) + args_for_html_viewer = "--enable-mojo-media-renderer " + if args.verbose: + args_for_html_viewer += \ + "--vmodule=pipeline*=3,*renderer_impl*=3,*mojo_demuxer*=3" + options.append("--args-for=mojo:html_viewer %s" % args_for_html_viewer) + + full_command = shell_command + options + [args.url] + + if args.verbose: + print full_command + + return full_command + +def main(): + parser = argparse.ArgumentParser( + description="View a URL with HTMLViewer with mojo media renderer. " + "You must have built //mojo/services/html_viewer, " + "//mojo/services/network and //media/mojo/services 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("--verbose", help="Increase output verbosity.", + action="store_true") + 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()) |