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

Side by Side Diff: third_party/WebKit/LayoutTests/media/controls-cast-overlay-slow-fade.html

Issue 2016323003: Convert controls-cast-* 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 <!doctype html> 1 <!doctype html>
2 <html> 2 <title>Test that the overlay cast button fades at the right time (neither too so on nor too late).</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <title>Test that the overlay cast button fades at the right time (neithe r too soon nor too late).</title> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="../resources/testharness.js"></script> 5 <script src="media-file.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="media-controls.js"></script>
7 <script src="media-file.js"></script> 7 <video loop></video>
8 <script src="media-controls.js"></script> 8 <script>
9 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 9 async_test(function(t)
10 (Please avoid writing new tests using video-test.js) --> 10 {
11 <script src="video-test.js"></script> 11 // The cast button should be visible for at least the controlsMouseMovementT imeout,
12 </head> 12 // and no more than that plus the fadeout time. Allow 500ms margin at either side.
13 <body> 13 var hideTimeoutLowerBound = controlsMouseMovementTimeoutMs - 500;
14 <video loop></video> 14 var hideTimeoutUpperBound = controlsMouseMovementTimeoutMs + controlsFadeOut DurationMs + 500;
15 <script> 15
16 var controls; 16 var video = document.querySelector("video");
17 var test; 17 video.src = findMediaFile("video", "content/test");
18 // The cast button should be visible for at least the controlsMouseMovem entTimeout, and no more 18
19 // than that plus the fadeout time. Allow 500ms margin at either side. 19 video.onplaying = t.step_func(function()
20 var hideTimeoutLowerBound = controlsMouseMovementTimeoutMs - 500; 20 {
21 var hideTimeoutUpperBound = controlsMouseMovementTimeoutMs + controlsFad eOutDurationMs + 500; 21 setTimeout(t.step_func(function()
22 function overlayCastButton(element)
23 { 22 {
24 var controlID = "-internal-media-controls-overlay-cast-button"; 23 // Cast button shoud be visible
fs 2016/05/27 14:30:06 Nit: Typo "should" (not new, but since we're essen
Srirama 2016/05/27 16:49:57 Done.
25 var button = mediaControlsElement(window.internals.shadowRoot(elemen t).firstChild, controlID); 24 assert_true(isCastButtonVisible(), "button should exist");
26 return button; 25 }), hideTimeoutLowerBound);
26
27 setTimeout(t.step_func_done(function()
28 {
29 // Cast button shoud be gone
fs 2016/05/27 14:30:06 Ditto.
Srirama 2016/05/27 16:49:57 Done.
30 assert_false(isCastButtonVisible(), "button should not exist");
31 }), hideTimeoutUpperBound);
32
33 function isCastButtonVisible()
34 {
35 var button = overlayCastButton(video);
36 var style = getComputedStyle(button);
37 var visibility = style.getPropertyValue("visibility");
38 var display = style.getPropertyValue("display");
39 return (display != "none" && visibility == "visible");
40
fs 2016/05/27 14:30:06 Stray blank line.
Srirama 2016/05/27 16:49:57 Done.
27 } 41 }
28 async_test(function(t) 42 });
29 { 43
30 findMediaElement(); 44 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
31 video.src = findMediaFile("video", "content/test"); 45 video.play();
32 video.addEventListener("playing", t.step_func(function() 46
33 { 47 function overlayCastButton(element)
34 setTimeout(t.step_func(function() 48 {
35 { 49 var controlID = "-internal-media-controls-overlay-cast-button";
36 button = overlayCastButton(video); 50 var button = mediaControlsElement(window.internals.shadowRoot(element).f irstChild, controlID);
37 // Now should have cast button 51 return button;
38 style = window.getComputedStyle(button); 52 }
39 visibility = style.getPropertyValue("visibility"); 53 });
40 display = style.getPropertyValue("display"); 54 </script>
41 assert_true(((display != "none")) && (visibility == "visible "),
42 "button should exist, display = \"" + display + '\"' );
43 }), hideTimeoutLowerBound);
44 setTimeout(t.step_func(function()
45 {
46 button = overlayCastButton(video);
47 // Cast button shoud be gone
48 style = window.getComputedStyle(button);
49 visibility = style.getPropertyValue("visibility");
50 display = style.getPropertyValue("display");
51 assert_false(((display != "none")) && (visibility == "visibl e"),
52 "button should not exist, display = \"" + display + '\"');
53 t.done();
54 }), hideTimeoutUpperBound);
55 }));
56 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
57 video.play();
58 });
59 </script>
60 </body>
61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698