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]'); |
7 quit(-1); | 7 quit(-1); |
8 } | 8 } |
9 var jsFile = arguments[1]; | 9 var jsFile = arguments[1]; |
10 var jsFileBase = arguments[2]; | 10 var jsFileBase = arguments[2]; |
(...skipping 26 matching lines...) Expand all Loading... |
37 var testPredicate = testShouldFail ? 'ASSERT_FALSE' : 'ASSERT_TRUE'; | 37 var testPredicate = testShouldFail ? 'ASSERT_FALSE' : 'ASSERT_TRUE'; |
38 | 38 |
39 if (typedefCppFixture && !(testFixture in typedeffedCppFixtures)) { | 39 if (typedefCppFixture && !(testFixture in typedeffedCppFixtures)) { |
40 print('typedef ' + typedefCppFixture + ' ' + testFixture + ';'); | 40 print('typedef ' + typedefCppFixture + ' ' + testFixture + ';'); |
41 typedeffedCppFixtures[testFixture] = typedefCppFixture; | 41 typedeffedCppFixtures[testFixture] = typedefCppFixture; |
42 } | 42 } |
43 | 43 |
44 print('IN_PROC_BROWSER_TEST_F(' + testFixture + ', ' + testFunction + ') {'); | 44 print('IN_PROC_BROWSER_TEST_F(' + testFixture + ', ' + testFunction + ') {'); |
45 if (testGenPreamble) | 45 if (testGenPreamble) |
46 testGenPreamble(testFixture, testFunction); | 46 testGenPreamble(testFixture, testFunction); |
47 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + jsFileBase + '")));'); | 47 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + |
| 48 jsFileBase.replace(/\\/g, '/') + '")));'); |
48 if (browsePreload) { | 49 if (browsePreload) { |
49 print(' BrowsePreload(GURL("' + browsePreload + '"), "' + testFixture + | 50 print(' BrowsePreload(GURL("' + browsePreload + '"), "' + testFixture + |
50 '", "' + testFunction + '");'); | 51 '", "' + testFunction + '");'); |
51 } | 52 } |
52 if (browsePrintPreload) { | 53 if (browsePrintPreload) { |
53 print(' BrowsePrintPreload(GURL(WebUITestDataPathToURL(\n' + | 54 print(' BrowsePrintPreload(GURL(WebUITestDataPathToURL(\n' + |
54 ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))),\n' + | 55 ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))),\n' + |
55 ' "' + testFixture + '", "' + testFunction + '");'); | 56 ' "' + testFixture + '", "' + testFunction + '");'); |
56 } | 57 } |
57 print(' ' + testPredicate + '(RunJavascriptTestF(' + isAsync + ', ' + | 58 print(' ' + testPredicate + '(RunJavascriptTestF(' + isAsync + ', ' + |
58 '"' + testFixture + '", ' + | 59 '"' + testFixture + '", ' + |
59 '"' + testFunction + '"));'); | 60 '"' + testFunction + '"));'); |
60 if (testGenPostamble) | 61 if (testGenPostamble) |
61 testGenPostamble(testFixture, testFunction); | 62 testGenPostamble(testFixture, testFunction); |
62 print('}'); | 63 print('}'); |
63 print(); | 64 print(); |
64 } | 65 } |
65 | 66 |
66 var js = read(jsFile); | 67 var js = read(jsFile); |
67 eval(js); | 68 eval(js); |
OLD | NEW |