Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 from mopy.config import Config | 6 from mopy.config import Config |
| 7 import argparse | 7 import argparse |
| 8 import mopy.paths | 8 import mopy.paths |
| 9 import os | 9 import os |
| 10 import pipes | 10 import pipes |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 cmd = [mojo_shell] | 34 cmd = [mojo_shell] |
| 35 cmd.append('--v=1') | 35 cmd.append('--v=1') |
| 36 | 36 |
| 37 HTTP_PORT = 9999 | 37 HTTP_PORT = 9999 |
| 38 sky_paths = skypy.paths.Paths(paths.build_dir) | 38 sky_paths = skypy.paths.Paths(paths.build_dir) |
| 39 configuration = 'Debug' if config.is_debug else 'Release' | 39 configuration = 'Debug' if config.is_debug else 'Release' |
| 40 server = SkyServer(sky_paths, HTTP_PORT, configuration, paths.src_root) | 40 server = SkyServer(sky_paths, HTTP_PORT, configuration, paths.src_root) |
| 41 | 41 |
| 42 if args.demo == 'browser': | 42 if args.demo == 'browser': |
| 43 base_url = server.path_as_url(paths.build_dir) | |
| 44 wm_url = os.path.join(base_url, 'example_window_manager.mojo') | |
| 43 cmd.append('--url-mappings=mojo:window_manager=mojo:example_window_manager') | 45 cmd.append('--url-mappings=mojo:window_manager=mojo:example_window_manager') |
|
eseidel
2015/01/07 20:19:14
You'll want to load the window manager from an htt
| |
| 46 cmd.append('--args-for=mojo:window_manager %s' % (wm_url)) | |
| 44 cmd.append('mojo:window_manager') | 47 cmd.append('mojo:window_manager') |
| 45 elif args.demo == 'wm_flow': | 48 elif args.demo == 'wm_flow': |
| 46 base_url = server.path_as_url(paths.build_dir) | 49 base_url = server.path_as_url(paths.build_dir) |
| 47 wm_url = os.path.join(base_url, 'wm_flow_wm.mojo') | 50 wm_url = os.path.join(base_url, 'wm_flow_wm.mojo') |
| 48 app_url = os.path.join(base_url, 'wm_flow_app.mojo') | 51 app_url = os.path.join(base_url, 'wm_flow_app.mojo') |
| 49 cmd.append('--url-mappings=mojo:window_manager=' + wm_url) | 52 cmd.append('--url-mappings=mojo:window_manager=' + wm_url) |
| 50 # Mojo apps don't know their own URL yet: | 53 # Mojo apps don't know their own URL yet: |
| 51 # https://docs.google.com/a/chromium.org/document/d/1AQ2y6ekzvbdaMF5WrUQmney XJnke-MnYYL4Gz1AKDos | 54 # https://docs.google.com/a/chromium.org/document/d/1AQ2y6ekzvbdaMF5WrUQmney XJnke-MnYYL4Gz1AKDos |
| 52 cmd.append('--args-for=%s %s' % (app_url, app_url)) | 55 cmd.append('--args-for=%s %s' % (app_url, app_url)) |
| 53 cmd.append('--args-for=mojo:window_manager %s' % (wm_url)) | 56 cmd.append('--args-for=mojo:window_manager %s' % (wm_url)) |
| 54 cmd.append(app_url) | 57 cmd.append(app_url) |
| 55 else: | 58 else: |
| 56 parser.print_usage() | 59 parser.print_usage() |
| 57 print "--browser or --wm_flow is required" | 60 print "--browser or --wm_flow is required" |
| 58 return 1 | 61 return 1 |
| 59 | 62 |
| 60 # http://stackoverflow.com/questions/4748344/whats-the-reverse-of-shlex-split | 63 # http://stackoverflow.com/questions/4748344/whats-the-reverse-of-shlex-split |
| 61 # shlex.quote doesn't exist until 3.3 | 64 # shlex.quote doesn't exist until 3.3 |
| 62 # This doesn't print exactly what we want, but it's better than nothing: | 65 # This doesn't print exactly what we want, but it's better than nothing: |
| 63 print " ".join(map(pipes.quote, cmd)) | 66 print " ".join(map(pipes.quote, cmd)) |
| 64 with server: | 67 with server: |
| 65 return subprocess.call(cmd) | 68 return subprocess.call(cmd) |
| 66 | 69 |
| 67 if __name__ == '__main__': | 70 if __name__ == '__main__': |
| 68 sys.exit(main()) | 71 sys.exit(main()) |
| OLD | NEW |