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

Side by Side Diff: tools/gypv8sh.py

Issue 7189052: Revert 89605 - Support automatic javascript test registry in gtest when creating WebUI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/webui/sample_pass.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """This script is used by chrome_tests.gypi's js2webui action to maintain the
7 argument lists and to generate inlinable tests.
8
9 Usage:
10 python tools/gypv8sh.py -p product_dir path/to/javascript2webui.js
11 python tools/gypv8sh.py -t # print test_harnesses
12 python tools/gypv8sh.py -i # print inputs
13 python tools/gypv8sh.py -o # print outputs
14 """
15
16 try:
17 import json
18 except ImportError:
19 import simplejson as json
20 import optparse
21 import os
22 import subprocess
23 import sys
24
25 # Please adjust the following to edit or add new javascript webui tests.
26 rules = [
27 [
28 'WebUIBrowserTestPass',
29 'test/data/webui/sample_pass.js',
30 'browser/ui/webui/web_ui_browsertest-inl.h',
31 ],
32 ]
33
34 def main ():
35 """Run the program"""
36 # For options -t, -i, & -o, we print the "column" of the |rules|. We keep a
37 # set of indices to print in |print_rule_indices| and print them in sorted
38 # order if non-empty.
39 parser = optparse.OptionParser()
40 parser.set_usage(
41 "%prog [-v][-n] --product_dir PRODUCT_DIR -or- "
42 "%prog [-v][-n] (-i|-t|-o)")
43 parser.add_option('-v', '--verbose', action='store_true')
44 parser.add_option('-n', '--impotent', action='store_true',
45 help="don't execute; just print (as if verbose)")
46 parser.add_option(
47 '-p', '--product_dir',
48 help='for gyp to set the <(PRODUCT_DIR) for running v8_shell')
49 parser.add_option('-t', '--test_fixture', action='store_const', const=0,
50 dest='print_rule_index', help='print test_fixtures')
51 parser.add_option('-i', '--in', action='store_const', const=1,
52 dest='print_rule_index', help='print inputs')
53 parser.add_option('-o', '--out', action='store_const', const=2,
54 dest='print_rule_index', help='print outputs')
55 (opts, args) = parser.parse_args()
56
57 if (opts.print_rule_index != None):
58 for rule in rules:
59 print rule[opts.print_rule_index]
60 else:
61 if not opts.product_dir:
62 parser.error("--product_dir option is required")
63 v8_shell = os.path.join(opts.product_dir, 'v8_shell')
64 jsfilename = args[0]
65 for rule in rules:
66 arguments = [jsfilename, rule[0], rule[1], os.path.basename(rule[1])]
67 cmd = [v8_shell, '-e', "arguments=" + json.dumps(arguments), jsfilename]
68 if opts.verbose or opts.impotent:
69 print cmd
70 if not opts.impotent:
71 sys.exit(subprocess.call(cmd, stdout=open(rule[2],'w+')))
72
73 if __name__ == '__main__':
74 sys.exit(main())
OLDNEW
« 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