Title: [246004] trunk
Revision
246004
Author
wenson_hs...@apple.com
Date
2019-05-31 17:43:56 -0700 (Fri, 31 May 2019)

Log Message

Make tests that use UIHelper more robust under certain configurations
https://bugs.webkit.org/show_bug.cgi?id=198442
<rdar://problem/51301737>

Reviewed by Megan Gardner.

Tools:

For a certain device class, many tests that attempt to use UIHelper.isIOS are currently failing. We can fix this
by making the `isIOS` check more robust; this patch also renames `isIOS` to `isIOSFamily`, which is more
accurate (and consistent with the corresponding PLATFORM macro name).

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::isIOSFamily const):

LayoutTests:

Replace usages of `UIHelper.isIOS` with `UIHelper.isIOSFamily`.

* fast/dom/iframe-inner-size-scaling.html:
* fast/forms/datalist/datalist-show-hide.html:
* fast/forms/datalist/datalist-textinput-suggestions-order.html:
* fast/scrolling/ios/reveal-focused-element-right-above-keyboard-on-ipad.html:

Also remove a workaround here that forces `isIOS` to return `true`.

* resources/ui-helper.js:
(window.UIHelper.isIOSFamily):
(window.UIHelper.isWebKit2):
(window.UIHelper.humanSpeedDoubleTapAt):
(window.UIHelper.humanSpeedZoomByDoubleTappingAt):
(window.UIHelper.zoomByDoubleTappingAt):
(window.UIHelper.async.doubleActivateAt):
(window.UIHelper.async.doubleActivateAtSelectionStart):
(window.UIHelper.async.selectWordByDoubleTapOrClick):
(window.UIHelper.keyDown):
(window.UIHelper.deactivateFormControl):
(window.UIHelper.typeCharacter):
(window.UIHelper.inputViewBounds):
(window.UIHelper.contentOffset):
(window.UIHelper.isIOS): Deleted.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246003 => 246004)


--- trunk/LayoutTests/ChangeLog	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/LayoutTests/ChangeLog	2019-06-01 00:43:56 UTC (rev 246004)
@@ -1,3 +1,36 @@
+2019-05-31  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Make tests that use UIHelper more robust under certain configurations
+        https://bugs.webkit.org/show_bug.cgi?id=198442
+        <rdar://problem/51301737>
+
+        Reviewed by Megan Gardner.
+
+        Replace usages of `UIHelper.isIOS` with `UIHelper.isIOSFamily`.
+
+        * fast/dom/iframe-inner-size-scaling.html:
+        * fast/forms/datalist/datalist-show-hide.html:
+        * fast/forms/datalist/datalist-textinput-suggestions-order.html:
+        * fast/scrolling/ios/reveal-focused-element-right-above-keyboard-on-ipad.html:
+
+        Also remove a workaround here that forces `isIOS` to return `true`.
+
+        * resources/ui-helper.js:
+        (window.UIHelper.isIOSFamily):
+        (window.UIHelper.isWebKit2):
+        (window.UIHelper.humanSpeedDoubleTapAt):
+        (window.UIHelper.humanSpeedZoomByDoubleTappingAt):
+        (window.UIHelper.zoomByDoubleTappingAt):
+        (window.UIHelper.async.doubleActivateAt):
+        (window.UIHelper.async.doubleActivateAtSelectionStart):
+        (window.UIHelper.async.selectWordByDoubleTapOrClick):
+        (window.UIHelper.keyDown):
+        (window.UIHelper.deactivateFormControl):
+        (window.UIHelper.typeCharacter):
+        (window.UIHelper.inputViewBounds):
+        (window.UIHelper.contentOffset):
+        (window.UIHelper.isIOS): Deleted.
+
 2019-05-31  Youenn Fablet  <you...@apple.com>
 
         Add an option to mute audio capture automatically when page is not visible

Modified: trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html (246003 => 246004)


--- trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html	2019-06-01 00:43:56 UTC (rev 246004)
@@ -17,7 +17,7 @@
             shouldBeNonZero("frame.contentWindow.innerHeight");
             shouldBe("frame.contentWindow.innerWidth", "originalWidth");
             
-            scrollbarWidth = UIHelper.isIOS() ? 0 : 15;
+            scrollbarWidth = UIHelper.isIOSFamily() ? 0 : 15;
             shouldBe("frame.contentWindow.innerHeight", "originalHeight - scrollbarWidth");
             finishJSTest();
         }

Modified: trunk/LayoutTests/fast/forms/datalist/datalist-show-hide.html (246003 => 246004)


