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

Unified Diff: third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session.html

Issue 1420223002: Disallow assigning a MediaSession after the resource has been selected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pull expected file from the bots Created 5 years, 2 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 | « no previous file | third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session.html
diff --git a/third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session.html b/third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session.html
index 7a2dfff6d5adecc09fe3da6f62116610d1d6290c..abd5df97bc43acac241c948b4d66d0b112c7d514 100644
--- a/third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session.html
+++ b/third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session.html
@@ -7,11 +7,14 @@
assert_true(!window.internals || window.internals.runtimeFlags.mediaSessionEnabled,
"Run either manually by passing the MediaSession flag or as part of the virtual mediasession testsuite.");
console.warn("dummy log entry to avoid an empty -expected.txt in virtual/");
+ }, "Setup");
+ test(function() {
var mediaElement = document.createElement('audio');
assert_true(mediaElement instanceof HTMLMediaElement);
var mediaSession = new MediaSession();
+ assert_equals(mediaElement.networkState, HTMLMediaElement.NETWORK_EMPTY);
mediaElement.session = mediaSession;
assert_equals(mediaElement.session, mediaSession);
@@ -22,5 +25,25 @@
mediaElement.session = null;
assert_equals(mediaElement.session, null);
- });
+ }, "Set HTMLMediaElement session when networkState is NETWORK_EMPTY");
+
+ test(function() {
+ var mediaElement = document.createElement('audio');
+ var mediaSession = new MediaSession();
+ mediaElement.appendChild(document.createElement('source'));
+ assert_equals(mediaElement.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
+ mediaElement.session = mediaSession;
+ assert_equals(mediaElement.session, mediaSession);
+ }, "Set HTMLMediaElement session when networkState is NETWORK_NO_SOURCE");
+
+ async_test(function(t) {
+ var mediaElement = document.createElement('audio');
+ mediaElement.onloadeddata = t.step_func(function () {
+ assert_true(mediaElement.networkState == HTMLMediaElement.NETWORK_IDLE
+ || mediaElement.networkState == HTMLMediaElement.NETWORK_LOADING);
+ assert_throws("InvalidStateError", function() { mediaElement.session = new MediaSession(); });
+ t.done();
+ });
+ mediaElement.src = '../resources/test-live.webm';
+ }, "Set HTMLMediaElement session during or after load");
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/mediasession/htmlmediaelement-set-session-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698