Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: mojo/spy/ui/spy_shell_to_html.py

Issue 278703002: Initial mojo spy skeleton based on tvcm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready to land Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698