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

Side by Side 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, 1 month 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>HTMLMediaElement set session</title> 2 <title>HTMLMediaElement set session</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <script> 5 <script>
6 test(function() { 6 test(function() {
7 assert_true(!window.internals || window.internals.runtimeFlags.mediaSessio nEnabled, 7 assert_true(!window.internals || window.internals.runtimeFlags.mediaSessio nEnabled,
8 "Run either manually by passing the MediaSession flag or as part of th e virtual mediasession testsuite."); 8 "Run either manually by passing the MediaSession flag or as part of th e virtual mediasession testsuite.");
9 console.warn("dummy log entry to avoid an empty -expected.txt in virtual/" ); 9 console.warn("dummy log entry to avoid an empty -expected.txt in virtual/" );
10 }, "Setup");
10 11
12 test(function() {
11 var mediaElement = document.createElement('audio'); 13 var mediaElement = document.createElement('audio');
12 assert_true(mediaElement instanceof HTMLMediaElement); 14 assert_true(mediaElement instanceof HTMLMediaElement);
13 15
14 var mediaSession = new MediaSession(); 16 var mediaSession = new MediaSession();
17 assert_equals(mediaElement.networkState, HTMLMediaElement.NETWORK_EMPTY);
15 mediaElement.session = mediaSession; 18 mediaElement.session = mediaSession;
16 assert_equals(mediaElement.session, mediaSession); 19 assert_equals(mediaElement.session, mediaSession);
17 20
18 assert_throws(new TypeError, function() { mediaElement.session = document; }); 21 assert_throws(new TypeError, function() { mediaElement.session = document; });
19 assert_throws(new TypeError, function() { mediaElement.session = "string"; }); 22 assert_throws(new TypeError, function() { mediaElement.session = "string"; });
20 assert_throws(new TypeError, function() { mediaElement.session = 42; }); 23 assert_throws(new TypeError, function() { mediaElement.session = 42; });
21 assert_equals(mediaElement.session, mediaSession); 24 assert_equals(mediaElement.session, mediaSession);
22 25
23 mediaElement.session = null; 26 mediaElement.session = null;
24 assert_equals(mediaElement.session, null); 27 assert_equals(mediaElement.session, null);
25 }); 28 }, "Set HTMLMediaElement session when networkState is NETWORK_EMPTY");
29
30 test(function() {
31 var mediaElement = document.createElement('audio');
32 var mediaSession = new MediaSession();
33 mediaElement.appendChild(document.createElement('source'));
34 assert_equals(mediaElement.networkState, HTMLMediaElement.NETWORK_NO_SOURC E);
35 mediaElement.session = mediaSession;
36 assert_equals(mediaElement.session, mediaSession);
37 }, "Set HTMLMediaElement session when networkState is NETWORK_NO_SOURCE");
38
39 async_test(function(t) {
40 var mediaElement = document.createElement('audio');
41 mediaElement.onloadeddata = t.step_func(function () {
42 assert_true(mediaElement.networkState == HTMLMediaElement.NETWORK_IDLE
43 || mediaElement.networkState == HTMLMediaElement.NETWORK_L OADING);
44 assert_throws("InvalidStateError", function() { mediaElement.session = new MediaSession(); });
45 t.done();
46 });
47 mediaElement.src = '../resources/test-live.webm';
48 }, "Set HTMLMediaElement session during or after load");
26 </script> 49 </script>
OLDNEW
« 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