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

Side by Side Diff: chrome/test/data/webui/test_api.js

Issue 8418015: Allow javascript unit tests using webui test_api framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't double log errors (console.error). 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 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 4
5 /** 5 /**
6 * @fileoverview Library providing basic test framework functionality. 6 * @fileoverview Library providing basic test framework functionality.
7 */ 7 */
8 8
9 /** 9 /**
10 * Namespace for |Test|. 10 * Namespace for |Test|.
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 // that have enabled content-security-policy. 760 // that have enabled content-security-policy.
761 var testBody = this[testFunction]; // global object -- not a method. 761 var testBody = this[testFunction]; // global object -- not a method.
762 var testName = testFunction; 762 var testName = testFunction;
763 if (typeof testBody === "undefined") { 763 if (typeof testBody === "undefined") {
764 testBody = eval(testFunction); 764 testBody = eval(testFunction);
765 testName = testBody.toString(); 765 testName = testBody.toString();
766 } 766 }
767 if (testBody != RUN_TEST_F) { 767 if (testBody != RUN_TEST_F) {
768 console.log('Running test ' + testName); 768 console.log('Running test ' + testName);
769 } 769 }
770 var result = runTestFunction(testFunction, testBody, testArguments, true); 770 var result = runTestFunction(testFunction, testBody, testArguments,
771 isAsync);
771 if (!isAsync || !result[0]) 772 if (!isAsync || !result[0])
772 testDone(result); 773 testDone(result);
773 return true; 774 return true;
774 } 775 }
775 776
776 /** 777 /**
777 * This is the guts of WebUIBrowserTest. It runs the test surrounded by an 778 * This is the guts of WebUIBrowserTest. It runs the test surrounded by an
778 * expect to catch Errors. If |errors| is non-empty, it reports a failure and 779 * expect to catch Errors. If |errors| is non-empty, it reports a failure and
779 * a message by joining |errors|. Consumers can use this to use assert/expect 780 * a message by joining |errors|. Consumers can use this to use assert/expect
780 * functions asynchronously, but are then responsible for reporting errors to 781 * functions asynchronously, but are then responsible for reporting errors to
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 window.SaveMockArguments = SaveMockArguments; 1300 window.SaveMockArguments = SaveMockArguments;
1300 window.DUMMY_URL = DUMMY_URL; 1301 window.DUMMY_URL = DUMMY_URL;
1301 window.TEST = TEST; 1302 window.TEST = TEST;
1302 window.TEST_F = TEST_F; 1303 window.TEST_F = TEST_F;
1303 window.GEN = GEN; 1304 window.GEN = GEN;
1304 window.WhenTestDone = WhenTestDone; 1305 window.WhenTestDone = WhenTestDone;
1305 1306
1306 // Import the Mock4JS helpers. 1307 // Import the Mock4JS helpers.
1307 Mock4JS.addMockSupport(window); 1308 Mock4JS.addMockSupport(window);
1308 })(('window' in this) ? window : this); 1309 })(('window' in this) ? window : this);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698