Title: [192039] trunk
Revision
192039
Author
wenson_hs...@apple.com
Date
2015-11-04 15:34:47 -0800 (Wed, 04 Nov 2015)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192038 => 192039)


--- trunk/LayoutTests/ChangeLog	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/LayoutTests/ChangeLog	2015-11-04 23:34:47 UTC (rev 192039)
@@ -1,5 +1,25 @@
 2015-11-04  Wenson Hsieh  <wenson_hs...@apple.com>
 
+        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.
+
+        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:
+
+2015-11-04  Wenson Hsieh  <wenson_hs...@apple.com>
+
         Fix crashing fast-clicking WK2 tests on iOS
         https://bugs.webkit.org/show_bug.cgi?id=150896
         <rdar://problem/23344491>

Modified: trunk/LayoutTests/fast/events/ios/input-value-after-oninput.html (192038 => 192039)


--- trunk/LayoutTests/fast/events/ios/input-value-after-oninput.html	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/LayoutTests/fast/events/ios/input-value-after-oninput.html	2015-11-04 23:34:47 UTC (rev 192039)
@@ -24,7 +24,7 @@
         }
 
         function handleValueChanged(value) {
-            document.getElementById("console").textContent = "Successfully handled oninput, value is now \"" + value + "\"";
+            document.getElementById("console").textContent = "Successfully handled oninput, value is now \"" + value.toLowerCase() + "\"";
             testRunner.notifyDone();
         }
 

Modified: trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize-expected.txt (192038 => 192039)


--- trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize-expected.txt	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize-expected.txt	2015-11-04 23:34:47 UTC (rev 192039)
@@ -2,7 +2,6 @@
 PASS successfullyParsed is true
 
 TEST COMPLETE
-Before showing the keyboard, window.innerHeight = 480
 After showing the keyboard, window.innerHeight = 480
 After hiding the keyboard, window.innerHeight = 480
 

Modified: trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize.html (192038 => 192039)


--- trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize.html	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize.html	2015-11-04 23:34:47 UTC (rev 192039)
@@ -8,11 +8,11 @@
     <script id="ui-script" type="text/plain">
         (function() {
             uiController.didShowKeyboardCallback = function() {
+                uiController.didHideKeyboardCallback = function() {
+                    uiController.uiScriptComplete();
+                }
                 uiController.typeCharacterUsingHardwareKeyboard("a", function() { });
             }
-            uiController.didHideKeyboardCallback = function() {
-                uiController.uiScriptComplete();
-            }
             uiController.singleTapAtPoint(50, 25, function() {});
         })();
     </script>
@@ -30,7 +30,6 @@
 
         function runTest()
         {
-            debug("Before showing the keyboard, window.innerHeight = " + window.innerHeight);
             if (!window.testRunner || !testRunner.runUIScript)
                 return;
 

Modified: trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt (192038 => 192039)


--- trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt	2015-11-04 23:34:47 UTC (rev 192039)
@@ -1,5 +1,9 @@
 
-Double tapping on the button should fire 2 click events.
+Repeatedly tapping on the button should fire click events.
+
+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.
+
 Click!
 Click!
+Click!
 

Modified: trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html (192038 => 192039)


--- trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html	2015-11-04 23:34:47 UTC (rev 192039)
@@ -6,11 +6,21 @@
 <head>
     <script id="ui-script" type="text/plain">
         (function() {
-            uiController.doubleTapAtPoint(50, 50, function() {});
+            var count = 0;
+            function fireSuccessiveTaps() {
+                if (count < 3)
+                    uiController.singleTapAtPoint(50, 50, fireSuccessiveTaps);
+                else
+                    uiController.uiScriptComplete("");
+
+                count++;
+            }
+            fireSuccessiveTaps();
         })();
     </script>
 
     <script>
+    var scriptCompleted = false;
     var clickCount = 0;
     if (window.testRunner) {
         testRunner.dumpAsText();
@@ -23,14 +33,19 @@
 
     function runTest() {
         if (testRunner.runUIScript) {
-            testRunner.runUIScript(getUIScript(), function(result) {});
+            testRunner.runUIScript(getUIScript(), function(result) {
+                scriptCompleted = true;
+                if (clickCount == 3)
+                    testRunner.notifyDone();
+            });
         }
     }
+
     function handleClicked() {
         clickCount++;
         document.body.appendChild(document.createTextNode("Click!"));
         document.body.appendChild(document.createElement("br"));
-        if (clickCount == 2)
+        if (clickCount == 3 && scriptCompleted)
             testRunner.notifyDone();
     }
     </script>
@@ -49,7 +64,8 @@
 
 <body _onload_="runTest()">
     <button id="target" _onclick_="handleClicked()"></button>
-    <div>Double tapping on the button should fire 2 click events.</div>
+    <p>Repeatedly tapping on the button should fire click events.</p>
+    <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>
 </body>
 
 </html>

Modified: trunk/Tools/ChangeLog (192038 => 192039)


--- trunk/Tools/ChangeLog	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/Tools/ChangeLog	2015-11-04 23:34:47 UTC (rev 192039)
@@ -1,3 +1,22 @@
+2015-11-04  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        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.
+
+        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):
+
 2015-11-04  Jer Noble  <jer.no...@apple.com>
 
         [iOS] <video> elements without audio tracks should not interrupt music

Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp (192038 => 192039)


--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp	2015-11-04 23:34:47 UTC (rev 192039)
@@ -149,11 +149,16 @@
 void UIScriptController::platformSetDidHideKeyboardCallback()
 {
 }
+
+void UIScriptController::platformClearAllCallbacks()
+{
+}
 #endif
 
 void UIScriptController::uiScriptComplete(JSStringRef result)
 {
     m_context.uiScriptComplete(result);
+    platformClearAllCallbacks();
 }
 
 }

Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h (192038 => 192039)


--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h	2015-11-04 23:34:47 UTC (rev 192039)
@@ -77,6 +77,7 @@
     void platformSetDidEndZoomingCallback();
     void platformSetDidShowKeyboardCallback();
     void platformSetDidHideKeyboardCallback();
+    void platformClearAllCallbacks();
 
     virtual JSClassRef wrapperClass() override;
 

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (192038 => 192039)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2015-11-04 22:39:15 UTC (rev 192038)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2015-11-04 23:34:47 UTC (rev 192039)
@@ -157,6 +157,19 @@
     };
 }
 
+void UIScriptController::platformClearAllCallbacks()
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+    m_didEndZoomingCallback = 0;
+    m_willBeginZoomingCallback = 0;
+    m_didHideKeyboardCallback = 0;
+    m_didShowKeyboardCallback = 0;
+    webView.didEndZoomingCallback = nil;
+    webView.willBeginZoomingCallback = nil;
+    webView.didHideKeyboardCallback = nil;
+    webView.didShowKeyboardCallback = nil;
 }
 
+}
+
 #endif // PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to