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

Unified Diff: LayoutTests/http/tests/inspector/inspector-test.js

Issue 319143002: DevTools: introduce WebInspector.Throttler (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address @vsevik & @aandrey comments Created 6 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: LayoutTests/http/tests/inspector/inspector-test.js
diff --git a/LayoutTests/http/tests/inspector/inspector-test.js b/LayoutTests/http/tests/inspector/inspector-test.js
index 85e1c1844e2fc9e26e8584678fd577d6b77e3888..de481f17dfa8641cece157b8a7f37712e7a41a0a 100644
--- a/LayoutTests/http/tests/inspector/inspector-test.js
+++ b/LayoutTests/http/tests/inspector/inspector-test.js
@@ -321,7 +321,7 @@ InspectorTest.runTestSuite = function(testSuite)
var nextTest = testSuiteTests.shift();
InspectorTest.addResult("");
InspectorTest.addResult("Running: " + /function\s([^(]*)/.exec(nextTest)[1]);
- InspectorTest.safeWrap(nextTest)(runner, runner);
+ InspectorTest.safeWrap(nextTest)(runner);
}
runner();
}
@@ -569,6 +569,42 @@ InspectorTest.dumpLoadedModules = function(next)
next();
}
+InspectorTest.TimeoutMock = function()
+{
+ this._timeoutId = 0;
+ this._timeoutIdToProcess = {};
+ this._timeoutIdToMillis = {};
+ this.setTimeout = this.setTimeout.bind(this);
+ this.clearTimeout = this.clearTimeout.bind(this);
+}
+InspectorTest.TimeoutMock.prototype = {
+ setTimeout: function(operation, timeout)
+ {
+ this._timeoutIdToProcess[++this._timeoutId] = operation;
+ this._timeoutIdToMillis[this._timeoutId] = timeout;
+ return this._timeoutId;
+ },
+
+ clearTimeout: function(timeoutId)
+ {
+ delete this._timeoutIdToProcess[timeoutId];
+ delete this._timeoutIdToMillis[timeoutId];
+ },
+
+ activeTimersTimeouts: function()
+ {
+ return Object.values(this._timeoutIdToMillis);
+ },
+
+ fireAllTimers: function()
+ {
+ for (var timeoutId in this._timeoutIdToProcess)
+ this._timeoutIdToProcess[timeoutId].call(window);
+ this._timeoutIdToProcess = {};
+ this._timeoutIdToMillis = {};
+ }
+}
+
WebInspector.TempFile = InspectorTest.TempFileMock;
};

Powered by Google App Engine
This is Rietveld 408576698