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 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 var typedeffedCppFixtures = {}; | 27 var typedeffedCppFixtures = {}; |
28 | 28 |
29 function TEST_F(testFixture, testFunction, testBody) { | 29 function TEST_F(testFixture, testFunction, testBody) { |
30 var browsePreload = this[testFixture].prototype.browsePreload; | 30 var browsePreload = this[testFixture].prototype.browsePreload; |
31 var browsePrintPreload = this[testFixture].prototype.browsePrintPreload; | 31 var browsePrintPreload = this[testFixture].prototype.browsePrintPreload; |
32 var testGenPreamble = this[testFixture].prototype.testGenPreamble; | 32 var testGenPreamble = this[testFixture].prototype.testGenPreamble; |
33 var testGenPostamble = this[testFixture].prototype.testGenPostamble; | 33 var testGenPostamble = this[testFixture].prototype.testGenPostamble; |
34 var typedefCppFixture = this[testFixture].prototype.typedefCppFixture; | 34 var typedefCppFixture = this[testFixture].prototype.typedefCppFixture; |
| 35 var isAsync = this[testFixture].prototype.isAsync; |
35 | 36 |
36 if (typedefCppFixture && !(testFixture in typedeffedCppFixtures)) { | 37 if (typedefCppFixture && !(testFixture in typedeffedCppFixtures)) { |
37 print('typedef ' + typedefCppFixture + ' ' + testFixture + ';'); | 38 print('typedef ' + typedefCppFixture + ' ' + testFixture + ';'); |
38 typedeffedCppFixtures[testFixture] = typedefCppFixture; | 39 typedeffedCppFixtures[testFixture] = typedefCppFixture; |
39 } | 40 } |
40 | 41 |
41 print('IN_PROC_BROWSER_TEST_F(' + testFixture + ', ' + testFunction + ') {'); | 42 print('IN_PROC_BROWSER_TEST_F(' + testFixture + ', ' + testFunction + ') {'); |
42 if (testGenPreamble) | 43 if (testGenPreamble) |
43 testGenPreamble(testFixture, testFunction); | 44 testGenPreamble(testFixture, testFunction); |
44 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + jsFileBase + '")));'); | 45 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + jsFileBase + '")));'); |
45 if (browsePreload) { | 46 if (browsePreload) { |
46 print(' BrowsePreload(GURL("' + browsePreload + '"), "' + testFixture + | 47 print(' BrowsePreload(GURL("' + browsePreload + '"), "' + testFixture + |
47 '", "' + testFunction + '");'); | 48 '", "' + testFunction + '");'); |
48 } | 49 } |
49 if (browsePrintPreload) { | 50 if (browsePrintPreload) { |
50 print(' BrowsePrintPreload(GURL(WebUITestDataPathToURL(\n' + | 51 print(' BrowsePrintPreload(GURL(WebUITestDataPathToURL(\n' + |
51 ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))),\n' + | 52 ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))),\n' + |
52 ' "' + testFixture + '", "' + testFunction + '");'); | 53 ' "' + testFixture + '", "' + testFunction + '");'); |
53 } | 54 } |
54 print(' ASSERT_TRUE(RunJavascriptTestF("' + testFixture + '", "' + | 55 print(' ASSERT_TRUE(RunJavascriptTestF(' + isAsync + ', ' + |
55 testFunction + '"));'); | 56 '"' + testFixture + '", ' + |
| 57 '"' + testFunction + '"));'); |
56 if (testGenPostamble) | 58 if (testGenPostamble) |
57 testGenPostamble(testFixture, testFunction); | 59 testGenPostamble(testFixture, testFunction); |
58 print('}'); | 60 print('}'); |
59 print(); | 61 print(); |
60 } | 62 } |
61 | 63 |
62 var js = read(jsFile); | 64 var js = read(jsFile); |
63 eval(js); | 65 eval(js); |
OLD | NEW |