Title: [264834] trunk
Revision
264834
Author
[email protected]
Date
2020-07-24 09:44:55 -0700 (Fri, 24 Jul 2020)

Log Message

[ iOS wk2 ] imported/w3c/web-platform-tests/web-share/share-without-user-gesture.https.html is a constant timeout
https://bugs.webkit.org/show_bug.cgi?id=214694
<rdar://problem/66001110>

Reviewed by Tim Horton.

Tools:

The test was failing because there was a share sheet still being presented from a previous Web Share test.
TestController::platformResetStateToConsistentValues() would wait for that share sheet to get dismiss and
would eventually give up and report the test as timing out. The issue is that WebKit layout test were
relying on a UIScriptController function to dismiss the share sheet but Web Platform Tests did not.
To address the issue, we now always promptly dismiss the share sheet in WebKitTestRunner, without the need
for a UIScriptController function call. The Share Sheet now gets dismissed promptly in both WebKit tests
and WPT tests.

For robustness, I also added code in WebKitTestRunner to dismiss any remaining presented view controller
after waiting, to avoid failing on the next test in such cases.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::setShareSheetCompletesImmediatelyWithResolution): Deleted.
* WebKitTestRunner/cocoa/UIScriptControllerCocoa.h:
* WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::UIScriptControllerCocoa::setShareSheetCompletesImmediatelyWithResolution): Deleted.
Delete UIScriptController.setShareSheetCompletesImmediatelyWithResolution() utility function for tests now
that it is the default in WebKit TestRunner.

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
- Call _setShareSheetCompletesImmediatelyWithResolutionForTesting:YES on the test WKWebView instead of relying
  on individual tests to do that.
- For robustness, if there is still a presented view controller after waiting, we now dismiss it ourselves
  instead of failing. This otherwise leads to next test to be reported as failing (or timing out) because there
  is a presented view controller that remains from the previous test. Note that this is not needed to fix the
  layout test in question since we now properly dismiss the share UI in WPT tests but I still think it is a good
  thing to do for robustness and avoid test flakiness.

LayoutTests:

* fast/web-share/share-transient-activation-expired.html:
* fast/web-share/share-transient-activation.html:
* fast/web-share/share-with-files.html:
* fast/web-share/share-with-no-url.html:
* fast/web-share/share.html:
* platform/ios/TestExpectations:
* resources/ui-helper.js:
(window.UIHelper.setShareSheetCompletesImmediatelyWithResolution): Deleted.
Update existing layout test so stop calling UIHelper.setShareSheetCompletesImmediatelyWithResolution() now that it
is the default in WebKitTestRunner.

* platform/ios/TestExpectations:
Unskip test that is no longer timing out.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264833 => 264834)


--- trunk/LayoutTests/ChangeLog	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/ChangeLog	2020-07-24 16:44:55 UTC (rev 264834)
@@ -1,3 +1,25 @@
+2020-07-24  Chris Dumez  <[email protected]>
+
+        [ iOS wk2 ] imported/w3c/web-platform-tests/web-share/share-without-user-gesture.https.html is a constant timeout
+        https://bugs.webkit.org/show_bug.cgi?id=214694
+        <rdar://problem/66001110>
+
+        Reviewed by Tim Horton.
+
+        * fast/web-share/share-transient-activation-expired.html:
+        * fast/web-share/share-transient-activation.html:
+        * fast/web-share/share-with-files.html:
+        * fast/web-share/share-with-no-url.html:
+        * fast/web-share/share.html:
+        * platform/ios/TestExpectations:
+        * resources/ui-helper.js:
+        (window.UIHelper.setShareSheetCompletesImmediatelyWithResolution): Deleted.
+        Update existing layout test so stop calling UIHelper.setShareSheetCompletesImmediatelyWithResolution() now that it
+        is the default in WebKitTestRunner.
+
+        * platform/ios/TestExpectations:
+        Unskip test that is no longer timing out.
+
 2020-07-24  Hector Lopez  <[email protected]>
 
         [ macOS iOS ] webarchive/loading/test-loading-archive-subresource-null-mimetype.html is passing and expectations need to be removed

Modified: trunk/LayoutTests/fast/web-share/share-transient-activation-expired.html (264833 => 264834)


--- trunk/LayoutTests/fast/web-share/share-transient-activation-expired.html	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/fast/web-share/share-transient-activation-expired.html	2020-07-24 16:44:55 UTC (rev 264834)
@@ -37,9 +37,7 @@
                 });
             });
             
-            UIHelper.setShareSheetCompletesImmediatelyWithResolution(true).then(() => {
-                UIHelper.activateAt(50, 50);
-            });
+            UIHelper.activateAt(50, 50);
         }
 
     </script>

Modified: trunk/LayoutTests/fast/web-share/share-transient-activation.html (264833 => 264834)


