Changeset 192039 in webkit


Ignore:
Timestamp:
Nov 4, 2015 3:34:47 PM (8 years ago)
Author:
Wenson Hsieh
Message:

Fix crashing and flaky UIScriptController-based tests in fast/events/ios
https://bugs.webkit.org/show_bug.cgi?id=150901
<rdar://problem/23261499>

Reviewed by Simon Fraser.

Tools:

Clear out zooming and keyboard-related callbacks after uiScriptComplete has been invoked. This prevents
later tests from calling into code which previous tests attached to these callbacks and causing
WebKitTestRunner to crash due to accessing a deallocated UIScriptController.

  • WebKitTestRunner/UIScriptContext/UIScriptController.cpp:

(WTR::UIScriptController::platformClearAllCallbacks):
(WTR::UIScriptController::uiScriptComplete):

  • WebKitTestRunner/UIScriptContext/UIScriptController.h:
  • WebKitTestRunner/ios/UIScriptControllerIOS.mm:

(WTR::UIScriptController::platformClearAllCallbacks):

LayoutTests:

Several changes to tests in fast/events/ios that address flaky behavior when running these tests.
Removes an unnecessary (and flaky) check for the initial innerHeight in
keyboard-should-not-trigger-resize.html, refactors unscalable-viewport-clicks-on-doubletap.html to
send successive taps like the other fast-clicking tests, and adjusts input-value-after-oninput.html
to no longer break if typing in an input autocapitalizes the first letter.

  • fast/events/ios/input-value-after-oninput.html:
  • fast/events/ios/keyboard-should-not-trigger-resize-expected.txt:
  • fast/events/ios/keyboard-should-not-trigger-resize.html:
  • fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt:
  • fast/events/ios/unscalable-viewport-clicks-on-doubletap.html:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r192036 r192039  
     12015-11-04  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Fix crashing and flaky UIScriptController-based tests in fast/events/ios
     4        https://bugs.webkit.org/show_bug.cgi?id=150901
     5        <rdar://problem/23261499>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Several changes to tests in fast/events/ios that address flaky behavior when running these tests.
     10        Removes an unnecessary (and flaky) check for the initial innerHeight in
     11        keyboard-should-not-trigger-resize.html, refactors unscalable-viewport-clicks-on-doubletap.html to
     12        send successive taps like the other fast-clicking tests, and adjusts input-value-after-oninput.html
     13        to no longer break if typing in an input autocapitalizes the first letter.
     14
     15        * fast/events/ios/input-value-after-oninput.html:
     16        * fast/events/ios/keyboard-should-not-trigger-resize-expected.txt:
     17        * fast/events/ios/keyboard-should-not-trigger-resize.html:
     18        * fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt:
     19        * fast/events/ios/unscalable-viewport-clicks-on-doubletap.html:
     20
    1212015-11-04  Wenson Hsieh  <wenson_hsieh@apple.com>
    222
  • trunk/LayoutTests/fast/events/ios/input-value-after-oninput.html

    r190407 r192039  
    2525
    2626        function handleValueChanged(value) {
    27             document.getElementById("console").textContent = "Successfully handled oninput, value is now \"" + value + "\"";
     27            document.getElementById("console").textContent = "Successfully handled oninput, value is now \"" + value.toLowerCase() + "\"";
    2828            testRunner.notifyDone();
    2929        }
  • trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize-expected.txt

    r191834 r192039  
    33
    44TEST COMPLETE
    5 Before showing the keyboard, window.innerHeight = 480
    65After showing the keyboard, window.innerHeight = 480
    76After hiding the keyboard, window.innerHeight = 480
  • trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize.html

    r191834 r192039  
    99        (function() {
    1010            uiController.didShowKeyboardCallback = function() {
     11                uiController.didHideKeyboardCallback = function() {
     12                    uiController.uiScriptComplete();
     13                }
    1114                uiController.typeCharacterUsingHardwareKeyboard("a", function() { });
    12             }
    13             uiController.didHideKeyboardCallback = function() {
    14                 uiController.uiScriptComplete();
    1515            }
    1616            uiController.singleTapAtPoint(50, 25, function() {});
     
    3131        function runTest()
    3232        {
    33             debug("Before showing the keyboard, window.innerHeight = " + window.innerHeight);
    3433            if (!window.testRunner || !testRunner.runUIScript)
    3534                return;
  • trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt

    r191072 r192039  
    11
    2 Double tapping on the button should fire 2 click events.
     2Repeatedly tapping on the button should fire click events.
     3
     4This test is best run in WebKitTestRunner. If you are running this test manually, verify that tapping the button causes a "Click!" message to appear below, and that click occurred without the regular 350ms delay for double tapping.
     5
     6Click!
    37Click!
    48Click!
  • trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html

    r191072 r192039  
    77    <script id="ui-script" type="text/plain">
    88        (function() {
    9             uiController.doubleTapAtPoint(50, 50, function() {});
     9            var count = 0;
     10            function fireSuccessiveTaps() {
     11                if (count < 3)
     12                    uiController.singleTapAtPoint(50, 50, fireSuccessiveTaps);
     13                else
     14                    uiController.uiScriptComplete("");
     15
     16                count++;
     17            }
     18            fireSuccessiveTaps();
    1019        })();
    1120    </script>
    1221
    1322    <script>
     23    var scriptCompleted = false;
    1424    var clickCount = 0;
    1525    if (window.testRunner) {
     
    2434    function runTest() {
    2535        if (testRunner.runUIScript) {
    26             testRunner.runUIScript(getUIScript(), function(result) {});
     36            testRunner.runUIScript(getUIScript(), function(result) {
     37                scriptCompleted = true;
     38                if (clickCount == 3)
     39                    testRunner.notifyDone();
     40            });
    2741        }
    2842    }
     43
    2944    function handleClicked() {
    3045        clickCount++;
    3146        document.body.appendChild(document.createTextNode("Click!"));
    3247        document.body.appendChild(document.createElement("br"));
    33         if (clickCount == 2)
     48        if (clickCount == 3 && scriptCompleted)
    3449            testRunner.notifyDone();
    3550    }
     
    5065<body onload="runTest()">
    5166    <button id="target" onclick="handleClicked()"></button>
    52     <div>Double tapping on the button should fire 2 click events.</div>
     67    <p>Repeatedly tapping on the button should fire click events.</p>
     68    <p>This test is best run in WebKitTestRunner. If you are running this test manually, verify that tapping the button causes a "Click!" message to appear below, and that click occurred without the regular 350ms delay for double tapping.</p>
    5369</body>
    5470
  • trunk/Tools/ChangeLog

    r192027 r192039  
     12015-11-04  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Fix crashing and flaky UIScriptController-based tests in fast/events/ios
     4        https://bugs.webkit.org/show_bug.cgi?id=150901
     5        <rdar://problem/23261499>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Clear out zooming and keyboard-related callbacks after uiScriptComplete has been invoked. This prevents
     10        later tests from calling into code which previous tests attached to these callbacks and causing
     11        WebKitTestRunner to crash due to accessing a deallocated UIScriptController.
     12
     13        * WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
     14        (WTR::UIScriptController::platformClearAllCallbacks):
     15        (WTR::UIScriptController::uiScriptComplete):
     16        * WebKitTestRunner/UIScriptContext/UIScriptController.h:
     17        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
     18        (WTR::UIScriptController::platformClearAllCallbacks):
     19
    1202015-11-04  Jer Noble  <jer.noble@apple.com>
    221
  • trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp

    r190407 r192039  
    150150{
    151151}
     152
     153void UIScriptController::platformClearAllCallbacks()
     154{
     155}
    152156#endif
    153157
     
    155159{
    156160    m_context.uiScriptComplete(result);
     161    platformClearAllCallbacks();
    157162}
    158163
  • trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h

    r190407 r192039  
    7878    void platformSetDidShowKeyboardCallback();
    7979    void platformSetDidHideKeyboardCallback();
     80    void platformClearAllCallbacks();
    8081
    8182    virtual JSClassRef wrapperClass() override;
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

    r190407 r192039  
    158158}
    159159
     160void UIScriptController::platformClearAllCallbacks()
     161{
     162    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
     163    m_didEndZoomingCallback = 0;
     164    m_willBeginZoomingCallback = 0;
     165    m_didHideKeyboardCallback = 0;
     166    m_didShowKeyboardCallback = 0;
     167    webView.didEndZoomingCallback = nil;
     168    webView.willBeginZoomingCallback = nil;
     169    webView.didHideKeyboardCallback = nil;
     170    webView.didShowKeyboardCallback = nil;
     171}
     172
    160173}
    161174
Note: See TracChangeset for help on using the changeset viewer.