Title: [287343] trunk
Revision
287343
Author
[email protected]
Date
2021-12-21 20:18:57 -0800 (Tue, 21 Dec 2021)

Log Message

Re-enable ContextMenu API tests
https://bugs.webkit.org/show_bug.cgi?id=234585
Source/WebKit:

<rdar://59610140>

Reviewed by Tim Horton.

UIKit changed the internal driver interface to simulate events to show context menus for our tests.
This follows the change and makes our tests work again.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _registerPreview]):

Tools:


Reviewed by Tim Horton.

* TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm:
(TEST):
* TestWebKitAPI/cocoa/TestContextMenuDriver.h:
* TestWebKitAPI/cocoa/TestContextMenuDriver.mm:
(+[TestContextMenuDriver prefersCancelsTouchesInView]):
(-[TestContextMenuDriver cancelsTouchesInView]):
(-[TestContextMenuDriver setCancelsTouchesInView:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (287342 => 287343)


--- trunk/Source/WebKit/ChangeLog	2021-12-22 04:17:09 UTC (rev 287342)
+++ trunk/Source/WebKit/ChangeLog	2021-12-22 04:18:57 UTC (rev 287343)
@@ -1,3 +1,18 @@
+2021-12-21  Alex Christensen  <[email protected]>
+
+        Re-enable ContextMenu API tests
+        https://bugs.webkit.org/show_bug.cgi?id=234585
+        <rdar://59610140>
+
+        Reviewed by Tim Horton.
+
+        UIKit changed the internal driver interface to simulate events to show context menus for our tests.
+        This follows the change and makes our tests work again.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _registerPreview]):
+
 2021-12-21  Brady Eidson  <[email protected]>
 
         Make Notification identifiers be a UUID string instead of a uint64_t

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (287342 => 287343)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-12-22 04:17:09 UTC (rev 287342)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2021-12-22 04:18:57 UTC (rev 287343)
@@ -1388,13 +1388,9 @@
 @end
 
 @interface _UIClickPresentationInteraction (IPI)
-@property (nonatomic, strong) _UIClickInteraction *previewClickInteraction;
+@property (nonatomic, strong /*, nullable */) NSArray<id<_UIClickInteractionDriving>> *overrideDrivers;
 @end
 
-@interface _UIClickInteraction (IPI)
-@property (nonatomic, strong) id<_UIClickInteractionDriving> driver;
-@end
-
 @interface UIContextMenuInteraction (IPI)
 @property (nonatomic, strong) _UIClickPresentationInteraction *presentationInteraction;
 @end

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (287342 => 287343)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-12-22 04:17:09 UTC (rev 287342)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-12-22 04:18:57 UTC (rev 287343)
@@ -10786,11 +10786,8 @@
         _contextMenuHasRequestedLegacyData = NO;
         [self addInteraction:_contextMenuInteraction.get()];
 
-        if (id<_UIClickInteractionDriving> driver = self.webView.configuration._clickInteractionDriverForTesting) {
-            _UIClickInteraction *previewClickInteraction = [[_contextMenuInteraction presentationInteraction] previewClickInteraction];
-            [previewClickInteraction setDriver:driver];
-            [driver setDelegate:(id<_UIClickInteractionDriverDelegate>)previewClickInteraction];
-        }
+        if (id<_UIClickInteractionDriving> driver = self.webView.configuration._clickInteractionDriverForTesting)
+            [_contextMenuInteraction presentationInteraction].overrideDrivers = @[driver];
         return;
     }
 #endif

Modified: trunk/Tools/ChangeLog (287342 => 287343)


--- trunk/Tools/ChangeLog	2021-12-22 04:17:09 UTC (rev 287342)
+++ trunk/Tools/ChangeLog	2021-12-22 04:18:57 UTC (rev 287343)
@@ -1,5 +1,20 @@
 2021-12-21  Alex Christensen  <[email protected]>
 
+        Re-enable ContextMenu API tests
+        https://bugs.webkit.org/show_bug.cgi?id=234585
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm:
+        (TEST):
+        * TestWebKitAPI/cocoa/TestContextMenuDriver.h:
+        * TestWebKitAPI/cocoa/TestContextMenuDriver.mm:
+        (+[TestContextMenuDriver prefersCancelsTouchesInView]):
+        (-[TestContextMenuDriver cancelsTouchesInView]):
+        (-[TestContextMenuDriver setCancelsTouchesInView:]):
+
+2021-12-21  Alex Christensen  <[email protected]>
+
         Enable Fullscreen.LayoutConstraints API test
         https://bugs.webkit.org/show_bug.cgi?id=234576
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm (287342 => 287343)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm	2021-12-22 04:17:09 UTC (rev 287342)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm	2021-12-22 04:18:57 UTC (rev 287343)
@@ -101,12 +101,11 @@
 
 @end
 
-// FIXME: Re-enable this test once rdar://59610140 is resolved
-TEST(ContextMenu, DISABLED_Click)
+TEST(ContextMenu, Click)
 {
     auto driver = contextMenuWebViewDriver([TestContextMenuUIDelegate class]);
     [driver begin:^(BOOL result) {
-        EXPECT_TRUE(result);
+        EXPECT_FALSE(result);
         [driver clickDown];
         [driver clickUp];
     }];
@@ -117,12 +116,11 @@
     EXPECT_FALSE(didEndCalled);
 }
 
