OLD | NEW |
| (Empty) |
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> | |
8 | |
9 <script src=../../media-file.js></script> | |
10 <script src=../../video-test.js></script> | |
11 <script> | |
12 var key = new Uint8Array([0x51, 0x52, 0x53]); | |
13 | |
14 function loadStarted() | |
15 { | |
16 test("video.networkState == video.NETWORK_LOADING || video.netwo
rkState == video.NETWORK_IDLE"); | |
17 testExpected("video.currentSrc", "", "!="); | |
18 consoleWrite("Verify that none of the methods throw when load ha
s 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')"); | |
23 | |
24 endTest(); | |
25 } | |
26 | |
27 // Confirms the unloaded state. | |
28 testExpected("video.networkState", video.NETWORK_EMPTY); | |
29 testExpected("video.currentSrc", ""); | |
30 | |
31 consoleWrite("No 'src'. Verify that all methods except canPlayType()
throw INVALID_STATE_ERR."); | |
32 testDOMException("video.webkitGenerateKeyRequest('webkit-org.w3.clea
rkey')", "DOMException.INVALID_STATE_ERR"); | |
33 testDOMException("video.webkitAddKey('webkit-org.w3.clearkey', key)"
, "DOMException.INVALID_STATE_ERR"); | |
34 testDOMException("video.webkitCancelKeyRequest('webkit-org.w3.cleark
ey')", "DOMException.INVALID_STATE_ERR"); | |
35 run("video.canPlayType('audio/wav', 'webkit-org.w3.clearkey')"); | |
36 | |
37 video.setAttribute("src", findMediaFile("video", "../../content/test
")); | |
38 | |
39 consoleWrite("<br>'src' has been set, but loading has not yet starte
d. Verify that all methods except canPlayType() throw INVALID_STATE_ERR."); | |
40 | |
41 testExpected("video.networkState", video.NETWORK_NO_SOURCE); | |
42 testExpected("video.currentSrc", ""); | |
43 | |
44 testDOMException("video.webkitGenerateKeyRequest('webkit-org.w3.clea
rkey')", "DOMException.INVALID_STATE_ERR"); | |
45 testDOMException("video.webkitAddKey('webkit-org.w3.clearkey', key)"
, "DOMException.INVALID_STATE_ERR"); | |
46 testDOMException("video.webkitCancelKeyRequest('webkit-org.w3.cleark
ey')", "DOMException.INVALID_STATE_ERR"); | |
47 run("video.canPlayType('audio/wav', 'webkit-org.w3.clearkey')"); | |
48 | |
49 | |
50 consoleWrite(""); | |
51 waitForEvent('loadstart', loadStarted); | |
52 </script> | |
53 </body> | |
54 </html> | |
OLD | NEW |