--- trunk/LayoutTests/fast/forms/datalist/datalist-show-hide.html	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/LayoutTests/fast/forms/datalist/datalist-show-hide.html	2019-06-01 00:43:56 UTC (rev 246004)
@@ -50,7 +50,7 @@
 async function runTest() {
     await UIHelper.activateAndWaitForInputSessionAt(150, 25);
 
-    if (UIHelper.isIOS()) {
+    if (UIHelper.isIOSFamily()) {
         await UIHelper.tapAt(290, 30);
         await waitForDataListSuggestionsToChangeVisibility(true);
     }
@@ -57,7 +57,7 @@
 
     before.textContent = await UIHelper.isShowingDataListSuggestions();
 
-    if (UIHelper.isIOS()) {
+    if (UIHelper.isIOSFamily()) {
         await UIHelper.tapAt(150, 25);
         await waitForDataListSuggestionsToChangeVisibility(false);
     } else

Modified: trunk/LayoutTests/fast/forms/datalist/datalist-textinput-suggestions-order.html (246003 => 246004)


--- trunk/LayoutTests/fast/forms/datalist/datalist-textinput-suggestions-order.html	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/LayoutTests/fast/forms/datalist/datalist-textinput-suggestions-order.html	2019-06-01 00:43:56 UTC (rev 246004)
@@ -45,7 +45,7 @@
 {
     return new Promise(async resolve => {
         await UIHelper.activateAndWaitForInputSessionAt(100, 25);
-        if (UIHelper.isIOS()) {
+        if (UIHelper.isIOSFamily()) {
             await UIHelper.tapAt(290, 30);
             await UIHelper.resignFirstResponder();
             await UIHelper.waitForKeyboardToHide();

Modified: trunk/LayoutTests/fast/scrolling/ios/reveal-focused-element-right-above-keyboard-on-ipad.html (246003 => 246004)


--- trunk/LayoutTests/fast/scrolling/ios/reveal-focused-element-right-above-keyboard-on-ipad.html	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/LayoutTests/fast/scrolling/ios/reveal-focused-element-right-above-keyboard-on-ipad.html	2019-06-01 00:43:56 UTC (rev 246004)
@@ -30,7 +30,6 @@
     const resizeEvent = listenForEventOnce(target, 'focus').then(() => listenForEventOnce(visualViewport, 'resize'));
 
     if (window.testRunner) {
-        UIHelper.isIOS = () => true;
         await UIHelper.setHardwareKeyboardAttached(false);
         await UIHelper.activateElementAndWaitForInputSession(target);
     }

Modified: trunk/LayoutTests/resources/ui-helper.js (246003 => 246004)


--- trunk/LayoutTests/resources/ui-helper.js	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/LayoutTests/resources/ui-helper.js	2019-06-01 00:43:56 UTC (rev 246004)
@@ -1,13 +1,13 @@
 
 window.UIHelper = class UIHelper {
-    static isIOS()
+    static isIOSFamily()
     {
-        return navigator.userAgent.includes('iPhone') || navigator.userAgent.includes('iPad');
+        return testRunner.isIOSFamily;
     }
 
     static isWebKit2()
     {
-        return window.testRunner.isWebKit2;
+        return testRunner.isWebKit2;
     }
 
     static doubleClickAt(x, y)
@@ -31,7 +31,7 @@
 
     static tapAt(x, y, modifiers=[])
     {
-        console.assert(this.isIOS());
+        console.assert(this.isIOSFamily());
 
         if (!this.isWebKit2()) {
             console.assert(!modifiers || !modifiers.length);
@@ -52,7 +52,7 @@
 
     static doubleTapAt(x, y)
     {
-        console.assert(this.isIOS());
+        console.assert(this.isIOSFamily());
 
         if (!this.isWebKit2()) {
             eventSender.addTouchPoint(x, y);
@@ -76,7 +76,7 @@
 
     static humanSpeedDoubleTapAt(x, y)
     {
-        console.assert(this.isIOS());
+        console.assert(this.isIOSFamily());
 
         if (!this.isWebKit2()) {
             // FIXME: Add a sleep in here.
@@ -101,7 +101,7 @@
 
     static humanSpeedZoomByDoubleTappingAt(x, y)
     {
-        console.assert(this.isIOS());
+        console.assert(this.isIOSFamily());
 
         if (!this.isWebKit2()) {
             // FIXME: Add a sleep in here.
@@ -133,7 +133,7 @@
 
     static zoomByDoubleTappingAt(x, y)
     {
-        console.assert(this.isIOS());
+        console.assert(this.isIOSFamily());
 
         if (!this.isWebKit2()) {
             eventSender.addTouchPoint(x, y);
@@ -159,7 +159,7 @@
 
     static activateAt(x, y)
     {
-        if (!this.isWebKit2() || !this.isIOS()) {
+        if (!this.isWebKit2() || !this.isIOSFamily()) {
             eventSender.mouseMoveTo(x, y);
             eventSender.mouseDown();
             eventSender.mouseUp();
@@ -183,7 +183,7 @@
 
     static async doubleActivateAt(x, y)
     {
-        if (this.isIOS())
+        if (this.isIOSFamily())
             await UIHelper.doubleTapAt(x, y);
         else
             await UIHelper.doubleClickAt(x, y);
@@ -194,7 +194,7 @@
         const rects = window.getSelection().getRangeAt(0).getClientRects();
         const x = rects[0].left;
         const y = rects[0].top;
-        if (this.isIOS()) {
+        if (this.isIOSFamily()) {
             await UIHelper.activateAndWaitForInputSessionAt(x, y);
             await UIHelper.doubleTapAt(x, y);
             // This is only here to deal with async/sync copy/paste calls, so
@@ -209,7 +209,7 @@
         const boundingRect = element.getBoundingClientRect();
         const x = boundingRect.x + relativeX;
         const y = boundingRect.y + relativeY;
-        if (this.isIOS()) {
+        if (this.isIOSFamily()) {
             await UIHelper.activateAndWaitForInputSessionAt(x, y);
             await UIHelper.doubleTapAt(x, y);
             // This is only here to deal with async/sync copy/paste calls, so
@@ -222,7 +222,7 @@
 
     static keyDown(key, modifiers=[])
     {
-        if (!this.isWebKit2() || !this.isIOS()) {
+        if (!this.isWebKit2() || !this.isIOSFamily()) {
             eventSender.keyDown(key, modifiers);
             return Promise.resolve();
         }
@@ -311,7 +311,7 @@
 
     static activateAndWaitForInputSessionAt(x, y)
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return this.activateAt(x, y);
 
         return new Promise(resolve => {
@@ -334,7 +334,7 @@
 
     static activateFormControl(element)
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return this.activateElement(element);
 
         const x = element.offsetLeft + element.offsetWidth / 2;
@@ -367,7 +367,7 @@
 
     static deactivateFormControl(element)
     {
-        if (!this.isWebKit2() || !this.isIOS()) {
+        if (!this.isWebKit2() || !this.isIOSFamily()) {
             element.blur();
             return Promise.resolve();
         }
@@ -384,7 +384,7 @@
 
     static waitForPopoverToPresent()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -400,7 +400,7 @@
 
     static waitForPopoverToDismiss()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -416,7 +416,7 @@
 
     static waitForKeyboardToHide()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -432,7 +432,7 @@
 
     static getUICaretRect()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -448,7 +448,7 @@
 
     static getUISelectionRects()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -464,7 +464,7 @@
 
     static getUICaretViewRect()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -480,7 +480,7 @@
 
     static getUISelectionViewRects()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -496,7 +496,7 @@
 
     static getSelectionStartGrabberViewRect()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -512,7 +512,7 @@
 
     static getSelectionEndGrabberViewRect()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -634,7 +634,7 @@
 
     static typeCharacter(characterString)
     {
-        if (!this.isWebKit2() || !this.isIOS()) {
+        if (!this.isWebKit2() || !this.isIOSFamily()) {
             eventSender.keyDown(characterString);
             return;
         }
@@ -656,7 +656,7 @@
 
     static inputViewBounds()
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {
@@ -795,7 +795,7 @@
 
     static contentOffset()
     {
-        if (!this.isIOS())
+        if (!this.isIOSFamily())
             return Promise.resolve();
 
         const uiScript = "JSON.stringify([uiController.contentOffsetX, uiController.contentOffsetY])";
@@ -909,7 +909,7 @@
 
     static rotateDevice(orientationName, animatedResize = false)
     {
-        if (!this.isWebKit2() || !this.isIOS())
+        if (!this.isWebKit2() || !this.isIOSFamily())
             return Promise.resolve();
 
         return new Promise(resolve => {

Modified: trunk/Tools/ChangeLog (246003 => 246004)


--- trunk/Tools/ChangeLog	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/Tools/ChangeLog	2019-06-01 00:43:56 UTC (rev 246004)
@@ -1,5 +1,21 @@
 2019-05-31  Wenson Hsieh  <wenson_hs...@apple.com>
 
+        Make tests that use UIHelper more robust under certain configurations
+        https://bugs.webkit.org/show_bug.cgi?id=198442
+        <rdar://problem/51301737>
+
+        Reviewed by Megan Gardner.
+
+        For a certain device class, many tests that attempt to use UIHelper.isIOS are currently failing. We can fix this
+        by making the `isIOS` check more robust; this patch also renames `isIOS` to `isIOSFamily`, which is more
+        accurate (and consistent with the corresponding PLATFORM macro name).
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (WTR::TestRunner::isIOSFamily const):
+
+2019-05-31  Wenson Hsieh  <wenson_hs...@apple.com>
+
         [iOS] Autocorrection menu font is Times New Roman when using font-family: UICTFontTextStyle*
         https://bugs.webkit.org/show_bug.cgi?id=198427
         <rdar://problem/50031825>

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (246003 => 246004)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2019-06-01 00:43:56 UTC (rev 246004)
@@ -25,6 +25,7 @@
 
 interface TestRunner {
     readonly attribute boolean isWebKit2;
+    readonly attribute boolean isIOSFamily;
 
     // The basics.
     void dumpAsText(boolean dumpPixels);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (246003 => 246004)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-06-01 00:00:55 UTC (rev 246003)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2019-06-01 00:43:56 UTC (rev 246004)
@@ -48,6 +48,15 @@
 
     void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
 
+    bool isIOSFamily() const
+    {
+#if PLATFORM(IOS_FAMILY)
+        return true;
+#else
+        return false;
+#endif
+    }
+
     bool isWebKit2() const { return true; }
 
     // The basics.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to