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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/python
Paweł Hajdan Jr. 2011/06/10 07:38:29 Please make sure someone working more frequently w
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 prints out include dependencies in chrome. Since it ignores
7 # defines, it gives just a rough estimation of file size.
8 #
9 # Usage:
10 # python tools/gypv8sh.py chrome/browser/ui/webui/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 import json
15 import sys
16 import tempfile
17 import os
18 import subprocess
19 import getopt
20
21 rules = [
22 [
23 'WebUIBrowserTest',
24 'test/data/webui/sample_downloads.js',
25 'browser/ui/webui/web_ui_browsertest-inl.h',
26 ],
27 ]
28
29 opts, args = getopt.getopt(sys.argv[1:], 'tio', ['test_fixture', 'in','out']);
30 if len(opts):
31 indices = {}
32 for o, a in opts:
33 if o in ('-t','--test_fixture'):
34 indices[0] = 1;
35 elif o in ('-i', '--in'):
36 indices[1] = 1;
37 elif o in ('-o', '--out'):
38 indices[2] = 1;
39
40 for rule in rules:
41 for index in sorted(indices.keys()):
42 print rule[index],
43 print
44 else:
45 v8_shell = os.path.join(
46 os.path.dirname(os.path.dirname(sys.argv[0])),'out/Debug/v8_shell')
47 with tempfile.NamedTemporaryFile() as tmpfile:
48 jsfilename = args[0]
49 with open(jsfilename) as jsfile:
50 jsfile.readline()
51 for line in jsfile:
52 tmpfile.write(line)
53 tmpfile.flush()
54 for rule in rules:
55 arguments = [jsfilename]
56 arguments.extend(rule[:-1])
57 arguments = "arguments=" + json.dumps(arguments)
58 cmd = [v8_shell, '-e', arguments, tmpfile.name]
59 subprocess.check_call(cmd, stdout=open(rule[2],'w+'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698