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

Unified Diff: LayoutTests/http/tests/media/media-source/mediasource-util.js

Issue 20114005: Layout Test for basic MSE seek scenario. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add timeout callbacks to expectations-manager. Clear timeouts in test.done() # Created 7 years, 5 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
« no previous file with comments | « LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/media/media-source/mediasource-util.js
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-util.js b/LayoutTests/http/tests/media/media-source/mediasource-util.js
index 456f012f4d99dc613dbdf3ac07f224d518097e76..02c0496e5bb9760336be3a1c92478dc0ccc3bc9b 100644
--- a/LayoutTests/http/tests/media/media-source/mediasource-util.js
+++ b/LayoutTests/http/tests/media/media-source/mediasource-util.js
@@ -4,6 +4,7 @@
this.test_ = test;
this.eventTargetList_ = [];
this.waitCallbacks_ = [];
+ this.timeoutIDs_ = [];
};
EventExpectationsManager.prototype.expectEvent = function(object, eventName, description)
@@ -29,6 +30,12 @@
object.addEventListener(eventName, eventHandler);
};
+ EventExpectationsManager.prototype.callOnTimeout = function(callback, timeout)
+ {
+ var timeoutID = setTimeout(callback, timeout);
wolenetz 2013/07/31 19:42:37 For purposes of automatically failing the test if
anandc 2013/07/31 22:17:32 Done.
+ this.timeoutIDs_.push(timeoutID);
+ };
+
EventExpectationsManager.prototype.waitForExpectedEvents = function(callback)
{
this.waitCallbacks_.push(callback);
@@ -176,6 +183,11 @@
test.eventExpectations_.expectEvent(object, eventName, description);
};
+ test.callOnTimeout = function(callback, timeout)
wolenetz 2013/07/31 19:42:37 nit: Would 'expectTimeout' be better?
anandc 2013/07/31 22:17:32 Now named expectDelayedCallback.
+ {
+ test.eventExpectations_.callOnTimeout(callback, timeout);
+ }
+
test.waitForExpectedEvents = function(callback)
{
test.eventExpectations_.waitForExpectedEvents(callback);
@@ -184,6 +196,12 @@
var oldTestDone = test.done.bind(test);
test.done = function()
{
+ // loop through and clear timeoutIDs
+ var timeoutIDs = test.eventExpectations_.timeoutIDs_;
+ while (timeoutIDs.length > 0) {
+ clearTimeout(timeoutIDs.shift());
+ }
+
if (test.status == test.PASS)
assert_false(test.eventExpectations_.expectingEvents(), "No pending event expectations.");
wolenetz 2013/07/31 19:42:37 Need to also assert that there are no pending time
anandc 2013/07/31 22:17:32 Done.
oldTestDone();
« no previous file with comments | « LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698