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>
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')");
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')");
51 waitForEvent('loadstart', loadStarted
);