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

Unified Diff: Source/devtools/front_end/main/Tests.js

Issue 725583003: [DevTools] Prepare to pass modified InspectorFrontendHost to inspector app. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed comment Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/main/Tests.js
diff --git a/Source/devtools/front_end/main/Tests.js b/Source/devtools/front_end/main/Tests.js
index 67d1a86308c255336502fc4677c68f8851749a2b..fb47fcaec980ce7c05bc246e64a77af4167cf5e3 100644
--- a/Source/devtools/front_end/main/Tests.js
+++ b/Source/devtools/front_end/main/Tests.js
@@ -37,7 +37,8 @@
* FIXME: change field naming style to use trailing underscore.
*/
-if (window.domAutomationController) {
+function createTestSuite(domAutomationController)
+{
var ___interactiveUiTestsMode = true;
@@ -45,7 +46,7 @@ var ___interactiveUiTestsMode = true;
* Test suite for interactive UI tests.
* @constructor
*/
-TestSuite = function()
+function TestSuite()
{
this.controlTaken_ = false;
this.timerId_ = -1;
@@ -148,7 +149,7 @@ TestSuite.prototype.releaseControl = function()
*/
TestSuite.prototype.reportOk_ = function()
{
- window.domAutomationController.send("[OK]");
+ domAutomationController.send("[OK]");
};
@@ -161,7 +162,7 @@ TestSuite.prototype.reportFailure_ = function(error)
clearTimeout(this.timerId_);
this.timerId_ = -1;
}
- window.domAutomationController.send("[FAILED] " + error);
+ domAutomationController.send("[FAILED] " + error);
};
@@ -905,20 +906,14 @@ TestSuite.createKeyEvent = function(keyIdentifier)
/**
- * Test runner for the test suite.
- */
-var uiTests = {};
-
-
-/**
* Run each test from the test suit on a fresh instance of the suite.
*/
-uiTests.runAllTests = function()
+TestSuite._runAllTests = function()
{
// For debugging purposes.
for (var name in TestSuite.prototype) {
if (name.substring(0, 4) === "test" && typeof TestSuite.prototype[name] === "function")
- uiTests.runTest(name);
+ TestSuite._runTest(name);
}
};
@@ -927,27 +922,28 @@ uiTests.runAllTests = function()
* Run specified test on a fresh instance of the test suite.
* @param {string} name Name of a test method from TestSuite class.
*/
-uiTests.runTest = function(name)
+TestSuite._runTest = function(name)
{
- if (uiTests._populatedInterface)
+ if (TestSuite._populatedInterface)
new TestSuite().runTest(name);
else
- uiTests._pendingTestName = name;
+ TestSuite._pendingTestName = name;
};
-(function() {
-
function runTests()
{
- uiTests._populatedInterface = true;
- var name = uiTests._pendingTestName;
- delete uiTests._pendingTestName;
+ TestSuite._populatedInterface = true;
+ var name = TestSuite._pendingTestName;
+ delete TestSuite._pendingTestName;
if (name)
new TestSuite().runTest(name);
}
WebInspector.notifications.addEventListener(WebInspector.NotificationService.Events.InspectorAgentEnabledForTests, runTests);
-})();
+return TestSuite;
}
+
+if (window.parent && window.parent.uiTests)
+ window.parent.uiTests.testSuiteReady(createTestSuite);
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698