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

Side by Side 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: Windows doesn't allow OVERRIDE on destructors. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 if (arguments.length < 3) { 4 if (arguments.length < 3) {
5 print('usage: ' + 5 print('usage: ' +
6 arguments[0] + ' path-to-testfile.js testfile.js [output.cc]'); 6 arguments[0] + ' path-to-testfile.js testfile.js [output.cc]');
7 quit(); 7 quit();
8 } 8 }
9 var js_file = arguments[1]; 9 var js_file = arguments[1];
David Tseng 2011/07/07 19:26:28 Can you have someone with js readability review th
Sheridan Rawlins 2011/07/07 23:39:23 I will add mdm and/or joi. On 2011/07/07 19:26:28
10 var js_file_base = arguments[2]; 10 var js_file_base = arguments[2];
11 var outputfile = arguments[3]; 11 var outputfile = arguments[3];
David Tseng 2011/07/07 19:26:28 outputFile
Sheridan Rawlins 2011/07/07 23:39:23 Done.
12 var prevfuncs = {}; 12 var prevfuncs = {};
David Tseng 2011/07/07 19:26:28 prevFunctions
Sheridan Rawlins 2011/07/07 23:39:23 Done.
13 for (var func in this) { 13 for (var func in this) {
14 if (this[func] instanceof Function) 14 if (this[func] instanceof Function)
15 prevfuncs[func] = func; 15 prevfuncs[func] = func;
16 } 16 }
17 var js = load(js_file); 17 var js = load(js_file);
18 if (!('test_fixture' in this)) { 18 if (!('test_fixture' in this)) {
19 print(js_file + ' did not define test_fixture.'); 19 print(js_file + ' did not define test_fixture.');
20 quit(-1); 20 quit(-1);
21 } 21 }
22 if (!('test_browse_preload' in this)) {
23 this['test_browse_preload'] = undefined;
24 }
22 print('// GENERATED FILE'); 25 print('// GENERATED FILE');
23 print('// ' + arguments.join(' ')); 26 print('// ' + arguments.join(' '));
24 print('// PLEASE DO NOT HAND EDIT!'); 27 print('// PLEASE DO NOT HAND EDIT!');
25 print(); 28 print();
26 for (var func in this) { 29 for (var func in this) {
27 if (!prevfuncs[func] && this[func] instanceof Function) { 30 if (!prevfuncs[func] && typeof(this[func]) == 'function') {
28 print('IN_PROC_BROWSER_TEST_F(' + test_fixture + ', ' + func + ') {'); 31 print('IN_PROC_BROWSER_TEST_F(' + test_fixture + ', ' + func + ') {');
29 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + js_file_base + '")));'); 32 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + js_file_base + '")));');
33 if (test_browse_preload) {
34 print(' BrowsePreload(GURL("' + test_browse_preload + '"), true);');
35 }
30 print(' ASSERT_TRUE(RunJavascriptTest("' + func + '"));'); 36 print(' ASSERT_TRUE(RunJavascriptTest("' + func + '"));');
31 print('}'); 37 print('}');
32 print(); 38 print();
33 } 39 }
34 } 40 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview_browsertest.cc » ('j') | chrome/browser/ui/webui/settings_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698