Changeset 85934 in webkit


Ignore:
Timestamp:
May 6, 2011 1:00:43 AM (13 years ago)
Author:
Philippe Normand
Message:

2011-05-03 Philippe Normand <pnormand@igalia.com>

Reviewed by Martin Robinson.

Layout tests shouldn't have to hard code media controller element locations
https://bugs.webkit.org/show_bug.cgi?id=28220

New mediaControlsButtonCoordinates() function to get the middle
coordinates of a media controls button. This avoids hardcoding
positions in the tests.

Also unskipped the affected GTK media tests now passing.

  • media/audio-delete-while-step-button-clicked.html:
  • media/video-controls-transformed.html:
  • media/video-controls-zoomed.html:
  • media/video-test.js: (mediaControlsButtonCoordinates):
  • platform/gtk/Skipped:
Location:
trunk/LayoutTests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85932 r85934  
     12011-05-03  Philippe Normand  <pnormand@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        Layout tests shouldn't have to hard code media controller element locations
     6        https://bugs.webkit.org/show_bug.cgi?id=28220
     7
     8        New mediaControlsButtonCoordinates() function to get the middle
     9        coordinates of a media controls button. This avoids hardcoding
     10        positions in the tests.
     11
     12        Also unskipped the affected GTK media tests now passing.
     13
     14        * media/audio-delete-while-step-button-clicked.html:
     15        * media/video-controls-transformed.html:
     16        * media/video-controls-zoomed.html:
     17        * media/video-test.js:
     18        (mediaControlsButtonCoordinates):
     19        * platform/gtk/Skipped:
     20
    1212011-05-06  MORITA Hajime  <morrita@google.com>
    222
  • trunk/LayoutTests/media/audio-delete-while-step-button-clicked.html

    r79630 r85934  
    33    <head>
    44        <script src=media-file.js></script>
     5        <script src=video-test.js></script>
    56        <script>
    67            if (window.layoutTestController) {
     
    5152                var audio = document.getElementById('audio');
    5253
    53                 var right = audio.offsetLeft + audio.offsetWidth;
    54                 var bottom = audio.offsetTop + audio.offsetHeight;
    55                
    56                 var x = right - 8;
    57                 var y = bottom - 8;
     54                var seekCoords = mediaControlsButtonCoordinates(audio, "seek-forward-button");
     55                var x = seekCoords[0];
     56                var y = seekCoords[1];
    5857
    5958                // step forward, should generate a timeupdate event
  • trunk/LayoutTests/media/video-controls-transformed.html

    r85925 r85934  
    2020            if (window.eventSender) {
    2121                // Find the play button and click the middle of its bounding box.
    22                 var playButton;
    23                 var controlsShadow = layoutTestController.shadowRoot(video).firstChild.firstChild;
    24                 for (child = controlsShadow.firstChild; child; child = child.nextSibling) {
    25                      if (layoutTestController.shadowPseudoId(child) == "-webkit-media-controls-play-button") {
    26                          playButton = child;
    27                          break;
    28                      }
    29                 }
    30 
    31                 if (!playButton) {
    32                     failTest("Failed to find play/pause button.");
    33                 }
    34                 var playButtonBoundingRect = playButton.getBoundingClientRect();
    35                 var clickX = playButtonBoundingRect.left + playButtonBoundingRect.width / 2;
    36                 var clickY = playButtonBoundingRect.top + playButtonBoundingRect.height / 2;
     22                var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     23                var clickX = playCoords[0];
     24                var clickY = playCoords[1];
    3725                eventSender.mouseMoveTo(clickX, clickY);
    3826                eventSender.mouseDown();
  • trunk/LayoutTests/media/video-controls-visible-audio-only.html

    r79630 r85934  
    77        </style>
    88        <script src=media-file.js></script>
     9        <script src=video-test.js></script>
    910        <script>
    1011            if (window.layoutTestController) {
     
    3233            {
    3334                video = document.getElementById("no-video-media");
    34                 var left = video.offsetLeft;
    35                 var bottom = video.offsetTop + video.offsetHeight;
    3635
    3736                testcondition("video.paused");
     
    4039
    4140                // start playback
    42                 eventSender.mouseMoveTo(left + 8, bottom - 8);
     41                var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     42                var clickX = playCoords[0];
     43                var clickY = playCoords[1];
     44                eventSender.mouseMoveTo(clickX, clickY);
    4345                eventSender.mouseDown();
    4446                eventSender.mouseUp();
  • trunk/LayoutTests/media/video-controls-zoomed.html

    r79630 r85934  
    1313      window.setTimeout(function() {
    1414        document.documentElement.style.zoom = '150%';
    15         if (window.eventSender)
     15        video.addEventListener("playing", function() {
     16            testExpected("video.paused", false);
     17            endTest();
     18        });
     19
     20        if (window.eventSender)
    1621        {
    17             eventSender.mouseMoveTo(120,432); // over play button
     22            // Find the play button and click the middle of its bounding box.
     23            var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     24            var clickX = playCoords[0];
     25            var clickY = playCoords[1];
     26
     27            // Apply the page zoom value to the coordinates because
     28            // getBoundingClientRect() used in
     29            // mediaControlsButtonCoordinates() doesn't do it.
     30            clickX = clickX * 1.5;
     31            clickY = clickY * 1.5;
     32
     33            eventSender.mouseMoveTo(clickX, clickY);
    1834            eventSender.mouseDown();
    1935            eventSender.mouseUp();
    2036        }
    21         testExpected("video.paused", false);
    22         endTest();
    2337      }, 50);
    2438    }
  • trunk/LayoutTests/media/video-test.js

    r79949 r85934  
    236236    return false;
    237237}
     238
     239function mediaControlsButtonCoordinates(element, id)
     240{
     241    var button;
     242    var controlsShadow = layoutTestController.shadowRoot(element).firstChild.firstChild;
     243    for (child = controlsShadow.firstChild; child; child = child.nextSibling) {
     244        if (layoutTestController.shadowPseudoId(child) == "-webkit-media-controls-" + id) {
     245            button = child;
     246            break;
     247        }
     248    }
     249
     250    if (!button)
     251        failTest("Failed to find " + id + " button.");
     252
     253    var buttonBoundingRect = button.getBoundingClientRect();
     254    var x = buttonBoundingRect.left + buttonBoundingRect.width / 2;
     255    var y = buttonBoundingRect.top + buttonBoundingRect.height / 2;
     256    return new Array(x, y);
     257}
  • trunk/LayoutTests/platform/gtk/Skipped

    r85784 r85934  
    565565# Tests in media/ directory
    566566#   Tests failing
    567 media/video-controls-zoomed.html
    568567media/video-size-intrinsic-scale.html
    569568media/video-seek-past-end-playing.html
     
    640639http/tests/security/mixedContent/insecure-plugin-in-iframe.html
    641640http/tests/loading/basic-auth-resend-wrong-credentials.html
    642 
    643 # https://bugs.webkit.org/show_bug.cgi?id=30680
    644 media/audio-delete-while-step-button-clicked.html
    645641
    646642# https://bugs.webkit.org/show_bug.cgi?id=30620
Note: See TracChangeset for help on using the changeset viewer.