Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-src-none.html

Issue 2096223002: Convert video-src-invalid* and video-src-none* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nit Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Test that calling load() with no "src" should not fire "error" event and network state should be NETWORK_EMPTY.</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 4 <script src="../resources/testharnessreport.js"></script>
5 (Please avoid writing new tests using video-test.js) --> 5 <video></video>
6 <script src=video-test.js></script> 6 <script>
7 <script> 7 async_test(function(t) {
8 var state; 8 var video = document.querySelector("video");
9 9
10 function someTimeLater() 10 video.onerror = t.unreached_func();
11 { 11 // Network state should remain in NETWORK_EMPTY with missing "src" attribute .
12 testExpected("state", "load() with missing 'src'"); 12 verifyVideoState();
13 testExpected("videos[0].error", null); 13 video.load();
14 testExpected("videos[0].networkState", HTMLMediaElement.NETWORK_ EMPTY);
15 testExpected("videos[0].src", "");
16 endTest();
17 }
18 14
19 function errorEvent() 15 setTimeout(t.step_func_done(function() {
20 { 16 verifyVideoState();
21 failTest("<br><i>***'error' event fired***<" + "/i>"); 17 }), 100);
22 }
23 18
24 function test() 19 function verifyVideoState() {
25 { 20 assert_equals(video.error, null);
26 videos = document.querySelectorAll('video'); 21 assert_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);
27 22 assert_equals(video.src, "");
28 consoleWrite("<br><i>Network state should remain in NETWORK_EMPT Y with missing 'src' attribute.<" + "/i>"); 23 }
29 consoleWrite("** &lt;video&gt; with no src attribute**"); 24 });
30 testExpected("videos[0].error", null); 25 </script>
31 testExpected("videos[0].networkState", HTMLMediaElement.NETWORK_ EMPTY);
32 testExpected("videos[0].src", "");
33
34 consoleWrite("<br><i>Calling load() with no 'src' should NOT fir e 'error' event, set network state to NETWORK_EMPTY.<" + "/i>");
35 state = "load() with missing 'src'";
36 videos[0].load();
37
38 setTimeout(someTimeLater, 100) ;
39 }
40 </script>
41 </head>
42
43 <body onload="setTimeout(test, 100)">
44 <video width=320 height=60 controls onerror="errorEvent()"></video>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698