REGRESSION (r243523): Six form-related watchOS layout tests are timing out
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Mar 2019 20:11:54 +0000 (20:11 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Mar 2019 20:11:54 +0000 (20:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196405
<rdar://problem/49428130>

Reviewed by Wenson Hsieh.

Tools:

Add a shouldPresentPopovers=false WebKitTestRunner option to cause WKTR to swizzle
the popover presentation methods to be no-ops. Use this in the new test added in
r243523 so that we do not swizzle those methods for all tests. This is needed because
those WatchOS tests rely on the popover getting presented and interactive.

* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformInitialize):
(WTR::TestController::platformResetStateToConsistentValues):

LayoutTests:

* fast/forms/ios/file-upload-panel.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243657 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/file-upload-panel.html
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestOptions.h
Tools/WebKitTestRunner/ios/TestControllerIOS.mm

index 7043d71..26814fb 100644 (file)
@@ -1,3 +1,13 @@
+2019-03-29  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION (r243523): Six form-related watchOS layout tests are timing out
+        https://bugs.webkit.org/show_bug.cgi?id=196405
+        <rdar://problem/49428130>
+
+        Reviewed by Wenson Hsieh.
+
+        * fast/forms/ios/file-upload-panel.html:
+
 2019-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         REGRESSION (r243250): Text interactions are no longer suppressed when editing in some websites
index 299540d..b22df27 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true, shouldHandleRunOpenPanel=false ] -->
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true, shouldHandleRunOpenPanel=false, shouldPresentPopovers=false ] -->
 <html>
 <head>
 <meta name="viewport" content="width=device-width">
index d140bd7..ad0a51b 100644 (file)
@@ -1,3 +1,25 @@
+2019-03-29  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION (r243523): Six form-related watchOS layout tests are timing out
+        https://bugs.webkit.org/show_bug.cgi?id=196405
+        <rdar://problem/49428130>
+
+        Reviewed by Wenson Hsieh.
+
+        Add a shouldPresentPopovers=false WebKitTestRunner option to cause WKTR to swizzle
+        the popover presentation methods to be no-ops. Use this in the new test added in
+        r243523 so that we do not swizzle those methods for all tests. This is needed because
+        those WatchOS tests rely on the popover getting presented and interactive.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::updateTestOptionsFromTestHeader):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestOptions.h:
+        (WTR::TestOptions::hasSameInitializationOptions const):
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformInitialize):
+        (WTR::TestController::platformResetStateToConsistentValues):
+
 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
 
         [Curl] Add Server Trust Evaluation Support.
index ae375d5..c61c97a 100644 (file)
@@ -1346,6 +1346,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std:
             testOptions.enableUndoManagerAPI = parseBooleanTestHeaderValue(value);
         else if (key == "shouldHandleRunOpenPanel")
             testOptions.shouldHandleRunOpenPanel = parseBooleanTestHeaderValue(value);
+        else if (key == "shouldPresentPopovers")
+            testOptions.shouldPresentPopovers = parseBooleanTestHeaderValue(value);
         else if (key == "contentInset.top")
             testOptions.contentInsetTop = std::stod(value);
         else if (key == "ignoreSynchronousMessagingTimeouts")
index 048d197..ace6a54 100644 (file)
@@ -489,6 +489,7 @@ private:
 #if PLATFORM(IOS_FAMILY)
     Vector<std::unique_ptr<InstanceMethodSwizzler>> m_inputModeSwizzlers;
     RetainPtr<UIKeyboardInputMode> m_overriddenKeyboardInputMode;
+    Vector<std::unique_ptr<InstanceMethodSwizzler>> m_presentPopoverSwizzlers;
 #endif
 
     enum State {
index 1d0aee0..4d7ea15 100644 (file)
@@ -90,6 +90,7 @@ struct TestOptions {
     bool editable { false };
     bool enableUndoManagerAPI { false };
     bool shouldHandleRunOpenPanel { true };
+    bool shouldPresentPopovers { true };
 
     double contentInsetTop { 0 };
 
@@ -138,6 +139,7 @@ struct TestOptions {
             || editable != options.editable
             || enableUndoManagerAPI != options.enableUndoManagerAPI
             || shouldHandleRunOpenPanel != options.shouldHandleRunOpenPanel
+            || shouldPresentPopovers != options.shouldPresentPopovers
             || contentInsetTop != options.contentInsetTop)
             return false;
 
index ed466be..e0fa9a5 100644 (file)
@@ -100,9 +100,6 @@ void TestController::platformInitialize()
     // Override the implementation of +[UIKeyboard isInHardwareKeyboardMode] to ensure that test runs are deterministic
     // regardless of whether a hardware keyboard is attached. We intentionally never restore the original implementation.
     method_setImplementation(class_getClassMethod([UIKeyboard class], @selector(isInHardwareKeyboardMode)), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
-
-    method_setImplementation(class_getInstanceMethod([UIViewController class], @selector(presentViewController:animated:completion:)), reinterpret_cast<IMP>(overridePresentViewControllerOrPopover));
-    method_setImplementation(class_getInstanceMethod([UIPopoverController class], @selector(presentPopoverFromRect:inView:permittedArrowDirections:animated:)), reinterpret_cast<IMP>(overridePresentViewControllerOrPopover));
 }
 
 void TestController::platformDestroy()
@@ -147,6 +144,12 @@ void TestController::platformResetStateToConsistentValues(const TestOptions& opt
 
     m_inputModeSwizzlers.clear();
     m_overriddenKeyboardInputMode = nil;
+
+    m_presentPopoverSwizzlers.clear();
+    if (!options.shouldPresentPopovers) {
+        m_presentPopoverSwizzlers.append(std::make_unique<InstanceMethodSwizzler>([UIViewController class], @selector(presentViewController:animated:completion:), reinterpret_cast<IMP>(overridePresentViewControllerOrPopover)));
+        m_presentPopoverSwizzlers.append(std::make_unique<InstanceMethodSwizzler>([UIPopoverController class], @selector(presentPopoverFromRect:inView:permittedArrowDirections:animated:), reinterpret_cast<IMP>(overridePresentViewControllerOrPopover)));
+    }
     
     BOOL shouldRestoreFirstResponder = NO;
     if (PlatformWebView* platformWebView = mainWebView()) {