Changeset 86534 in webkit


Ignore:
Timestamp:
May 16, 2011 12:01:28 AM (13 years ago)
Author:
Philippe Normand
Message:

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

Reviewed by Darin Adler.

Move mediaControlsButtonCoordinates() out of video-test.js
https://bugs.webkit.org/show_bug.cgi?id=60693

Moved the function to a new js file called media-controls.js. Also
made the function throw an exception if the button is not found
and handle the exception in the various tests using the function.

  • media/audio-delete-while-step-button-clicked.html:
  • media/media-controls.js: Added. (mediaControlsButtonCoordinates):
  • media/video-controls-transformed.html:
  • media/video-controls-visible-audio-only.html:
  • media/video-controls-zoomed.html:
  • media/video-test.js: (isInTimeRanges):
Location:
trunk/LayoutTests
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86527 r86534  
     12011-05-12  Philippe Normand  <pnormand@igalia.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Move mediaControlsButtonCoordinates() out of video-test.js
     6        https://bugs.webkit.org/show_bug.cgi?id=60693
     7
     8        Moved the function to a new js file called media-controls.js. Also
     9        made the function throw an exception if the button is not found
     10        and handle the exception in the various tests using the function.
     11
     12        * media/audio-delete-while-step-button-clicked.html:
     13        * media/media-controls.js: Added.
     14        (mediaControlsButtonCoordinates):
     15        * media/video-controls-transformed.html:
     16        * media/video-controls-visible-audio-only.html:
     17        * media/video-controls-zoomed.html:
     18        * media/video-test.js:
     19        (isInTimeRanges):
     20
    1212011-05-15  MORITA Hajime  <morrita@google.com>
    222
  • trunk/LayoutTests/media/audio-delete-while-step-button-clicked.html

    r85934 r86534  
    44        <script src=media-file.js></script>
    55        <script src=video-test.js></script>
     6        <script src=media-controls.js></script>
     7
    68        <script>
    79            if (window.layoutTestController) {
     
    5254                var audio = document.getElementById('audio');
    5355
    54                 var seekCoords = mediaControlsButtonCoordinates(audio, "seek-forward-button");
     56                try {
     57                    var seekCoords = mediaControlsButtonCoordinates(audio, "seek-forward-button");
     58                } catch (exception) {
     59                    failTest(exception.description);
     60                }
    5561                var x = seekCoords[0];
    5662                var y = seekCoords[1];
  • trunk/LayoutTests/media/video-controls-transformed.html

    r85934 r86534  
    1515    <script src=media-file.js></script>
    1616    <script src=video-test.js></script>
     17    <script src=media-controls.js></script>
    1718    <script>
    1819        testExpected("video.controls", null, '!=');
     
    2021            if (window.eventSender) {
    2122                // Find the play button and click the middle of its bounding box.
    22                 var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     23                try {
     24                    var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     25                } catch (exception) {
     26                    failTest(exception.description);
     27                }
    2328                var clickX = playCoords[0];
    2429                var clickY = playCoords[1];
  • trunk/LayoutTests/media/video-controls-visible-audio-only.html

    r85934 r86534  
    77        </style>
    88        <script src=media-file.js></script>
    9         <script src=video-test.js></script>
     9        <script src=media-controls.js></script>
    1010        <script>
    1111            if (window.layoutTestController) {
     
    3939
    4040                // start playback
    41                 var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     41                try {
     42                    var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     43                } catch (exception) {
     44                    consoleWrite(exception.description);
     45                    layoutTestController.notifyDone();
     46                }
    4247                var clickX = playCoords[0];
    4348                var clickY = playCoords[1];
  • trunk/LayoutTests/media/video-controls-zoomed.html

    r85934 r86534  
    88  </style>
    99  <script src=media-file.js></script>
     10  <script src=media-controls.js></script>
    1011  <script type="text/javascript" charset="utf-8">
    1112    function runTest()
     
    2122        {
    2223            // Find the play button and click the middle of its bounding box.
    23             var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     24            try {
     25                var playCoords = mediaControlsButtonCoordinates(video, "play-button");
     26            } catch (exception) {
     27                failTest(exception.description);
     28            }
    2429            var clickX = playCoords[0];
    2530            var clickY = playCoords[1];
  • trunk/LayoutTests/media/video-test.js

    r85934 r86534  
    236236    return false;
    237237}
    238 
    239 function 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 }
Note: See TracChangeset for help on using the changeset viewer.