Changeset 236751 in webkit


Ignore:
Timestamp:
Oct 2, 2018 10:49:41 AM (5 years ago)
Author:
dbates@webkit.org
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:
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r236750 r236751  
     12018-10-02  Daniel Bates  <dabates@apple.com>
     2
     3        Fix iOS TestWebKitAPI failures following <https://trac.webkit.org/changeset/236619>
     4        (https://bugs.webkit.org/show_bug.cgi?id=190017)
     5
     6        For now swizzle +[UIKeyboard isInHardwareKeyboardMode] to return NO in the following tests:
     7            WKWebViewAutofillTests.AutofillRequiresInputSession
     8            DragAndDropTests.ExternalSourceJPEGOnly
     9            DragAndDropTests.ExternalSourceUTF8PlainTextOnly
     10
     11        so that the presence of a hardware keyboad does not effect their results. In <https://bugs.webkit.org/show_bug.cgi?id=190211>
     12        we will look to swizzle this method for all test by default.
     13
     14        * TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
     15        (TestWebKitAPI::overrideIsInHardwareKeyboardMode):
     16        (TestWebKitAPI::TEST):
     17        * TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm:
     18        (TestWebKitAPI::overrideIsInHardwareKeyboardMode):
     19        (TestWebKitAPI::TEST):
     20        * TestWebKitAPI/ios/UIKitSPI.h:
     21
    1222018-10-01  Dean Jackson  <dino@apple.com>
    223
  • trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm

    r235835 r236751  
    2828#if ENABLE(DRAG_SUPPORT) && PLATFORM(IOS) && WK_API_ENABLED
    2929
     30#import "ClassMethodSwizzler.h"
    3031#import "DragAndDropSimulator.h"
    3132#import "PlatformUtilities.h"
     
    908909}
    909910
     911static BOOL overrideIsInHardwareKeyboardMode()
     912{
     913    return NO;
     914}
     915
    910916TEST(DragAndDropTests, ExternalSourceUTF8PlainTextOnly)
    911917{
     918    ClassMethodSwizzler swizzler([UIKeyboard class], @selector(isInHardwareKeyboardMode), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
     919
    912920    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
    913921    [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
     
    929937TEST(DragAndDropTests, ExternalSourceJPEGOnly)
    930938{
     939    ClassMethodSwizzler swizzler([UIKeyboard class], @selector(isInHardwareKeyboardMode), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
     940
    931941    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
    932942    [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
  • trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm

    r234504 r236751  
    2828#if WK_API_ENABLED && PLATFORM(IOS)
    2929
     30#import "ClassMethodSwizzler.h"
    3031#import "PlatformUtilities.h"
    3132#import "TestInputDelegate.h"
     
    165166}
    166167
     168static BOOL overrideIsInHardwareKeyboardMode()
     169{
     170    return NO;
     171}
     172
    167173TEST(WKWebViewAutofillTests, AutofillRequiresInputSession)
    168174{
     175    ClassMethodSwizzler swizzler([UIKeyboard class], @selector(isInHardwareKeyboardMode), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
     176
    169177    auto webView = adoptNS([[AutofillTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
    170178    [(TestInputDelegate *)[webView _inputDelegate] setFocusStartsInputSessionPolicyHandler:[] (WKWebView *, id <_WKFocusedElementInfo>) -> _WKFocusStartsInputSessionPolicy {
  • trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h

    r235878 r236751  
    3131
    3232#import <UIKit/UIApplication_Private.h>
     33#import <UIKit/UIKeyboard_Private.h>
    3334#import <UIKit/UIResponder_Private.h>
    3435#import <UIKit/UITextInputMultiDocument.h>
     
    161162@end
    162163
     164@interface UIKeyboard ()
     165+ (BOOL)isInHardwareKeyboardMode;
     166@end
     167
    163168#endif // PLATFORM(IOS)
Note: See TracChangeset for help on using the changeset viewer.