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

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: Rebase. 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
« no previous file with comments | « chrome/common/chrome_notification_types.h ('k') | chrome/test/base/js_injection_ready_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/js2gtest.js
diff --git a/chrome/test/base/js2gtest.js b/chrome/test/base/js2gtest.js
index bfabc070045d418adcc9cacda07e57dbbc550319..70a31c4d4011f5bebe17d75a635071fd76d54c47 100644
--- a/chrome/test/base/js2gtest.js
+++ b/chrome/test/base/js2gtest.js
@@ -66,6 +66,14 @@ var typedeffedCppFixtures = {};
*/
var genIncludes = [];
+/**
+ * When true, add calls to set_preload_test_(fixture|name). This is needed when
+ * |testType| === 'browser' to send an injection message before the page loads,
+ * but is not required or supported for |testType| === 'unit'.
+ * @type {boolean}
+ */
+var addSetPreloadInfo;
+
// Generate the file to stdout.
print('// GENERATED FILE');
print('// ' + arguments.join(' '));
@@ -81,10 +89,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 +166,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 + '", ' +
« no previous file with comments | « chrome/common/chrome_notification_types.h ('k') | chrome/test/base/js_injection_ready_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698