| Index: Source/devtools/front_end/Tests.js
|
| diff --git a/Source/devtools/front_end/Tests.js b/Source/devtools/front_end/Tests.js
|
| index 7117132d72953b4d3012c7c94a1f97b68fd2ea4b..318dc19b6d88da247b4415bc56fb0638e3770256 100644
|
| --- a/Source/devtools/front_end/Tests.js
|
| +++ b/Source/devtools/front_end/Tests.js
|
| @@ -224,6 +224,41 @@ TestSuite.prototype.addSniffer = function(receiver, methodName, override, opt_st
|
| };
|
| };
|
|
|
| +/**
|
| + * Waits for current throttler invocations, if any.
|
| + * @param {!WebInspector.Throttler} throttler
|
| + * @param {!function} callback
|
| + */
|
| +TestSuite.prototype.waitForThrottler = function(throttler, callback)
|
| +{
|
| + var test = this;
|
| + var scheduleShouldFail = true;
|
| + test.addSniffer(throttler, "schedule", onSchedule);
|
| +
|
| + function hasSomethingScheduled()
|
| + {
|
| + return throttler._isRunningProcess || throttler._process;
|
| + }
|
| +
|
| + function checkState()
|
| + {
|
| + if (!hasSomethingScheduled()) {
|
| + scheduleShouldFail = false;
|
| + callback();
|
| + return;
|
| + }
|
| +
|
| + test.addSniffer(throttler, "_processCompletedForTests", checkState);
|
| + }
|
| +
|
| + function onSchedule()
|
| + {
|
| + if (scheduleShouldFail)
|
| + test.fail("Unexpected Throttler.schedule");
|
| + }
|
| +
|
| + checkState();
|
| +};
|
|
|
| // UI Tests
|
|
|
| @@ -615,8 +650,9 @@ TestSuite.prototype.testDeviceMetricsOverrides = function()
|
| test.releaseControl();
|
| }
|
|
|
| - step1();
|
| + WebInspector.overridesSupport._deviceMetricsChangedListenerMuted = true;
|
| test.takeControl();
|
| + this.waitForThrottler(WebInspector.overridesSupport._deviceMetricsThrottler, step1);
|
| };
|
|
|
| TestSuite.prototype.waitForTestResultsInConsole = function()
|
|
|