Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2886)

Unified Diff: chrome/test/base/js2gtest.js

Issue 8586009: Allow WebUI Tests to use preLoad in HtmlDialogUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert to patch set 4. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 + '", ' +

Powered by Google App Engine
This is Rietveld 408576698