--- trunk/LayoutTests/fast/web-share/share-transient-activation.html	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/fast/web-share/share-transient-activation.html	2020-07-24 16:44:55 UTC (rev 264834)
@@ -31,9 +31,7 @@
                 });
             });
             
-            UIHelper.setShareSheetCompletesImmediatelyWithResolution(true).then(() => {
-                UIHelper.activateAt(50, 50);
-            });
+            UIHelper.activateAt(50, 50);
         }
 
     </script>

Modified: trunk/LayoutTests/fast/web-share/share-with-files.html (264833 => 264834)


--- trunk/LayoutTests/fast/web-share/share-with-files.html	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/fast/web-share/share-with-files.html	2020-07-24 16:44:55 UTC (rev 264834)
@@ -27,9 +27,7 @@
                 });    
             });
             
-            UIHelper.setShareSheetCompletesImmediatelyWithResolution(true).then(() => {
-                UIHelper.activateAt(50, 50);
-            });
+            UIHelper.activateAt(50, 50);
         }
 
     </script>

Modified: trunk/LayoutTests/fast/web-share/share-with-no-url.html (264833 => 264834)


--- trunk/LayoutTests/fast/web-share/share-with-no-url.html	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/fast/web-share/share-with-no-url.html	2020-07-24 16:44:55 UTC (rev 264834)
@@ -23,9 +23,7 @@
                 });    
             });
             
-            UIHelper.setShareSheetCompletesImmediatelyWithResolution(true).then(() => {
-                UIHelper.activateAt(50, 50);
-            });
+            UIHelper.activateAt(50, 50);
         }
 
     </script>

Modified: trunk/LayoutTests/fast/web-share/share.html (264833 => 264834)


--- trunk/LayoutTests/fast/web-share/share.html	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/fast/web-share/share.html	2020-07-24 16:44:55 UTC (rev 264834)
@@ -23,9 +23,7 @@
                 });    
             });
             
-            UIHelper.setShareSheetCompletesImmediatelyWithResolution(true).then(() => {
-                UIHelper.activateAt(50, 50);
-            });
+            UIHelper.activateAt(50, 50);
         }
 
     </script>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (264833 => 264834)


--- trunk/LayoutTests/platform/ios/TestExpectations	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-07-24 16:44:55 UTC (rev 264834)
@@ -3464,8 +3464,6 @@
 
 fast/text/text-styles/-apple-system [ Pass ]
 
-webkit.org/b/214694 imported/w3c/web-platform-tests/web-share/share-without-user-gesture.https.html [ Skip ]
-
 webkit.org/b/214155 [ Debug ] imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/blob.https.html [ Pass Failure ]
 
 webkit.org/b/214291 imported/w3c/web-platform-tests/css/css-writing-modes/normal-flow-overconstrained-vlr-005.xht [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/resources/ui-helper.js (264833 => 264834)


--- trunk/LayoutTests/resources/ui-helper.js	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/LayoutTests/resources/ui-helper.js	2020-07-24 16:44:55 UTC (rev 264834)
@@ -807,12 +807,6 @@
         }));
     }
 
