OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachus
etts Institute of Technology, ERCIM, Keio University, Beihang). --> | |
3 <html> | |
4 <head> | |
5 <title>Test that the HTMLMediaElement preload 'none' attribute value is
ignored for MediaStream used as srcObject and MediaStream object URLs used as sr
c.</title>> | |
6 <link rel="author" title="Matthew Wolenetz" href="mailto:wolenetz@chromi
um.org"/> | |
7 <script src="/resources/testharness.js"></script> | |
8 <script src="/resources/testharnessreport.js"></script> | |
9 <script src="/common/vendor-prefix.js" data-prefixed-objects='[{"ancesto
rs":["navigator"], "name":"getUserMedia"}, {"ancestors":["window"], "name":"Medi
aStream"}]'></script> | |
10 </head> | |
11 <body> | |
12 <p class="instructions">When prompted, accept to share your audio and vi
deo streams.</p> | |
13 <h1 class="instructions">Description</h1> | |
14 <p class="instructions">This test checks that the HTMLMediaElement prelo
ad 'none' attribute value is ignored for MediaStream used as srcObject and Media
Stream object URLs used as src.</p> | |
15 | |
16 <audio preload="none"></audio> | |
17 <video preload="none"></video> | |
18 | |
19 <script> | |
20 function testPreloadNone(t, mediaElement, setSourceStreamFunc) | |
21 { | |
22 // The optional deferred load steps (for preload none) for Media
Stream resources should be skipped. | |
23 mediaElement.addEventListener("suspend", t.unreached_func("'susp
end' should not be fired.")); | |
24 | |
25 mediaElement.addEventListener("loadeddata", t.step_func(function
() | |
26 { | |
27 assert_equals(mediaElement.networkState, mediaElement.NETWOR
K_LOADING); | |
28 t.done(); | |
29 })); | |
30 | |
31 setSourceStreamFunc(); | |
32 assert_equals(mediaElement.networkState, mediaElement.NETWORK_NO
_SOURCE); // Resource selection is active. | |
33 } | |
34 | |
35 async_test(function(t) | |
36 { | |
37 var aud = document.querySelector("audio"); | |
38 navigator.getUserMedia({audio:true}, t.step_func(function(stream
) | |
39 { | |
40 testPreloadNone(t, aud, t.step_func(function() | |
41 { | |
42 aud.src = URL.createObjectURL(stream); | |
43 t.add_cleanup(function() { URL.revokeObjectURL(aud.src);
}); | |
44 })); | |
45 }), t.unreached_func("getUserMedia error callback was invoked.")
); | |
46 }, "Test that preload 'none' is ignored for MediaStream object URL u
sed as src"); | |
47 | |
48 async_test(function(t) | |
49 { | |
50 var vid = document.querySelector("video"); | |
51 navigator.getUserMedia({video:true}, t.step_func(function(stream
) | |
52 { | |
53 testPreloadNone(t, vid, t.step_func(function() { vid.srcObje
ct = stream; })); | |
54 }), t.unreached_func("getUserMedia error callback was invoked.")
); | |
55 }, "Test that preload 'none' is ignored for MediaStream used as srcO
bject"); | |
56 </script> | |
57 </body> | |
58 </html> | |
OLD | NEW |