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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html

Issue 2179483002: Convert video-cookie* and video-error* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use EventWatcher to simplify the test 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 "abort" event.</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <title>'abort' event test</title> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src=../../media-resources/media-file.js></script> 5 <script src="../../media-resources/media-file.js"></script>
6 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 6 <video></video>
7 (Please avoid writing new tests using video-test.js) --> 7 <script>
8 <script src=../../media-resources/video-test.js></script> 8 async_test(function(t) {
9 <script> 9 var video = document.querySelector("video");
10 var didLoad = false; 10 // Test before movie is open.
11 assert_equals(video.error, null);
12 video.onerror = t.unreached_func();
11 13
12 function loadstart() 14 var watcher = new EventWatcher(t, video, ["loadstart", "abort", "canplaythro ugh"]);
13 { 15 watcher.wait_for("loadstart").then(t.step_func(function() {
14 consoleWrite("<br><b><em>'loadstart'</em> event</b>"); 16 assert_equals(video.error, null);
15 testExpected("video.error", null); 17 video.load();
18 return watcher.wait_for("abort");
19 })).then(t.step_func(function() {
20 assert_equals(video.error, null);
21 return watcher.wait_for("loadstart");
22 })).then(t.step_func(function() {
23 assert_equals(video.error, null);
24 return watcher.wait_for("canplaythrough");
25 })).then(t.step_func_done(function() {
26 assert_equals(video.error, null);
27 }));
16 28
17 if (didLoad) 29 var movie = findMediaFile("video", "../resources/test");
18 return; 30 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + m ovie + "&throttle=256";
19 didLoad = true; 31 });
20 32 </script>
21 // Force the element to reload, while the current movie is still loading,
22 // this should generate an 'abort' event
23 run("video.load()");
24 }
25
26 function abort()
27 {
28 consoleWrite("<br><b><em>'abort'</em> event</b>");
29 testExpected("video.error", null);
30
31 // Progress events have a 'lengthComputable' field, check to mak e sure this event
32 // doesn't have one.
33 testExpected("event.lengthComputable", undefined);
34 }
35
36 function canplaythrough()
37 {
38 consoleWrite("<br><b><em>'canplaythrough'</em> event</b>");
39 testExpected("video.error", null);
40
41 consoleWrite("");
42 endTest();
43 }
44
45 function start()
46 {
47 findMediaElement();
48
49 waitForEvent("error");
50
51 consoleWrite("<br><b>Test before movie is open</b>");
52 testExpected("video.error", null);
53
54 var movie = findMediaFile("video", "../resources/test");
55 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cg i?name=" + movie + "&throttle=256";
56 }
57 </script>
58 </head>
59
60 <body onload="start()">
61 <video controls
62 onloadstart="loadstart()"
63 onabort="abort()"
64 oncanplaythrough="canplaythrough()"
65 ></video>
66 </body>
67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698