-    static setShareSheetCompletesImmediatelyWithResolution(resolved)
-    {
-        const resolveShareSheet = `(() => uiController.setShareSheetCompletesImmediatelyWithResolution(${resolved}))()`;
-        return new Promise(resolve => testRunner.runUIScript(resolveShareSheet, resolve));
-    }
-
     static textContentType()
     {
         return new Promise(resolve => {

Modified: trunk/Tools/ChangeLog (264833 => 264834)


--- trunk/Tools/ChangeLog	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/Tools/ChangeLog	2020-07-24 16:44:55 UTC (rev 264834)
@@ -1,3 +1,41 @@
+2020-07-24  Chris Dumez  <[email protected]>
+
+        [ iOS wk2 ] imported/w3c/web-platform-tests/web-share/share-without-user-gesture.https.html is a constant timeout
+        https://bugs.webkit.org/show_bug.cgi?id=214694
+        <rdar://problem/66001110>
+
+        Reviewed by Tim Horton.
+
+        The test was failing because there was a share sheet still being presented from a previous Web Share test.
+        TestController::platformResetStateToConsistentValues() would wait for that share sheet to get dismiss and
+        would eventually give up and report the test as timing out. The issue is that WebKit layout test were
+        relying on a UIScriptController function to dismiss the share sheet but Web Platform Tests did not.
+        To address the issue, we now always promptly dismiss the share sheet in WebKitTestRunner, without the need
+        for a UIScriptController function call. The Share Sheet now gets dismissed promptly in both WebKit tests
+        and WPT tests.
+
+        For robustness, I also added code in WebKitTestRunner to dismiss any remaining presented view controller
+        after waiting, to avoid failing on the next test in such cases.
+
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        (WTR::UIScriptController::setShareSheetCompletesImmediatelyWithResolution): Deleted.
+        * WebKitTestRunner/cocoa/UIScriptControllerCocoa.h:
+        * WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
+        (WTR::UIScriptControllerCocoa::setShareSheetCompletesImmediatelyWithResolution): Deleted.
+        Delete UIScriptController.setShareSheetCompletesImmediatelyWithResolution() utility function for tests now
+        that it is the default in WebKit TestRunner.
+
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformResetStateToConsistentValues):
+        - Call _setShareSheetCompletesImmediatelyWithResolutionForTesting:YES on the test WKWebView instead of relying
+          on individual tests to do that.
+        - For robustness, if there is still a presented view controller after waiting, we now dismiss it ourselves
+          instead of failing. This otherwise leads to next test to be reported as failing (or timing out) because there
+          is a presented view controller that remains from the previous test. Note that this is not needed to fix the
+          layout test in question since we now properly dismiss the share UI in WPT tests but I still think it is a good
+          thing to do for robustness and avoid test flakiness.
+
 2020-07-24  Aakash Jain  <[email protected]>
 
         [ews] Disable email sending on testing instances of ews

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (264833 => 264834)


--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2020-07-24 16:44:55 UTC (rev 264834)
@@ -222,9 +222,6 @@
     readonly attribute double timePickerValueHour;
     readonly attribute double timePickerValueMinute;
 
-    // Share sheet
-    void setShareSheetCompletesImmediatelyWithResolution(boolean resolved);
-
     // <datalist>
     readonly attribute boolean isShowingDataListSuggestions;
     void activateDataListSuggestion(unsigned long index, object callback);

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (264833 => 264834)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2020-07-24 16:44:55 UTC (rev 264834)
@@ -222,10 +222,6 @@
     virtual JSObjectRef inputViewBounds() const { notImplemented(); return nullptr; }
     virtual void activateDataListSuggestion(unsigned, JSValueRef) { notImplemented(); }
 
-    // Share Sheet
-
-    virtual void setShareSheetCompletesImmediatelyWithResolution(bool resolved) { notImplemented(); }
-
     // Find in Page
 
     virtual void findString(JSStringRef, unsigned long options, unsigned long maxCount) { notImplemented(); }

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (264833 => 264834)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2020-07-24 16:44:55 UTC (rev 264834)
@@ -188,6 +188,7 @@
         m_mainWebView->setEditable(true);
 
     m_mainWebView->platformView().allowsLinkPreview = options.allowsLinkPreview;
+    [m_mainWebView->platformView() _setShareSheetCompletesImmediatelyWithResolutionForTesting:YES];
 }
 
 PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const TestOptions& options)

Modified: trunk/Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h (264833 => 264834)


--- trunk/Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h	2020-07-24 16:44:55 UTC (rev 264834)
@@ -38,7 +38,6 @@
     void becomeFirstResponder() override;
     void resignFirstResponder() override;
     void doAsyncTask(JSValueRef) override;
-    void setShareSheetCompletesImmediatelyWithResolution(bool) override;
     void removeViewFromWindow(JSValueRef) override;
     void addViewToWindow(JSValueRef) override;
     void overridePreference(JSStringRef, JSStringRef) override;

Modified: trunk/Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm (264833 => 264834)


--- trunk/Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm	2020-07-24 16:44:55 UTC (rev 264834)
@@ -82,11 +82,6 @@
     });
 }
 
-void UIScriptControllerCocoa::setShareSheetCompletesImmediatelyWithResolution(bool resolved)
-{
-    [webView() _setShareSheetCompletesImmediatelyWithResolutionForTesting:resolved];
-}
-
 void UIScriptControllerCocoa::removeViewFromWindow(JSValueRef callback)
 {
     // FIXME: On iOS, we never invoke the completion callback that's passed in. Fixing this causes the layout

Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (264833 => 264834)


--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2020-07-24 16:42:50 UTC (rev 264833)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2020-07-24 16:44:55 UTC (rev 264834)
@@ -232,6 +232,16 @@
             [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
             hasPresentedViewController = !![webViewController presentedViewController];
         }
+
+        if (hasPresentedViewController) {
+            // As a last resort, just dismiss the remaining presented view controller ourselves.
+            __block BOOL isDoneDismissingViewController = NO;
+            [webViewController dismissViewControllerAnimated:NO completion:^{
+                isDoneDismissingViewController = YES;
+            }];
+            runUntil(isDoneDismissingViewController, m_currentInvocation->shortTimeout());
+            hasPresentedViewController = !![webViewController presentedViewController];
+        }
         
         if (hasPresentedViewController) {
             TestInvocation::dumpWebProcessUnresponsiveness("TestController::platformResetPreferencesToConsistentValues - Failed to remove presented view controller\n");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to