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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html

Issue 1950283002: Convert track-remove* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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>Tests that re-adding a media element to the document, having a child trac k that failed loading doesn't block video from playing.</title>
3 <head> 3 <video>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 4 <track src="captions-webvtt/tc004-no-webvtt.vtt" kind="captions" default>
5 <title>Test that video is playing after media element is re-added</title > 5 </video>
6 <script src="../media-file.js"></script>
7 <script src="../../resources/testharness.js"></script>
8 <script src="../../resources/testharnessreport.js"></script>
9 <script>
10 async_test(function(t) {
11 var video = document.querySelector('video');
12 video.src = findMediaFile('video', '../content/test');
13 video.oncanplaythrough = t.step_func(canplaythrough);
6 14
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 15 function canplaythrough() {
8 (Please avoid writing new tests using video-test.js) --> 16 video.oncanplaythrough = null;
9 <script src=../video-test.js></script> 17 var track = document.querySelector('track');
10 <script src=../media-file.js></script>
11 <script>
12 if (window.testRunner)
13 testRunner.waitUntilDone();
14 18
15 function endTest() 19 // Track should have error as ready state.
16 { 20 assert_equals(track.readyState, HTMLTrackElement.ERROR);
17 consoleWrite("<br>** Succesfully played the video **");
18 21
19 if (window.testRunner) 22 // Remove the video element from body.
20 testRunner.notifyDone(); 23 document.body.removeChild(video);
21 }
22 24
23 function canplaythrough() 25 // Reset the video src attribute to re-trigger resource selection for tr acks.
24 { 26 video.src = findMediaFile('video', '../content/test');
25 video.removeEventListener('canplaythrough', canplaythrough);
26 track = document.querySelector('track');
27 27
28 consoleWrite("** Track should have error as ready state **"); 28 // Append the video element back to the body.
29 testExpected("track.readyState == HTMLTrackElement.ERROR", true) ; 29 document.body.appendChild(video);
30 30
31 consoleWrite(""); 31 assert_equals(track.readyState, HTMLTrackElement.ERROR);
32 consoleWrite("** Remove the video element from body **");
33 document.body.removeChild(video);
34 32
35 consoleWrite("** Reset the video src attribute to re-trigger res ource selection for tracks **"); 33 video.onplaying = t.step_func_done();
36 video.src = findMediaFile('video', '../content/test'); 34 video.play();
37 35 // The video should start playing.
38 consoleWrite("** Append the video element back to the body **"); 36 }
39 document.body.appendChild(video); 37 });
40 38 </script>
41 consoleWrite("<br>** The video should start playing **");
42 testExpected("track.readyState == HTMLTrackElement.ERROR", true) ;
43
44 video.addEventListener('playing', endTest);
45 video.play();
46 }
47
48 function start()
49 {
50 video = document.getElementsByTagName('video')[0];
51 video.src = findMediaFile('video', '../content/test');
52 video.addEventListener('canplaythrough', canplaythrough);
53 }
54
55 </script>
56 </head>
57
58 <body onload="start()">
59 <p>Tests that re-adding a media element to the document, having a child track that failed
60 loading doesn't block video from playing</p>
61
62 <video width="320" height="240" controls>
63 <track src="captions-webvtt/tc004-no-webvtt.vtt" kind="captions" def ault>
64 </video>
65 </body>
66 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698