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.
6 # The script follows mojo/services/html_viewer/view_url.py and modified it for
7 # test the mojo media renderer. The page will be rendered in a windowless mode.
9 # TODO(xhwang): Explore the possibility of running this with the Kiosk window
17 root_path
= os
.path
.realpath(
20 os
.path
.realpath(__file__
)),
25 def _BuildShellCommand(args
):
26 sdk_version
= subprocess
.check_output(["cat",
27 "third_party/mojo/src/mojo/public/VERSION"], cwd
=root_path
)
28 build_dir
= os
.path
.join(root_path
, args
.build_dir
)
30 shell_command
= [os
.path
.join(build_dir
, "mojo_shell")]
34 "--origin=https://storage.googleapis.com/mojo/services/linux-x64/%s" %
36 options
.append("--url-mappings=mojo:html_viewer=file://%s/html_viewer.mojo,"
37 "mojo:media=file://%s/media.mojo" % (build_dir
, build_dir
))
38 args_for_html_viewer
= "--enable-mojo-media-renderer "
40 args_for_html_viewer
+= \
41 "--vmodule=pipeline*=3,*renderer_impl*=3,*mojo_demuxer*=3"
42 options
.append("--args-for=mojo:html_viewer %s" % args_for_html_viewer
)
44 full_command
= shell_command
+ options
+ [args
.url
]
52 parser
= argparse
.ArgumentParser(
53 description
="View a URL with HTMLViewer with mojo media renderer. "
54 "You must have built //mojo/services/html_viewer, "
55 "//mojo/services/network and //media/mojo/services first. "
56 " Note that this will currently often fail spectacularly due "
57 " to lack of binary stability in Mojo.")
60 help="Path to the dir containing the linux-x64 binaries relative to the "
61 "repo root (default: %(default)s)",
62 default
="out/Release")
63 parser
.add_argument("--verbose", help="Increase output verbosity.",
65 parser
.add_argument("url",
66 help="The URL to be viewed")
68 args
= parser
.parse_args()
69 return subprocess
.call(_BuildShellCommand(args
))
71 if __name__
== '__main__':