Chromium Code Reviews| Index: chrome/test/base/js2gtest.js |
| diff --git a/chrome/test/base/js2gtest.js b/chrome/test/base/js2gtest.js |
| index bfabc070045d418adcc9cacda07e57dbbc550319..204e224be7a72ac4438da216d8fa3b0ff5e2ebea 100644 |
| --- a/chrome/test/base/js2gtest.js |
| +++ b/chrome/test/base/js2gtest.js |
| @@ -66,6 +66,12 @@ var typedeffedCppFixtures = {}; |
| */ |
| var genIncludes = []; |
| +/** |
| + * When true, add calls to set_preload_test_(fixture|name). |
|
James Hawkins
2011/11/22 23:03:29
Document the rationale.
Sheridan Rawlins
2011/11/23 20:10:07
Done.
|
| + * @type {boolean} |
| + */ |
| +var addSetPreloadInfo; |
| + |
| // Generate the file to stdout. |
| print('// GENERATED FILE'); |
| print('// ' + arguments.join(' ')); |
| @@ -81,10 +87,12 @@ if (testType === 'unit') { |
| print('#include "chrome/test/base/v8_unit_test.h"'); |
| testing.Test.prototype.typedefCppFixture = 'V8UnitTest'; |
| testF = 'TEST_F'; |
| + addSetPreloadInfo = false; |
| } else { |
| print('#include "chrome/browser/ui/webui/web_ui_browsertest.h"'); |
| testing.Test.prototype.typedefCppFixture = 'WebUIBrowserTest'; |
| testF = 'IN_PROC_BROWSER_TEST_F'; |
| + addSetPreloadInfo = true; |
| } |
| print('#include "googleurl/src/gurl.h"'); |
| print('#include "testing/gtest/include/gtest/gtest.h"'); |
| @@ -156,22 +164,23 @@ function TEST_F(testFixture, testFunction, testBody) { |
| } |
| print(testF + '(' + testFixture + ', ' + testFunction + ') {'); |
| - if (testGenPreamble) |
| - testGenPreamble(testFixture, testFunction); |
| for (var i = 0; i < extraLibraries.length; i++) { |
| print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + |
| extraLibraries[i].replace(/\\/g, '/') + '")));'); |
| } |
| print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + |
| jsFileBase.replace(/\\/g, '/') + '")));'); |
| - if (browsePreload) { |
| - print(' BrowsePreload(GURL("' + browsePreload + '"), "' + testFixture + |
| - '", "' + testFunction + '");'); |
| - } |
| + if (addSetPreloadInfo) { |
| + print(' set_preload_test_fixture("' + testFixture + '");'); |
| + print(' set_preload_test_name("' + testFunction + '");'); |
| + } |
| + if (testGenPreamble) |
| + testGenPreamble(testFixture, testFunction); |
| + if (browsePreload) |
| + print(' BrowsePreload(GURL("' + browsePreload + '"));'); |
| if (browsePrintPreload) { |
| print(' BrowsePrintPreload(GURL(WebUITestDataPathToURL(\n' + |
| - ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))),\n' + |
| - ' "' + testFixture + '", "' + testFunction + '");'); |
| + ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))));'); |
| } |
| print(' ' + testPredicate + '(RunJavascriptTestF(' + isAsyncParam + |
| '"' + testFixture + '", ' + |