Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / encrypted-media / prefixed / encrypted-media-not-loaded.html
blob71f0123b0aca6a13cd9efdd425cf5efe9ab715e8
1 <!doctype html>
2 <html lang="en">
3 <head>
4 </head>
5 <body>
6 <video></video>
7 <p>Test that the methods throw INVALID_STATE_ERR when the media element has not loaded. canPlayType() never throws.</p>
9 <script src=../../media-file.js></script>
10 <script src=../../video-test.js></script>
11 <script>
12 var key = new Uint8Array([0x51, 0x52, 0x53]);
14 function loadStarted()
16 test("video.networkState == video.NETWORK_LOADING || video.networkState == video.NETWORK_IDLE");
17 testExpected("video.currentSrc", "", "!=");
18 consoleWrite("Verify that none of the methods throw when load has started.");
19 run("video.webkitGenerateKeyRequest('webkit-org.w3.clearkey')");
20 run("video.webkitAddKey('webkit-org.w3.clearkey', key)");
21 run("video.webkitCancelKeyRequest('webkit-org.w3.clearkey')");
22 run("video.canPlayType('audio/wav', 'webkit-org.w3.clearkey')");
24 endTest();
27 // Confirms the unloaded state.
28 testExpected("video.networkState", video.NETWORK_EMPTY);
29 testExpected("video.currentSrc", "");
31 consoleWrite("No 'src'. Verify that all methods except canPlayType() throw INVALID_STATE_ERR.");
32 testDOMException("video.webkitGenerateKeyRequest('webkit-org.w3.clearkey')", "DOMException.INVALID_STATE_ERR");
33 testDOMException("video.webkitAddKey('webkit-org.w3.clearkey', key)", "DOMException.INVALID_STATE_ERR");
34 testDOMException("video.webkitCancelKeyRequest('webkit-org.w3.clearkey')", "DOMException.INVALID_STATE_ERR");
35 run("video.canPlayType('audio/wav', 'webkit-org.w3.clearkey')");
37 video.setAttribute("src", findMediaFile("video", "../../content/test"));
39 consoleWrite("<br>'src' has been set, but loading has not yet started. Verify that all methods except canPlayType() throw INVALID_STATE_ERR.");
41 testExpected("video.networkState", video.NETWORK_NO_SOURCE);
42 testExpected("video.currentSrc", "");
44 testDOMException("video.webkitGenerateKeyRequest('webkit-org.w3.clearkey')", "DOMException.INVALID_STATE_ERR");
45 testDOMException("video.webkitAddKey('webkit-org.w3.clearkey', key)", "DOMException.INVALID_STATE_ERR");
46 testDOMException("video.webkitCancelKeyRequest('webkit-org.w3.clearkey')", "DOMException.INVALID_STATE_ERR");
47 run("video.canPlayType('audio/wav', 'webkit-org.w3.clearkey')");
50 consoleWrite("");
51 waitForEvent('loadstart', loadStarted);
52 </script>
53 </body>
54 </html>