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

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

Issue 2098213002: Convert video-src-[plus-source, remove, set, source].html tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 <html> 1 <!DOCTYPE html>
2 <body> 2 <title>Test that removing valid "src" attribute doesn't trigger load of "source" elements.</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 <video>
7 <div id=panel></div> 7 <source></source>
8 <script> 8 </video>
9 var panel = document.getElementById("panel"); 9 <script>
10 var mediaFile = findMediaFile("video", "content/test"); 10 async_test(function(t) {
11 panel.innerHTML = "<video src=" + mediaFile + " controls onloadedmetadat a='loadedmetadata()'><source src=content/counting.mp4></video>"; 11 var loadCount = 0;
12 </script> 12 var video = document.querySelector("video");
13 13
14 <p>Test that removing valid 'src' attribute DOES NOT trigger load of &lt;sou rce&gt; elements</p> 14 video.onloadedmetadata = t.step_func(function() {
15 15 ++loadCount;
16 <script> 16 if (loadCount == 1) {
17 findMediaElement(); 17 testSrc();
18 18 video.removeAttribute("src");
19 var loadCount = 0; 19 video.onloadedmetadata = t.unreached_func();
fs 2016/06/26 15:10:43 Because of this we should never "re-enter" this fu
Srirama 2016/06/26 18:14:03 I think the loadCount check doesn't make sense as
20
21 function testSrc()
22 {
23 testExpected("stripExtension(relativeURL(video.currentSrc))", stripE xtension(mediaFile));
24 testExpected("isNaN(video.duration)", false);
25 consoleWrite("");
26 } 20 }
27 21
28 function loadedmetadata() 22 setTimeout(t.step_func_done(function() {
29 { 23 testSrc();
30 consoleWrite("EVENT(loadedmetadata)"); 24 }), 100) ;
25 });
31 26
32 ++loadCount; 27 function testSrc() {
33 if (loadCount == 1) 28 var url = video.currentSrc;
34 { 29 assert_equals(url.substr(url.lastIndexOf("/media/")+7), mediaFile);
35 testSrc(); 30 assert_false(isNaN(video.duration));
36 run("video.removeAttribute('src')"); 31 }
37 }
38 else
39 {
40 consoleWrite("<span style='color:red'>FAIL</span> : 'loadCount' fired " + loadCount + "times" );
41 endTest();
42 }
43 consoleWrite("");
44 setTimeout(someTimeLater, 100) ;
45 }
46 32
47 function someTimeLater() 33 document.querySelector("source").src = findMediaFile("video", "content/count ing");
48 { 34 var mediaFile = findMediaFile("video", "content/test");
49 testSrc(); 35 video.src = mediaFile;
50 endTest(); 36 });
51 consoleWrite(""); 37 </script>
52 }
53
54 consoleWrite("");
55 </script>
56
57 </body>
58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698