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

Unified Diff: chrome/browser/ui/webui/javascript2webui.js

Issue 7237030: Added options browser_tests using the generator and js handler framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/settings/options/, moved .cc into options dir, addressed JS readability. Created 9 years, 5 months 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/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();

Powered by Google App Engine
This is Rietveld 408576698