-// FIXME: Re-enable this test once rdar://59610140 is resolved
-TEST(ContextMenu, DISABLED_End)
+TEST(ContextMenu, End)
 {
     auto driver = contextMenuWebViewDriver([TestContextMenuUIDelegate class]);
     [driver begin:^(BOOL result) {
-        EXPECT_TRUE(result);
+        EXPECT_FALSE(result);
         [driver end];
     }];
     TestWebKitAPI::Util::run(&didEndCalled);
@@ -164,12 +162,11 @@
 
 @end
 
-// FIXME: Re-enable this test once rdar://59610140 is resolved
-TEST(ContextMenu, DISABLED_APIBeforeSPI)
+TEST(ContextMenu, APIBeforeSPI)
 {
     auto driver = contextMenuWebViewDriver([TestContextMenuAPIBeforeSPIUIDelegate class]);
     [driver begin:^(BOOL result) {
-        EXPECT_TRUE(result);
+        EXPECT_FALSE(result);
         [driver clickDown];
         [driver clickUp];
     }];
@@ -213,13 +210,12 @@
 
 @end
 
-// FIXME: Re-enable this test once rdar://59610140 is resolved
-TEST(ContextMenu, DISABLED_Image)
+TEST(ContextMenu, Image)
 {
     linkURL = [NSURL URLWithString:@"http://127.0.0.1/image"];
     auto driver = contextMenuWebViewDriver([TestContextMenuImageUIDelegate class], @"<img style='width:400px;height:400px' src=''>");
     [driver begin:^(BOOL result) {
-        EXPECT_TRUE(result);
+        EXPECT_FALSE(result);
         [driver clickDown];
         [driver clickUp];
     }];
@@ -282,12 +278,11 @@
 
 @end
 
-// FIXME: Re-enable this test once rdar://59610140 is resolved
-TEST(ContextMenu, DISABLED_Legacy)
+TEST(ContextMenu, Legacy)
 {
     auto driver = contextMenuWebViewDriver([LegacyContextMenuUIDelegate class]);
     [driver begin:^(BOOL result) {
-        EXPECT_TRUE(result);
+        EXPECT_FALSE(result);
         [driver clickDown];
         [driver clickUp];
     }];
@@ -339,12 +334,11 @@
 @end
 
 
-// FIXME: Re-enable this test once rdar://59610140 is resolved
-TEST(ContextMenu, DISABLED_SuggestedActions)
+TEST(ContextMenu, SuggestedActions)
 {
     auto driver = contextMenuWebViewDriver([TestContextMenuSuggestedActionsUIDelegate class]);
     [driver begin:^(BOOL result) {
-        EXPECT_TRUE(result);
+        EXPECT_FALSE(result);
         [driver clickDown];
         [driver clickUp];
     }];
@@ -371,12 +365,11 @@
 
 @end
 
-// FIXME: Re-enable this test once rdar://59610140 is resolved
-TEST(ContextMenu, DISABLED_HintPreviewContainer)
+TEST(ContextMenu, HintPreviewContainer)
 {
     auto driver = contextMenuWebViewDriver([TestContextMenuHintPreviewContainerUIDelegate class]);
     [driver begin:^(BOOL result) {
-        EXPECT_TRUE(result);
+        EXPECT_FALSE(result);
         [driver clickDown];
         [driver clickUp];
     }];

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestContextMenuDriver.h (287342 => 287343)


--- trunk/Tools/TestWebKitAPI/cocoa/TestContextMenuDriver.h	2021-12-22 04:17:09 UTC (rev 287342)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestContextMenuDriver.h	2021-12-22 04:18:57 UTC (rev 287343)
@@ -38,6 +38,7 @@
     CGFloat _allowableMovement;
     RetainPtr<UIGestureRecognizer> _primaryGestureRecognizer;
     NSTimeInterval _touchDuration;
+    BOOL _cancelsTouchesInView;
 }
 
 - (void)begin:(void(^)(BOOL))completionHandler;
@@ -44,6 +45,7 @@
 - (void)clickDown;
 - (void)clickUp;
 - (void)end;
++ (BOOL)prefersCancelsTouchesInView;
 @end
 
 #endif // USE(UICONTEXTMENU)

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestContextMenuDriver.mm (287342 => 287343)


--- trunk/Tools/TestWebKitAPI/cocoa/TestContextMenuDriver.mm	2021-12-22 04:17:09 UTC (rev 287342)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestContextMenuDriver.mm	2021-12-22 04:18:57 UTC (rev 287343)
@@ -116,6 +116,21 @@
     [self.delegate clickDriver:(id<_UIClickInteractionDriving>)self didPerformEvent:_UIClickInteractionEventEnded];
 }
 
++ (BOOL)prefersCancelsTouchesInView
+{
+    return NO;
+}
+
+- (BOOL)cancelsTouchesInView
+{
+    return _cancelsTouchesInView;
+}
+
+- (void)setCancelsTouchesInView:(BOOL)cancelsTouchesInView
+{
+    _cancelsTouchesInView = cancelsTouchesInView;
+}
+
 @end
 
 #endif // USE(UICONTEXTMENU)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to