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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-poster-delayed.html

Issue 2130383003: Convert video-poster* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits 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 HTML5> 1 <!DOCTYPE HTML5>
2 <title>Delayed load of poster should not overwrite intrinsic size of video.</tit le>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script>
6 <video></video>
7 <script>
8 async_test(function(t) {
9 var video = document.querySelector("video");
2 10
3 <html> 11 video.onloadeddata = t.step_func(function() {
4 <head> 12 testVideoSize();
5 <title>Delayed load of poster should not overwrite intrinsic size of vid eo</title> 13 video.poster = "content/abe.png";
6 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 14 var image = document.createElement("img");
7 (Please avoid writing new tests using video-test.js) --> 15 image.src = "content/abe.png";
8 <script src=video-test.js></script> 16 image.onload = t.step_func_done(testVideoSize);
9 <script src=media-file.js></script> 17 });
10 <style>
11 video {
12 border: 3px solid red;
13 background-color: magenta;
14 }
15 </style>
16 <script>
17 function start()
18 {
19 video = document.getElementById('video');
20 18
21 video.addEventListener("loadeddata", function(ev) { 19 function testVideoSize() {
20 assert_equals(video.clientWidth, 320);
21 assert_equals(video.clientHeight, 240);
22 assert_equals(video.videoWidth, 320);
23 assert_equals(video.videoHeight, 240);
24 }
22 25
23 consoleWrite("<br><b>Video loaded</b><br>"); 26 video.src = findMediaFile("video", "content/test");
24 27 });
25 testExpected("video.clientWidth", 320); 28 </script>
26 testExpected("video.clientHeight", 240);
27 testExpected("video.videoWidth", 320);
28 testExpected("video.videoHeight", 240);
29
30 video.poster = "content/abe.png";
31 setTimeout(testAfterLoadingPoster, 100);
32 });
33
34 video.src = findMediaFile("video", "content/test");
35 }
36
37 function testAfterLoadingPoster()
38 {
39 consoleWrite("<br><b>Poster loaded</b><br>");
40
41 testExpected("video.clientWidth", 320);
42 testExpected("video.clientHeight", 240);
43 testExpected("video.videoWidth", 320);
44 testExpected("video.videoHeight", 240);
45
46 endTest();
47 }
48 </script>
49 </head>
50
51
52 <body onload="start()">
53 <video id=video></video>
54 </body>
55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698