| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 <!doctype html> | 
|  | 2 <html> | 
|  | 3     <head> | 
|  | 4         <title>Test that the overlay cast button fades at the right time (neithe
    r too soon nor too late).</title> | 
|  | 5         <script src="../resources/testharness.js"></script> | 
|  | 6         <script src="../resources/testharnessreport.js"></script> | 
|  | 7         <script src="media-file.js"></script> | 
|  | 8         <script src="media-controls.js"></script> | 
|  | 9         <script src="video-test.js"></script> | 
|  | 10     </head> | 
|  | 11     <body> | 
|  | 12         <video loop></video> | 
|  | 13         <script> | 
|  | 14         var controls; | 
|  | 15         var test; | 
|  | 16         // The cast button should be visible for at least the controlsMouseMovem
    entTimeout, and no more | 
|  | 17         // than that plus the fadeout time. Allow 500ms margin at either side. | 
|  | 18         var hideTimeoutLowerBound = controlsMouseMovementTimeoutMs - 500; | 
|  | 19         var hideTimeoutUpperBound = controlsMouseMovementTimeoutMs + controlsFad
    eOutDurationMs + 500; | 
|  | 20         function overlayCastButton(element) | 
|  | 21         { | 
|  | 22             var controlID = "-internal-media-controls-overlay-cast-button"; | 
|  | 23             var button = mediaControlsElement(window.internals.shadowRoot(elemen
    t).firstChild, controlID); | 
|  | 24             return button; | 
|  | 25         } | 
|  | 26         async_test(function(t) | 
|  | 27         { | 
|  | 28             findMediaElement(); | 
|  | 29             video.src = findMediaFile("video", "content/test"); | 
|  | 30             video.addEventListener("playing", t.step_func(function() | 
|  | 31             { | 
|  | 32                 setTimeout(t.step_func(function() | 
|  | 33                 { | 
|  | 34                     button = overlayCastButton(video); | 
|  | 35                     // Now should have cast button | 
|  | 36                     style = window.getComputedStyle(button); | 
|  | 37                     visibility = style.getPropertyValue("visibility"); | 
|  | 38                     display = style.getPropertyValue("display"); | 
|  | 39                     assert_true(((display != "none")) && (visibility == "visible
    "), | 
|  | 40                             "button should exist, display = \"" + display + '\"'
    ); | 
|  | 41                 }), hideTimeoutLowerBound); | 
|  | 42                 setTimeout(t.step_func(function() | 
|  | 43                 { | 
|  | 44                     button = overlayCastButton(video); | 
|  | 45                     // Cast button shoud be gone | 
|  | 46                     style = window.getComputedStyle(button); | 
|  | 47                     visibility = style.getPropertyValue("visibility"); | 
|  | 48                     display = style.getPropertyValue("display"); | 
|  | 49                     assert_false(((display != "none")) && (visibility == "visibl
    e"), | 
|  | 50                             "button should not exist, display = \"" + display + 
    '\"'); | 
|  | 51                     t.done(); | 
|  | 52                 }), hideTimeoutUpperBound); | 
|  | 53             })); | 
|  | 54             internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); | 
|  | 55             video.play(); | 
|  | 56         }); | 
|  | 57         </script> | 
|  | 58     </body> | 
|  | 59 </html> | 
| OLD | NEW | 
|---|