| OLD | NEW | 
|   1 #!/usr/bin/env python |   1 #!/usr/bin/env python | 
|   2 # Copyright 2015 The Chromium Authors. All rights reserved. |   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 |   3 # Use of this source code is governed by a BSD-style license that can be | 
|   4 # found in the LICENSE file. |   4 # found in the LICENSE file. | 
|   5 # |   5 # | 
|   6 # The script follows mojo/services/html_viewer/view_url.py and modified it for |   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. |   7 # test the mojo media renderer. The page will be rendered in a headless mode. | 
|   8 # |   8 # | 
|   9 # TODO(xhwang): Explore the possibility of running this with the Kiosk window |   9 # TODO(xhwang): Explore the possibility of running this with the Kiosk window | 
|  10 # manager. |  10 # manager. See http://crbug.com/467176 | 
|  11  |  11  | 
|  12 import argparse |  12 import argparse | 
|  13 import os |  13 import os | 
|  14 import subprocess |  14 import subprocess | 
|  15 import sys |  15 import sys | 
|  16  |  16  | 
|  17 root_path = os.path.realpath( |  17 root_path = os.path.realpath( | 
|  18     os.path.join( |  18     os.path.join( | 
|  19         os.path.dirname( |  19         os.path.dirname( | 
|  20             os.path.realpath(__file__)), |  20             os.path.realpath(__file__)), | 
|  21         os.pardir, |  21         os.pardir, | 
|  22         os.pardir, |  22         os.pardir, | 
|  23         os.pardir)) |  23         os.pardir)) | 
|  24  |  24  | 
|  25 def _BuildShellCommand(args): |  25 def _BuildShellCommand(args): | 
|  26   sdk_version = subprocess.check_output(["cat", |  26   sdk_version = subprocess.check_output(["cat", | 
|  27       "third_party/mojo/src/mojo/public/VERSION"], cwd=root_path) |  27       "third_party/mojo/src/mojo/public/VERSION"], cwd=root_path) | 
|  28   build_dir = os.path.join(root_path, args.build_dir) |  28   build_dir = os.path.join(root_path, args.build_dir) | 
|  29  |  29  | 
|  30   shell_command = [os.path.join(build_dir, "mojo_shell")] |  30   shell_command = [os.path.join(build_dir, "mojo_shell")] | 
|  31  |  31  | 
|  32   options = [] |  32   options = [] | 
|  33   options.append( |  33   options.append( | 
|  34       "--origin=https://storage.googleapis.com/mojo/services/linux-x64/%s" % |  34       "--origin=https://storage.googleapis.com/mojo/services/linux-x64/%s" % | 
|  35            sdk_version) |  35            sdk_version) | 
|  36   options.append("--url-mappings=mojo:html_viewer=file://%s/html_viewer.mojo," |  36   options.append("--url-mappings=mojo:html_viewer=file://%s/html_viewer.mojo," | 
|  37                  "mojo:media=file://%s/media.mojo" % (build_dir, build_dir)) |  37                  "mojo:media=file://%s/media.mojo" % (build_dir, build_dir)) | 
|  38   args_for_html_viewer = "--enable-mojo-media-renderer " |  38   args_for_html_viewer = "--enable-mojo-media-renderer --is-headless " | 
|  39   if args.verbose: |  39   if args.verbose: | 
|  40     args_for_html_viewer += \ |  40     args_for_html_viewer += \ | 
|  41         "--vmodule=pipeline*=3,*renderer_impl*=3,*mojo_demuxer*=3" |  41         "--vmodule=pipeline*=3,*renderer_impl*=3,*mojo_demuxer*=3" | 
|  42   options.append("--args-for=mojo:html_viewer %s" % args_for_html_viewer) |  42   options.append("--args-for=mojo:html_viewer %s" % args_for_html_viewer) | 
|  43  |  43  | 
|  44   full_command = shell_command + options + [args.url] |  44   full_command = shell_command + options + [args.url] | 
|  45  |  45  | 
|  46   if args.verbose: |  46   if args.verbose: | 
|  47     print full_command |  47     print full_command | 
|  48  |  48  | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|  63   parser.add_argument("--verbose", help="Increase output verbosity.", |  63   parser.add_argument("--verbose", help="Increase output verbosity.", | 
|  64                       action="store_true") |  64                       action="store_true") | 
|  65   parser.add_argument("url", |  65   parser.add_argument("url", | 
|  66                       help="The URL to be viewed") |  66                       help="The URL to be viewed") | 
|  67  |  67  | 
|  68   args = parser.parse_args() |  68   args = parser.parse_args() | 
|  69   return subprocess.call(_BuildShellCommand(args)) |  69   return subprocess.call(_BuildShellCommand(args)) | 
|  70  |  70  | 
|  71 if __name__ == '__main__': |  71 if __name__ == '__main__': | 
|  72   sys.exit(main()) |  72   sys.exit(main()) | 
| OLD | NEW |