OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Clicking on the overflow download button should download media.</title> | 2 <title>Clicking on the overflow download button should download media.</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="media-controls.js"></script> | 5 <script src="media-controls.js"></script> |
6 <script src="media-file.js"></script> | 6 <script src="media-file.js"></script> |
7 <script src="overflow-menu.js"></script> | 7 <script src="overflow-menu.js"></script> |
8 <!--Padding ensures the overflow menu is visible for the tests. --> | 8 <!--Padding ensures the overflow menu is visible for the tests. --> |
9 <body style="padding-top: 200px; padding-left: 100px"> | 9 <body style="padding-top: 200px; padding-left: 100px"> |
10 <video controls></video> | 10 <video controls></video> |
11 <script> | 11 <script> |
12 if (window.testRunner) { | 12 if (window.testRunner) { |
13 testRunner.waitUntilExternalURLLoad(); | 13 testRunner.waitUntilExternalURLLoad(); |
14 } | 14 } |
15 async_test(function(t) { | 15 async_test(function(t) { |
16 if (window.internals) | |
17 window.internals.runtimeFlags.mediaControlsDownloadButtonEnabled = true; | |
18 // Set up video | 16 // Set up video |
19 var video = document.querySelector("video"); | 17 var video = document.querySelector("video"); |
20 video.src = findMediaFile("video", "content/test"); | 18 video.src = findMediaFile("video", "content/test"); |
21 video.setAttribute("width", "60"); | 19 video.setAttribute("width", "60"); |
22 | 20 |
23 var controlID = "-internal-download-button"; | 21 var controlID = "-internal-download-button"; |
24 var downloadButton = mediaControlsElement(internals.shadowRoot(video).firstChi
ld, controlID); | 22 var downloadButton = mediaControlsElement(internals.shadowRoot(video).firstChi
ld, controlID); |
25 | 23 |
26 video.onloadeddata = t.step_func(function() { | 24 video.onloadeddata = t.step_func(function() { |
27 var overflowList = getOverflowList(video); | 25 var overflowList = getOverflowList(video); |
28 var overflowMenu = getOverflowMenuButton(video); | 26 var overflowMenu = getOverflowMenuButton(video); |
29 | 27 |
30 // Click on the overflow menu button | 28 // Click on the overflow menu button |
31 var coords = elementCoordinates(overflowMenu); | 29 var coords = elementCoordinates(overflowMenu); |
32 clickAtCoordinates(coords[0], coords[1]); | 30 clickAtCoordinates(coords[0], coords[1]); |
33 | 31 |
34 // Click on download button | 32 // Click on download button |
35 var coords = elementCoordinates(overflowList.children[OverflowMenuButtons.DO
WNLOAD]); | 33 var coords = elementCoordinates(overflowList.children[OverflowMenuButtons.DO
WNLOAD]); |
36 clickAtCoordinates(coords[0], coords[1]); | 34 clickAtCoordinates(coords[0], coords[1]); |
37 }); | 35 }); |
38 }); | 36 }); |
39 </script> | 37 </script> |
40 </body> | 38 </body> |
OLD | NEW |