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

Side by Side Diff: third_party/WebKit/LayoutTests/media/media-load-event.html

Issue 2043473002: Convert media-ended*, media-extension* and media-load* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 <html> 1 <!DOCTYPE html>
2 <head> 2 <title>Test that media file is not reloaded when an element is inserted into the DOM.</title>
3 <script src=media-file.js></script> 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 <script src="media-file.js"></script>
6 <script src=video-test.js></script> 6 <div id="parent"></div>
7 <script>
8 async_test(function(t) {
9 var audio = document.createElement("audio");
7 10
8 <script> 11 audio.oncanplaythrough = t.step_func(function() {
12 audio.onloadstart = t.unreached_func("Should not fire 'loadstart' event" );
13 document.getElementById("parent").appendChild(audio);
14 audio.play();
15 });
9 16
10 function playing() 17 audio.onplaying = t.step_func_done();
11 { 18 audio.onloadstart = t.step_func(function() {});
12 consoleWrite("EVENT(playing)<br>"); 19 audio.ondurationchange = t.step_func(function() {});
13 endTest(); 20 audio.onplay = t.step_func(function() {});
14 } 21 audio.onloadeddata = t.step_func(function() {});
15 22
16 function canplaythrough() 23 audio.src = findMediaFile("audio", "content/test");
17 { 24 audio.load();
18 consoleWrite("EVENT(canplaythrough)"); 25 })
19 consoleWrite(""); 26 </script>
20 run("document.getElementById('parent').appendChild(mediaElement) ");
21 run("mediaElement.play()");
22 consoleWrite("");
23 }
24
25 function start()
26 {
27 run("mediaElement = document.createElement('audio')");
28
29 mediaElement.setAttribute('oncanplaythrough', "canplaythrough()" );
30 mediaElement.setAttribute('onplaying', "playing()");
31
32 waitForEvent("loadstart");
33 waitForEvent("waiting");
34 waitForEvent("ratechange");
35 waitForEvent("durationchange");
36 waitForEvent("pause");
37 waitForEvent("play");
38 waitForEvent("canplaythrough");
39 waitForEvent('loadeddata');
40
41 var mediaFile = findMediaFile("audio", "content/test");
42 run("mediaElement.src = '" + mediaFile + "'");
43 run("mediaElement.load()");
44
45 consoleWrite("");
46 }
47
48 </script>
49 </head>
50
51 <body onload="start()">
52
53 <p>Test that media file is not reloaded when an element is inserted into the DOM.</p>
54
55 <div id="parent"></div>
56
57 </body>
58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698