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

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

Issue 7087014: Support automatic javascript test registry in gtest when creating WebUI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated comments about indices, and fixed set_add to take separate args; not array. Created 9 years, 6 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
new file mode 100755
index 0000000000000000000000000000000000000000..b4ad607912fe709bcff9704a4a133578f0cdd165
--- /dev/null
+++ b/chrome/browser/ui/webui/javascript2webui.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+if (arguments.length < 4) {
+ print('usage: ' +
+ arguments[0] + ' test_fixture path-to-testfile.js testfile.js');
+ quit();
+}
+var test_fixture = arguments[1];
+var js_file = arguments[2];
+var js_file_base = arguments[3];
+var prevfuncs = {};
+for (var func in this) {
+ if (this[func] instanceof Function)
+ prevfuncs[func] = func;
+}
+var js = load(js_file);
+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 + '")));');
+ print(' ASSERT_TRUE(RunJavascriptTest("' + func + '"));');
+ print('}');
+ print();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698