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

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

Issue 103913010: Add new "resize" event to HTMLMediaElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: vsevik & acolwell CR Created 7 years 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 | « no previous file | LayoutTests/media/video-frame-size-change.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/media/media-source/mediasource-config-changes.js
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-config-changes.js b/LayoutTests/http/tests/media/media-source/mediasource-config-changes.js
index f8342480abda2e6d22a6d7d04e4056a69a0bc711..7c79315ff03faffd00e7b16fb428e326d4008fff 100644
--- a/LayoutTests/http/tests/media/media-source/mediasource-config-changes.js
+++ b/LayoutTests/http/tests/media/media-source/mediasource-config-changes.js
@@ -1,3 +1,13 @@
+// Extract & return the resolution string from a filename, if any.
+function resolutionFromFilename(filename)
+{
+ resolution = filename.replace(/^.*[^0-9]([0-9]+x[0-9]+)[^0-9].*$/, "$1");
+ if (resolution != filename) {
+ return resolution;
+ }
+ return "";
+}
+
function appendBuffer(test, sourceBuffer, data)
{
test.expectEvent(sourceBuffer, "update");
@@ -13,7 +23,8 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
{
mediaElement.pause();
test.failOnEvent(mediaElement, 'error');
- test.endOnEvent(mediaElement, 'ended');
+ var expectResizeEvents = resolutionFromFilename(manifestFilenameA) != resolutionFromFilename(manifestFilenameB);
+ var expectedResizeEventCount = 0;
MediaSourceUtil.fetchManifestAndData(test, manifestFilenameA, function(typeA, dataA)
{
@@ -30,6 +41,7 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
// Add the second buffer starting at 0.5 second.
sourceBuffer.timestampOffset = 0.5;
appendBuffer(test, sourceBuffer, dataB);
+ ++expectedResizeEventCount;
});
test.waitForExpectedEvents(function()
@@ -37,6 +49,7 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
// Add the first buffer starting at 1 second.
sourceBuffer.timestampOffset = 1;
appendBuffer(test, sourceBuffer, dataA);
+ ++expectedResizeEventCount;
});
test.waitForExpectedEvents(function()
@@ -44,6 +57,7 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
// Add the second buffer starting at 1.5 second.
sourceBuffer.timestampOffset = 1.5;
appendBuffer(test, sourceBuffer, dataB);
+ ++expectedResizeEventCount;
});
test.waitForExpectedEvents(function()
@@ -52,8 +66,18 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
mediaSource.duration = 2;
mediaSource.endOfStream();
+ if (expectResizeEvents) {
+ for (var i = 0; i < expectedResizeEventCount; ++i) {
+ test.expectEvent(mediaElement, "resize");
+ }
+ }
+ test.expectEvent(mediaElement, "ended");
mediaElement.play();
});
+
+ test.waitForExpectedEvents(function() {
+ test.done();
+ });
});
});
}, description, { timeout: 10000 } );
« no previous file with comments | « no previous file | LayoutTests/media/video-frame-size-change.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698