OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 if (arguments.length < 3) { | 4 if (arguments.length < 3) { |
5 print('usage: ' + | 5 print('usage: ' + |
6 arguments[0] + ' path-to-testfile.js testfile.js [output.cc]'); | 6 arguments[0] + ' path-to-testfile.js testfile.js [output.cc]'); |
David Tseng
2011/07/08 22:37:18
Nit: is this really the usage? How do I run this
| |
7 quit(); | 7 quit(); |
8 } | 8 } |
9 var js_file = arguments[1]; | 9 var js_file = arguments[1]; |
David Tseng
2011/07/08 22:37:18
Contradicts usage message above
path-to-testfile.j
Sheridan Rawlins
2011/07/14 23:32:31
Why? argv[0] is always the program name.
On 2011/
David Tseng
2011/07/18 16:41:37
It's not clear from the usage message what the par
Sheridan Rawlins
2011/07/18 17:44:03
As we discussed, I rolled this file back. I filed
| |
10 var js_file_base = arguments[2]; | 10 var js_file_base = arguments[2]; |
David Tseng
2011/07/08 22:37:18
This contradicts your usage message above:
path-to
Sheridan Rawlins
2011/07/14 23:32:31
Can you please describe the conflict?
On 2011/07/
| |
11 var outputfile = arguments[3]; | 11 var outputfile = arguments[3]; |
12 var prevfuncs = {}; | 12 var prevfuncs = {}; |
13 for (var func in this) { | 13 for (var func in this) { |
14 if (this[func] instanceof Function) | 14 if (this[func] instanceof Function) |
15 prevfuncs[func] = func; | 15 prevfuncs[func] = func; |
16 } | 16 } |
17 var js = load(js_file); | 17 var js = load(js_file); |
18 if (!('test_fixture' in this)) { | 18 if (!('test_fixture' in this)) { |
David Tseng
2011/07/08 22:37:18
is this a string? Should we check to make sure?
Sheridan Rawlins
2011/07/14 23:32:31
It should be a constructor. I suppose we could che
| |
19 print(js_file + ' did not define test_fixture.'); | 19 print(js_file + ' did not define test_fixture.'); |
20 quit(-1); | 20 quit(-1); |
21 } | 21 } |
22 if (!('test_assert' in this)) { | |
23 this['test_assert'] = 'ASSERT_TRUE'; | |
David Tseng
2011/07/08 22:37:18
Why don't we just make this a boolean and resolve
| |
24 } | |
22 print('// GENERATED FILE'); | 25 print('// GENERATED FILE'); |
23 print('// ' + arguments.join(' ')); | 26 print('// ' + arguments.join(' ')); |
24 print('// PLEASE DO NOT HAND EDIT!'); | 27 print('// PLEASE DO NOT HAND EDIT!'); |
25 print(); | 28 print(); |
26 for (var func in this) { | 29 for (var func in this) { |
27 if (!prevfuncs[func] && this[func] instanceof Function) { | 30 if (!prevfuncs[func] && this[func] instanceof Function) { |
28 print('IN_PROC_BROWSER_TEST_F(' + test_fixture + ', ' + func + ') {'); | 31 print('IN_PROC_BROWSER_TEST_F(' + test_fixture + ', ' + func + ') {'); |
29 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + js_file_base + '")));'); | 32 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + js_file_base + '")));'); |
David Tseng
2011/07/08 22:37:18
Doesn't this belong in SetUpTestFixture?
Sheridan Rawlins
2011/07/14 23:32:31
Yeah, this was overhauled in another patch.
On 20
| |
30 print(' ASSERT_TRUE(RunJavascriptTest("' + func + '"));'); | 33 print(' ' + test_assert + '(RunJavascriptTest("' + func + '"));'); |
31 print('}'); | 34 print('}'); |
32 print(); | 35 print(); |
33 } | 36 } |
34 } | 37 } |
OLD | NEW |