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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/spy/ui/spy_shell_to_html.py
diff --git a/mojo/spy/ui/spy_shell_to_html.py b/mojo/spy/ui/spy_shell_to_html.py
new file mode 100644
index 0000000000000000000000000000000000000000..82485f72ba819cb2be95e82603b415e6c1815060
--- /dev/null
+++ b/mojo/spy/ui/spy_shell_to_html.py
@@ -0,0 +1,39 @@
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import sys
+import os
+import optparse
+
+from ui import spy_project
+from tvcm import generate
+
+def Main(args):
+ parser = optparse.OptionParser()
+ parser.add_option('--output-file', '-o')
+ options,args = parser.parse_args(args)
+
+ if options.output_file:
+ ofile = open(options.output_file, 'w')
+ else:
+ ofile = sys.stdout
+ GenerateHTML(ofile)
+ if ofile != sys.stdout:
+ ofile.close()
+
+def GenerateHTML(ofile):
+ project = spy_project.SpyProject()
+ load_sequence = project.CalcLoadSequenceForModuleNames(
+ ['ui.spy_shell'])
+ bootstrap_js = """
+
+ document.addEventListener('DOMContentLoaded', function() {
+ document.body.appendChild(new ui.SpyShell('ws://127.0.0.1:42424'));
+
+ });
+"""
+ bootstrap_script = generate.ExtraScript(text_content=bootstrap_js)
+ generate.GenerateStandaloneHTMLToFile(
+ ofile, load_sequence,
+ title='Mojo spy',
viettrungluu 2014/05/12 19:07:33 nit: indentation
+ extra_scripts=[bootstrap_script])

Powered by Google App Engine
This is Rietveld 408576698