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

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: fixing FAILS_ test. 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
« no previous file with comments | « chrome/test/data/webui/sample_pass.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gypv8sh.py
diff --git a/tools/gypv8sh.py b/tools/gypv8sh.py
new file mode 100755
index 0000000000000000000000000000000000000000..a7d803feaf0e74a36793ff23f1d2bfe4935dda43
--- /dev/null
+++ b/tools/gypv8sh.py
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+# 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 is used by chrome_tests.gypi's js2webui action to maintain the
+# argument lists and to generate inlinable tests.
+#
+# Usage:
+# python tools/gypv8sh.py -p product_dir path/to/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 os
+import subprocess
+import getopt
nsylvain 2011/06/12 21:13:19 sort the imports
Sheridan Rawlins 2011/06/13 15:40:44 Done.
+
+# Please adjust the following to edit or add new javascript webui tests.
+rules = [
+ [
+ 'WebUIBrowserTestPass',
+ 'test/data/webui/sample_pass.js',
+ 'browser/ui/webui/web_ui_browsertest-inl.h',
+ ],
+ ]
+
+opts, args = getopt.getopt(
+ sys.argv[1:], 'vntiop:', ['test_fixture', 'in', 'out', 'product_dir=']);
+
+indices = set()
+product_dir = ''
+verbose = 0
+impotent = 0
+if len(opts):
+ for o, a in opts:
+ if o in ('-t','--test_fixture'):
+ indices.add(0)
+ elif o in ('-i', '--in'):
+ indices.add(1)
+ elif o in ('-o', '--out'):
+ indices.add(2)
+ elif o in ('-p', '--product_dir'):
+ product_dir = a
+ elif o in ('-v', '--verbose'):
+ verbose = 1
+ elif o in ('-n', '--impotent'):
+ impotent = 1
+
+if len(indices):
+ for rule in rules:
+ for index in sorted(indices):
+ print rule[index],
+ print
+else:
+ if not len(product_dir):
+ product_dir = os.path.dirname(os.path.dirname(sys.argv[0]))
+ product_dir = os.path.join(product_dir, 'out','Debug')
+ v8_shell = os.path.join(product_dir, 'v8_shell')
+ jsfilename = args[0]
+ for rule in rules:
+ arguments = [jsfilename, rule[0], rule[1], os.path.basename(rule[1])]
+ arguments = "arguments=" + json.dumps(arguments)
+ cmd = [v8_shell, '-e', arguments, jsfilename]
+ if verbose or impotent:
+ print cmd
+ if not impotent:
+ subprocess.call(cmd, stdout=open(rule[2],'w+'))
nsylvain 2011/06/12 21:13:19 I guess you should sys.exit(x) the return value of
Sheridan Rawlins 2011/06/13 15:40:44 Done.
« no previous file with comments | « chrome/test/data/webui/sample_pass.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698