OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Overflow menu children appear in correct order.</title> | 2 <title>Overflow menu children appear in correct order.</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 | 8 |
9 <!--Padding ensures the overflow menu is visible for the tests. --> | 9 <!--Padding ensures the overflow menu is visible for the tests. --> |
10 <body style="padding-top: 200px; padding-left: 100px"> | 10 <body style="padding-top: 200px; padding-left: 100px"> |
11 <video controls></video> | 11 <video controls></video> |
12 <script> | 12 <script> |
13 async_test(function(t) { | 13 async_test(function(t) { |
14 // Set up video | 14 // Set up video |
15 var video = document.querySelector("video"); | 15 var video = document.querySelector("video"); |
16 video.src = findMediaFile("video", "content/test"); | 16 video.src = findMediaFile("video", "content/test"); |
17 video.setAttribute("width", "60"); | 17 video.setAttribute("width", "60"); |
18 // Add captions | 18 // Add captions |
19 var track = video.addTextTrack("captions"); | 19 var track = video.addTextTrack("captions"); |
20 // Pretend we have a cast device | 20 // Pretend we have a cast device |
21 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); | 21 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); |
22 | 22 |
23 video.onloadeddata = t.step_func_done(function() { | 23 video.onloadeddata = t.step_func_done(function() { |
24 var overflowList = getOverflowList(video); | 24 var overflowList = getOverflowList(video); |
25 var children = overflowList.children; | 25 var children = overflowList.children; |
26 | 26 |
27 // The overflow menu should always have the same number of elements. | 27 // The overflow menu should always have the same number of elements. |
28 // Their visibility will change over time based on the size of the video. | 28 // Their visibility will change over time based on the size of the video. |
29 assert_equals(children.length, 5); | 29 assert_equals(children.length, 6); |
30 | 30 |
31 // Ensure that all of the buttons are visible in the right order | 31 // Ensure that all of the buttons are visible in the right order |
32 for (var i = 0; i < children.length; i++) { | 32 for (var i = 0; i < children.length; i++) { |
33 var child = children[i]; | 33 var child = children[i]; |
34 var innerButton = child.children[0]; | 34 var innerButton = child.children[0]; |
35 assert_equals(internals.shadowPseudoId(child), "-internal-media-controls-o
verflow-menu-list-item"); | 35 assert_equals(internals.shadowPseudoId(child), "-internal-media-controls-o
verflow-menu-list-item"); |
36 assert_equals(internals.shadowPseudoId(innerButton), overflowButtonsCSS[i]
); | 36 assert_equals(internals.shadowPseudoId(innerButton), overflowButtonsCSS[i]
); |
37 // Items should be visible | 37 // Items should be visible |
38 assert_not_equals(getComputedStyle(child).display, "none"); | 38 assert_not_equals(getComputedStyle(child).display, "none"); |
39 // Buttons shouldn't be visible | 39 // Buttons shouldn't be visible |
40 assert_equals(getComputedStyle(innerButton).display, "none"); | 40 assert_equals(getComputedStyle(innerButton).display, "none"); |
41 } | 41 } |
42 }); | 42 }); |
43 }); | 43 }); |
44 </script> | 44 </script> |
45 </body> | 45 </body> |
OLD | NEW |