OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 import sys | |
5 import os | |
6 import optparse | |
7 | |
8 from ui import spy_project | |
9 from tvcm import generate | |
10 | |
11 def Main(args): | |
12 parser = optparse.OptionParser() | |
13 parser.add_option('--output-file', '-o') | |
14 options,args = parser.parse_args(args) | |
15 | |
16 if options.output_file: | |
17 ofile = open(options.output_file, 'w') | |
18 else: | |
19 ofile = sys.stdout | |
20 GenerateHTML(ofile) | |
21 if ofile != sys.stdout: | |
22 ofile.close() | |
23 | |
24 def GenerateHTML(ofile): | |
25 project = spy_project.SpyProject() | |
26 load_sequence = project.CalcLoadSequenceForModuleNames( | |
27 ['ui.spy_shell']) | |
28 bootstrap_js = """ | |
29 | |
30 document.addEventListener('DOMContentLoaded', function() { | |
31 document.body.appendChild(new ui.SpyShell('ws://127.0.0.1:42424')); | |
32 | |
33 }); | |
34 """ | |
35 bootstrap_script = generate.ExtraScript(text_content=bootstrap_js) | |
36 generate.GenerateStandaloneHTMLToFile( | |
37 ofile, load_sequence, | |
38 title='Mojo spy', | |
viettrungluu
2014/05/12 19:07:33
nit: indentation
| |
39 extra_scripts=[bootstrap_script]) | |
OLD | NEW |