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 < 4) { | 4 if (arguments.length < 3) { |
5 print('usage: ' + | 5 print('usage: ' + |
6 arguments[0] + ' test_fixture path-to-testfile.js testfile.js'); | 6 arguments[0] + ' path-to-testfile.js testfile.js [output.cc]'); |
7 quit(); | 7 quit(); |
8 } | 8 } |
9 var test_fixture = arguments[1]; | 9 var js_file = arguments[1]; |
10 var js_file = arguments[2]; | 10 var js_file_base = arguments[2]; |
11 var js_file_base = 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)) { |
| 19 print(js_file + ' did not define test_fixture.'); |
| 20 quit(-1); |
| 21 } |
18 print('// GENERATED FILE'); | 22 print('// GENERATED FILE'); |
19 print('// ' + arguments.join(' ')); | 23 print('// ' + arguments.join(' ')); |
20 print('// PLEASE DO NOT HAND EDIT!'); | 24 print('// PLEASE DO NOT HAND EDIT!'); |
21 print(); | 25 print(); |
22 for (var func in this) { | 26 for (var func in this) { |
23 if (!prevfuncs[func] && this[func] instanceof Function) { | 27 if (!prevfuncs[func] && this[func] instanceof Function) { |
24 print('IN_PROC_BROWSER_TEST_F(' + test_fixture + ', ' + func + ') {'); | 28 print('IN_PROC_BROWSER_TEST_F(' + test_fixture + ', ' + func + ') {'); |
25 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + js_file_base + '")));'); | 29 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + js_file_base + '")));'); |
26 print(' ASSERT_TRUE(RunJavascriptTest("' + func + '"));'); | 30 print(' ASSERT_TRUE(RunJavascriptTest("' + func + '"));'); |
27 print('}'); | 31 print('}'); |
28 print(); | 32 print(); |
29 } | 33 } |
30 } | 34 } |
OLD | NEW |