Title: [236751] trunk/Tools
Revision
236751
Author
dba...@webkit.org
Date
2018-10-02 10:49:41 -0700 (Tue, 02 Oct 2018)

Log Message

Fix iOS TestWebKitAPI failures following <https://trac.webkit.org/changeset/236619>
(https://bugs.webkit.org/show_bug.cgi?id=190017)

For now swizzle +[UIKeyboard isInHardwareKeyboardMode] to return NO in the following tests:
    WKWebViewAutofillTests.AutofillRequiresInputSession
    DragAndDropTests.ExternalSourceJPEGOnly
    DragAndDropTests.ExternalSourceUTF8PlainTextOnly

so that the presence of a hardware keyboad does not effect their results. In <https://bugs.webkit.org/show_bug.cgi?id=190211>
we will look to swizzle this method for all test by default.

* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::overrideIsInHardwareKeyboardMode):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:
(TestWebKitAPI::overrideIsInHardwareKeyboardMode):
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/UIKitSPI.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (236750 => 236751)


--- trunk/Tools/ChangeLog	2018-10-02 17:36:05 UTC (rev 236750)
+++ trunk/Tools/ChangeLog	2018-10-02 17:49:41 UTC (rev 236751)
@@ -1,3 +1,24 @@
+2018-10-02  Daniel Bates  <daba...@apple.com>
+
+        Fix iOS TestWebKitAPI failures following <https://trac.webkit.org/changeset/236619>
+        (https://bugs.webkit.org/show_bug.cgi?id=190017)
+
+        For now swizzle +[UIKeyboard isInHardwareKeyboardMode] to return NO in the following tests:
+            WKWebViewAutofillTests.AutofillRequiresInputSession
+            DragAndDropTests.ExternalSourceJPEGOnly
+            DragAndDropTests.ExternalSourceUTF8PlainTextOnly
+
+        so that the presence of a hardware keyboad does not effect their results. In <https://bugs.webkit.org/show_bug.cgi?id=190211>
+        we will look to swizzle this method for all test by default.
+
+        * TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
+        (TestWebKitAPI::overrideIsInHardwareKeyboardMode):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:
+        (TestWebKitAPI::overrideIsInHardwareKeyboardMode):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/ios/UIKitSPI.h:
+
 2018-10-01  Dean Jackson  <d...@apple.com>
 
         Remove CSS Animation Triggers

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm (236750 => 236751)


--- trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm	2018-10-02 17:36:05 UTC (rev 236750)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm	2018-10-02 17:49:41 UTC (rev 236751)
@@ -27,6 +27,7 @@
 
 #if ENABLE(DRAG_SUPPORT) && PLATFORM(IOS) && WK_API_ENABLED
 
+#import "ClassMethodSwizzler.h"
 #import "DragAndDropSimulator.h"
 #import "PlatformUtilities.h"
 #import "TestWKWebView.h"
@@ -907,8 +908,15 @@
     EXPECT_TRUE([webView editorContainsImageElement]);
 }
 
+static BOOL overrideIsInHardwareKeyboardMode()
+{
+    return NO;
+}
+
 TEST(DragAndDropTests, ExternalSourceUTF8PlainTextOnly)
 {
+    ClassMethodSwizzler swizzler([UIKeyboard class], @selector(isInHardwareKeyboardMode), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
+
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
 
@@ -928,6 +936,8 @@
 
 TEST(DragAndDropTests, ExternalSourceJPEGOnly)
 {
+    ClassMethodSwizzler swizzler([UIKeyboard class], @selector(isInHardwareKeyboardMode), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
+
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
 

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm (236750 => 236751)


--- trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm	2018-10-02 17:36:05 UTC (rev 236750)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm	2018-10-02 17:49:41 UTC (rev 236751)
@@ -27,6 +27,7 @@
 
 #if WK_API_ENABLED && PLATFORM(IOS)
 
+#import "ClassMethodSwizzler.h"
 #import "PlatformUtilities.h"
 #import "TestInputDelegate.h"
 #import "TestWKWebView.h"
@@ -164,8 +165,15 @@
     EXPECT_FALSE([webView textInputHasAutofillContext]);
 }
 
+static BOOL overrideIsInHardwareKeyboardMode()
+{
+    return NO;
+}
+
 TEST(WKWebViewAutofillTests, AutofillRequiresInputSession)
 {
+    ClassMethodSwizzler swizzler([UIKeyboard class], @selector(isInHardwareKeyboardMode), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
+
     auto webView = adoptNS([[AutofillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [(TestInputDelegate *)[webView _inputDelegate] setFocusStartsInputSessionPolicyHandler:[] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy {
         return _WKFocusStartsInputSessionPolicyAuto;

Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (236750 => 236751)


--- trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h	2018-10-02 17:36:05 UTC (rev 236750)
+++ trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h	2018-10-02 17:49:41 UTC (rev 236751)
@@ -30,6 +30,7 @@
 #if USE(APPLE_INTERNAL_SDK)
 
 #import <UIKit/UIApplication_Private.h>
+#import <UIKit/UIKeyboard_Private.h>
 #import <UIKit/UIResponder_Private.h>
 #import <UIKit/UITextInputMultiDocument.h>
 #import <UIKit/UITextInputTraits_Private.h>
@@ -160,4 +161,8 @@
 - (UIResponder *)firstResponder;
 @end
 
+@interface UIKeyboard ()
++ (BOOL)isInHardwareKeyboardMode;
+@end
+
 #endif // PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to