Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / mediasession / htmlmediaelement-set-session.html
blob7a2dfff6d5adecc09fe3da6f62116610d1d6290c
1 <!DOCTYPE html>
2 <title>HTMLMediaElement set session</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script>
6 test(function() {
7 assert_true(!window.internals || window.internals.runtimeFlags.mediaSessionEnabled,
8 "Run either manually by passing the MediaSession flag or as part of the virtual mediasession testsuite.");
9 console.warn("dummy log entry to avoid an empty -expected.txt in virtual/");
11 var mediaElement = document.createElement('audio');
12 assert_true(mediaElement instanceof HTMLMediaElement);
14 var mediaSession = new MediaSession();
15 mediaElement.session = mediaSession;
16 assert_equals(mediaElement.session, mediaSession);
18 assert_throws(new TypeError, function() { mediaElement.session = document; });
19 assert_throws(new TypeError, function() { mediaElement.session = "string"; });
20 assert_throws(new TypeError, function() { mediaElement.session = 42; });
21 assert_equals(mediaElement.session, mediaSession);
23 mediaElement.session = null;
24 assert_equals(mediaElement.session, null);
25 });
26 </script>