Changeset 128270 in webkit


Ignore:
Timestamp:
Sep 12, 2012 12:29:52 AM (12 years ago)
Author:
jochen@chromium.org
Message:

Change fast/events/popup-blocking-timers.html to generate a user action for each popup
https://bugs.webkit.org/show_bug.cgi?id=96475

Reviewed by Adam Barth.

The chromium port only allows one user gesture gated action per user
gesture.

  • fast/events/popup-blocking-timers-expected.txt:
  • fast/events/popup-blocking-timers.html:
Location:
trunk/LayoutTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128264 r128270  
     12012-09-12  Jochen Eisinger  <jochen@chromium.org>
     2
     3        Change fast/events/popup-blocking-timers.html to generate a user action for each popup
     4        https://bugs.webkit.org/show_bug.cgi?id=96475
     5
     6        Reviewed by Adam Barth.
     7
     8        The chromium port only allows one user gesture gated action per user
     9        gesture.
     10
     11        * fast/events/popup-blocking-timers-expected.txt:
     12        * fast/events/popup-blocking-timers.html:
     13
    1142012-09-11  Kent Tamura  <tkent@chromium.org>
    215
  • trunk/LayoutTests/fast/events/popup-blocking-timers-expected.txt

    r81057 r128270  
    1 Click Here
     1Click Here (6 times)
    22Test calling window.open() directly. A popup should be allowed.
    33PASS newWindow is non-null.
  • trunk/LayoutTests/fast/events/popup-blocking-timers.html

    r120792 r128270  
    55        var intervalId;
    66        var firstIntervalExecution = true;
     7        var clickNumber = 0;
    78       
    89        if (window.testRunner) {
     
    1415   
    1516        function clickHandler() {
    16             newWindow = window.open("about:blank");
    17             self.focus();
    18             debug("Test calling window.open() directly. A popup should be allowed.");
    19             shouldBeNonNull("newWindow");
    20                        
    21             setTimeout(function() {
     17            clickNumber++;
     18            if (clickNumber == 1) {
    2219                newWindow = window.open("about:blank");
    2320                self.focus();
    24                 debug("Test calling window.open() with a 0 ms delay. A popup should be allowed.")
     21                debug("Test calling window.open() directly. A popup should be allowed.");
    2522                shouldBeNonNull("newWindow");
    26             }, 0);
    27            
    28             setTimeout(function() {
    29                 newWindow = window.open("about:blank");
    30                 self.focus();
    31                 debug("Test calling window.open() with a 1000 ms delay. A popup should be allowed.")
    32                 shouldBeNonNull("newWindow");
    33             }, 1000);
    34            
    35             setTimeout(function() {
    36                 newWindow = window.open("about:blank");
    37                 self.focus();
    38                 debug("Test calling window.open() with a 1001 ms delay. A popup should not be allowed.")
    39                 shouldBeUndefined("newWindow");
    40                
    41                 if (window.testRunner)
    42                     testRunner.notifyDone();
    43             }, 1001);
    44            
    45             intervalId = setInterval(function() {
    46                 debug("Test calling window.open() in a 100 ms interval. A popup should only be allowed on the first execution of the interval.");
    47                 newWindow = window.open("about:blank");
    48                 self.focus();
    49                 if (firstIntervalExecution) {
    50                     shouldBeNonNull("newWindow");
    51                     firstIntervalExecution = false;
    52                 } else {
    53                     shouldBeUndefined("newWindow");
    54                     clearInterval(intervalId);
    55                 }
    56             }, 100);
    57            
    58             setTimeout(function() {
     23            } else if (clickNumber == 2) {
    5924                setTimeout(function() {
    6025                    newWindow = window.open("about:blank");
    6126                    self.focus();
    62                     debug("Test calling window.open() in a nested call to setTimeout(). A popup should not be allowed.")
     27                    debug("Test calling window.open() with a 0 ms delay. A popup should be allowed.")
     28                    shouldBeNonNull("newWindow");
     29                }, 0);
     30            } else if (clickNumber == 3) {
     31                intervalId = setInterval(function() {
     32                    debug("Test calling window.open() in a 100 ms interval. A popup should only be allowed on the first execution of the interval.");
     33                    newWindow = window.open("about:blank");
     34                    self.focus();
     35                    if (firstIntervalExecution) {
     36                        shouldBeNonNull("newWindow");
     37                        firstIntervalExecution = false;
     38                    } else {
     39                        shouldBeUndefined("newWindow");
     40                        clearInterval(intervalId);
     41                    }
     42                }, 100);
     43            } else if (clickNumber == 4) {
     44                setTimeout(function() {
     45                    setTimeout(function() {
     46                        newWindow = window.open("about:blank");
     47                        self.focus();
     48                        debug("Test calling window.open() in a nested call to setTimeout(). A popup should not be allowed.")
     49                        shouldBeUndefined("newWindow");
     50                    }, 0);
     51                }, 300);
     52            } else if (clickNumber == 5) {
     53                setTimeout(function() {
     54                    newWindow = window.open("about:blank");
     55                    self.focus();
     56                    debug("Test calling window.open() with a 1000 ms delay. A popup should be allowed.")
     57                    shouldBeNonNull("newWindow");
     58                }, 1000);
     59            } else if (clickNumber == 6) {
     60                setTimeout(function() {
     61                    newWindow = window.open("about:blank");
     62                    self.focus();
     63                    debug("Test calling window.open() with a 1001 ms delay. A popup should not be allowed.")
    6364                    shouldBeUndefined("newWindow");
    64                 }, 0);
    65             }, 300);
    66            
     65
     66                    if (window.testRunner)
     67                        testRunner.notifyDone();
     68                }, 1001);
     69            }
    6770            if (window.eventSender)
    6871                eventSender.leapForward(1001);
     
    7477            var buttonY = button.offsetTop + button.offsetHeight / 2;
    7578            if (window.eventSender) {
    76                 eventSender.mouseMoveTo(buttonX, buttonY);
    77                 eventSender.mouseDown();
    78                 eventSender.mouseUp();
     79                for (var i = 0; i < 6; i++) {
     80                    eventSender.mouseMoveTo(buttonX, buttonY);
     81                    eventSender.mouseDown();
     82                    eventSender.mouseUp();
     83                }
    7984            }
    8085        }       
     
    8287</head>
    8388<body onload="clickButton()">
    84     <button id="test" onclick="clickHandler()">Click Here</button>
     89    <button id="test" onclick="clickHandler()">Click Here (6 times)</button>
    8590    <div id="console"></div>
    8691</body>
Note: See TracChangeset for help on using the changeset viewer.