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

Unified Diff: tools/gypv8sh.py

Issue 7087014: Support automatic javascript test registry in gtest when creating WebUI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: undid sorting of .gitignore Created 9 years, 6 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: tools/gypv8sh.py
diff --git a/tools/gypv8sh.py b/tools/gypv8sh.py
new file mode 100755
index 0000000000000000000000000000000000000000..755ea9b374080f61cd3f0593584d1f086e1e2731
--- /dev/null
+++ b/tools/gypv8sh.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
Paweł Hajdan Jr. 2011/06/10 07:38:29 Please make sure someone working more frequently w
+# Copyright (c) 2011 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.
+#
+# This script prints out include dependencies in chrome. Since it ignores
+# defines, it gives just a rough estimation of file size.
+#
+# Usage:
+# python tools/gypv8sh.py chrome/browser/ui/webui/javascript2webui.js
+# python tools/gypv8sh.py -t # print test_harnesses
+# python tools/gypv8sh.py -i # print inputs
+# python tools/gypv8sh.py -o # print outputs
+import json
+import sys
+import tempfile
+import os
+import subprocess
+import getopt
+
+rules = [
+ [
+ 'WebUIBrowserTest',
+ 'test/data/webui/sample_downloads.js',
+ 'browser/ui/webui/web_ui_browsertest-inl.h',
+ ],
+ ]
+
+opts, args = getopt.getopt(sys.argv[1:], 'tio', ['test_fixture', 'in','out']);
+if len(opts):
+ indices = {}
+ for o, a in opts:
+ if o in ('-t','--test_fixture'):
+ indices[0] = 1;
+ elif o in ('-i', '--in'):
+ indices[1] = 1;
+ elif o in ('-o', '--out'):
+ indices[2] = 1;
+
+ for rule in rules:
+ for index in sorted(indices.keys()):
+ print rule[index],
+ print
+else:
+ v8_shell = os.path.join(
+ os.path.dirname(os.path.dirname(sys.argv[0])),'out/Debug/v8_shell')
+ with tempfile.NamedTemporaryFile() as tmpfile:
+ jsfilename = args[0]
+ with open(jsfilename) as jsfile:
+ jsfile.readline()
+ for line in jsfile:
+ tmpfile.write(line)
+ tmpfile.flush()
+ for rule in rules:
+ arguments = [jsfilename]
+ arguments.extend(rule[:-1])
+ arguments = "arguments=" + json.dumps(arguments)
+ cmd = [v8_shell, '-e', arguments, tmpfile.name]
+ subprocess.check_call(cmd, stdout=open(rule[2],'w+'))

Powered by Google App Engine
This is Rietveld 408576698