Index: chrome/browser/ui/webui/javascript2webui.js |
diff --git a/chrome/browser/ui/webui/javascript2webui.js b/chrome/browser/ui/webui/javascript2webui.js |
index a61a4adc746ba0d3848434aa530f4e972db64175..867374869dda4f12e50c60af056909a5971214c8 100644 |
--- a/chrome/browser/ui/webui/javascript2webui.js |
+++ b/chrome/browser/ui/webui/javascript2webui.js |
@@ -6,27 +6,33 @@ if (arguments.length < 3) { |
arguments[0] + ' path-to-testfile.js testfile.js [output.cc]'); |
quit(); |
} |
-var js_file = arguments[1]; |
-var js_file_base = arguments[2]; |
-var outputfile = arguments[3]; |
-var prevfuncs = {}; |
+var jsFile = arguments[1]; |
+var jsFileBase = arguments[2]; |
+var outputFile = arguments[3]; |
+var prevFunctions = {}; |
for (var func in this) { |
if (this[func] instanceof Function) |
- prevfuncs[func] = func; |
+ prevFunctions[func] = func; |
} |
-var js = load(js_file); |
-if (!('test_fixture' in this)) { |
- print(js_file + ' did not define test_fixture.'); |
+var js = load(jsFile); |
+if (!('testFixture' in this)) { |
+ print(jsFile + ' did not define testFixture.'); |
quit(-1); |
} |
+if (!('testBrowsePreload' in this)) { |
+ this['testBrowsePreload'] = undefined; |
+} |
print('// GENERATED FILE'); |
print('// ' + arguments.join(' ')); |
print('// PLEASE DO NOT HAND EDIT!'); |
print(); |
for (var func in this) { |
- if (!prevfuncs[func] && this[func] instanceof Function) { |
- print('IN_PROC_BROWSER_TEST_F(' + test_fixture + ', ' + func + ') {'); |
- print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + js_file_base + '")));'); |
+ if (!prevFunctions[func] && typeof(this[func]) == 'function') { |
+ print('IN_PROC_BROWSER_TEST_F(' + testFixture + ', ' + func + ') {'); |
+ print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + jsFileBase + '")));'); |
+ if (testBrowsePreload) { |
+ print(' BrowsePreload(GURL("' + testBrowsePreload + '"), true);'); |
+ } |
print(' ASSERT_TRUE(RunJavascriptTest("' + func + '"));'); |
print('}'); |
print(); |