⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246004 in webkit


Ignore:
Timestamp:
May 31, 2019, 5:43:56 PM (7 years ago)
Author:
Wenson Hsieh
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.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246002 r246004  
     12019-05-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Make tests that use UIHelper more robust under certain configurations
     4        https://bugs.webkit.org/show_bug.cgi?id=198442
     5        <rdar://problem/51301737>
     6
     7        Reviewed by Megan Gardner.
     8
     9        Replace usages of `UIHelper.isIOS` with `UIHelper.isIOSFamily`.
     10
     11        * fast/dom/iframe-inner-size-scaling.html:
     12        * fast/forms/datalist/datalist-show-hide.html:
     13        * fast/forms/datalist/datalist-textinput-suggestions-order.html:
     14        * fast/scrolling/ios/reveal-focused-element-right-above-keyboard-on-ipad.html:
     15
     16        Also remove a workaround here that forces `isIOS` to return `true`.
     17
     18        * resources/ui-helper.js:
     19        (window.UIHelper.isIOSFamily):
     20        (window.UIHelper.isWebKit2):
     21        (window.UIHelper.humanSpeedDoubleTapAt):
     22        (window.UIHelper.humanSpeedZoomByDoubleTappingAt):
     23        (window.UIHelper.zoomByDoubleTappingAt):
     24        (window.UIHelper.async.doubleActivateAt):
     25        (window.UIHelper.async.doubleActivateAtSelectionStart):
     26        (window.UIHelper.async.selectWordByDoubleTapOrClick):
     27        (window.UIHelper.keyDown):
     28        (window.UIHelper.deactivateFormControl):
     29        (window.UIHelper.typeCharacter):
     30        (window.UIHelper.inputViewBounds):
     31        (window.UIHelper.contentOffset):
     32        (window.UIHelper.isIOS): Deleted.
     33
    1342019-05-31  Youenn Fablet  <youenn@apple.com>
    235
  • trunk/LayoutTests/fast/dom/iframe-inner-size-scaling.html

    r225791 r246004  
    1818            shouldBe("frame.contentWindow.innerWidth", "originalWidth");
    1919           
    20             scrollbarWidth = UIHelper.isIOS() ? 0 : 15;
     20            scrollbarWidth = UIHelper.isIOSFamily() ? 0 : 15;
    2121            shouldBe("frame.contentWindow.innerHeight", "originalHeight - scrollbarWidth");
    2222            finishJSTest();
  • trunk/LayoutTests/fast/forms/datalist/datalist-show-hide.html

    r237328 r246004  
    5151    await UIHelper.activateAndWaitForInputSessionAt(150, 25);
    5252
    53     if (UIHelper.isIOS()) {
     53    if (UIHelper.isIOSFamily()) {
    5454        await UIHelper.tapAt(290, 30);
    5555        await waitForDataListSuggestionsToChangeVisibility(true);
     
    5858    before.textContent = await UIHelper.isShowingDataListSuggestions();
    5959
    60     if (UIHelper.isIOS()) {
     60    if (UIHelper.isIOSFamily()) {
    6161        await UIHelper.tapAt(150, 25);
    6262        await waitForDataListSuggestionsToChangeVisibility(false);
  • trunk/LayoutTests/fast/forms/datalist/datalist-textinput-suggestions-order.html

    r237305 r246004  
    4646    return new Promise(async resolve => {
    4747        await UIHelper.activateAndWaitForInputSessionAt(100, 25);
    48         if (UIHelper.isIOS()) {
     48        if (UIHelper.isIOSFamily()) {
    4949            await UIHelper.tapAt(290, 30);
    5050            await UIHelper.resignFirstResponder();
  • trunk/LayoutTests/fast/scrolling/ios/reveal-focused-element-right-above-keyboard-on-ipad.html

    r245993 r246004  
    3131
    3232    if (window.testRunner) {
    33         UIHelper.isIOS = () => true;
    3433        await UIHelper.setHardwareKeyboardAttached(false);
    3534        await UIHelper.activateElementAndWaitForInputSession(target);
  • trunk/LayoutTests/resources/ui-helper.js

    r245561 r246004  
    11
    22window.UIHelper = class UIHelper {
    3     static isIOS()
    4     {
    5         return navigator.userAgent.includes('iPhone') || navigator.userAgent.includes('iPad');
     3    static isIOSFamily()
     4    {
     5        return testRunner.isIOSFamily;
    66    }
    77
    88    static isWebKit2()
    99    {
    10         return window.testRunner.isWebKit2;
     10        return testRunner.isWebKit2;
    1111    }
    1212
     
    3232    static tapAt(x, y, modifiers=[])
    3333    {
    34         console.assert(this.isIOS());
     34        console.assert(this.isIOSFamily());
    3535
    3636        if (!this.isWebKit2()) {
     
    5353    static doubleTapAt(x, y)
    5454    {
    55         console.assert(this.isIOS());
     55        console.assert(this.isIOSFamily());
    5656
    5757        if (!this.isWebKit2()) {
     
    7777    static humanSpeedDoubleTapAt(x, y)
    7878    {
    79         console.assert(this.isIOS());
     79        console.assert(this.isIOSFamily());
    8080
    8181        if (!this.isWebKit2()) {
     
    102102    static humanSpeedZoomByDoubleTappingAt(x, y)
    103103    {
    104         console.assert(this.isIOS());
     104        console.assert(this.isIOSFamily());
    105105
    106106        if (!this.isWebKit2()) {
     
    134134    static zoomByDoubleTappingAt(x, y)
    135135    {
    136         console.assert(this.isIOS());
     136        console.assert(this.isIOSFamily());
    137137
    138138        if (!this.isWebKit2()) {
     
    160160    static activateAt(x, y)
    161161    {
    162         if (!this.isWebKit2() || !this.isIOS()) {
     162        if (!this.isWebKit2() || !this.isIOSFamily()) {
    163163            eventSender.mouseMoveTo(x, y);
    164164            eventSender.mouseDown();
     
    184184    static async doubleActivateAt(x, y)
    185185    {
    186         if (this.isIOS())
     186        if (this.isIOSFamily())
    187187            await UIHelper.doubleTapAt(x, y);
    188188        else
     
    195195        const x = rects[0].left;
    196196        const y = rects[0].top;
    197         if (this.isIOS()) {
     197        if (this.isIOSFamily()) {
    198198            await UIHelper.activateAndWaitForInputSessionAt(x, y);
    199199            await UIHelper.doubleTapAt(x, y);
     
    210210        const x = boundingRect.x + relativeX;
    211211        const y = boundingRect.y + relativeY;
    212         if (this.isIOS()) {
     212        if (this.isIOSFamily()) {
    213213            await UIHelper.activateAndWaitForInputSessionAt(x, y);
    214214            await UIHelper.doubleTapAt(x, y);
     
    223223    static keyDown(key, modifiers=[])
    224224    {
    225         if (!this.isWebKit2() || !this.isIOS()) {
     225        if (!this.isWebKit2() || !this.isIOSFamily()) {
    226226            eventSender.keyDown(key, modifiers);
    227227            return Promise.resolve();
     
    312312    static activateAndWaitForInputSessionAt(x, y)
    313313    {
    314         if (!this.isWebKit2() || !this.isIOS())
     314        if (!this.isWebKit2() || !this.isIOSFamily())
    315315            return this.activateAt(x, y);
    316316
     
    335335    static activateFormControl(element)
    336336    {
    337         if (!this.isWebKit2() || !this.isIOS())
     337        if (!this.isWebKit2() || !this.isIOSFamily())
    338338            return this.activateElement(element);
    339339
     
    368368    static deactivateFormControl(element)
    369369    {
    370         if (!this.isWebKit2() || !this.isIOS()) {
     370        if (!this.isWebKit2() || !this.isIOSFamily()) {
    371371            element.blur();
    372372            return Promise.resolve();
     
    385385    static waitForPopoverToPresent()
    386386    {
    387         if (!this.isWebKit2() || !this.isIOS())
     387        if (!this.isWebKit2() || !this.isIOSFamily())
    388388            return Promise.resolve();
    389389
     
    401401    static waitForPopoverToDismiss()
    402402    {
    403         if (!this.isWebKit2() || !this.isIOS())
     403        if (!this.isWebKit2() || !this.isIOSFamily())
    404404            return Promise.resolve();
    405405
     
    417417    static waitForKeyboardToHide()
    418418    {
    419         if (!this.isWebKit2() || !this.isIOS())
     419        if (!this.isWebKit2() || !this.isIOSFamily())
    420420            return Promise.resolve();
    421421
     
    433433    static getUICaretRect()
    434434    {
    435         if (!this.isWebKit2() || !this.isIOS())
     435        if (!this.isWebKit2() || !this.isIOSFamily())
    436436            return Promise.resolve();
    437437
     
    449449    static getUISelectionRects()
    450450    {
    451         if (!this.isWebKit2() || !this.isIOS())
     451        if (!this.isWebKit2() || !this.isIOSFamily())
    452452            return Promise.resolve();
    453453
     
    465465    static getUICaretViewRect()
    466466    {
    467         if (!this.isWebKit2() || !this.isIOS())
     467        if (!this.isWebKit2() || !this.isIOSFamily())
    468468            return Promise.resolve();
    469469
     
    481481    static getUISelectionViewRects()
    482482    {
    483         if (!this.isWebKit2() || !this.isIOS())
     483        if (!this.isWebKit2() || !this.isIOSFamily())
    484484            return Promise.resolve();
    485485
     
    497497    static getSelectionStartGrabberViewRect()
    498498    {
    499         if (!this.isWebKit2() || !this.isIOS())
     499        if (!this.isWebKit2() || !this.isIOSFamily())
    500500            return Promise.resolve();
    501501
     
    513513    static getSelectionEndGrabberViewRect()
    514514    {
    515         if (!this.isWebKit2() || !this.isIOS())
     515        if (!this.isWebKit2() || !this.isIOSFamily())
    516516            return Promise.resolve();
    517517
     
    635635    static typeCharacter(characterString)
    636636    {
    637         if (!this.isWebKit2() || !this.isIOS()) {
     637        if (!this.isWebKit2() || !this.isIOSFamily()) {
    638638            eventSender.keyDown(characterString);
    639639            return;
     
    657657    static inputViewBounds()
    658658    {
    659         if (!this.isWebKit2() || !this.isIOS())
     659        if (!this.isWebKit2() || !this.isIOSFamily())
    660660            return Promise.resolve();
    661661
     
    796796    static contentOffset()
    797797    {
    798         if (!this.isIOS())
     798        if (!this.isIOSFamily())
    799799            return Promise.resolve();
    800800
     
    910910    static rotateDevice(orientationName, animatedResize = false)
    911911    {
    912         if (!this.isWebKit2() || !this.isIOS())
     912        if (!this.isWebKit2() || !this.isIOSFamily())
    913913            return Promise.resolve();
    914914
  • trunk/Tools/ChangeLog

    r245998 r246004  
     12019-05-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Make tests that use UIHelper more robust under certain configurations
     4        https://bugs.webkit.org/show_bug.cgi?id=198442
     5        <rdar://problem/51301737>
     6
     7        Reviewed by Megan Gardner.
     8
     9        For a certain device class, many tests that attempt to use UIHelper.isIOS are currently failing. We can fix this
     10        by making the `isIOS` check more robust; this patch also renames `isIOS` to `isIOSFamily`, which is more
     11        accurate (and consistent with the corresponding PLATFORM macro name).
     12
     13        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     14        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     15        (WTR::TestRunner::isIOSFamily const):
     16
    1172019-05-31  Wenson Hsieh  <wenson_hsieh@apple.com>
    218
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r244898 r246004  
    2626interface TestRunner {
    2727    readonly attribute boolean isWebKit2;
     28    readonly attribute boolean isIOSFamily;
    2829
    2930    // The basics.
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r244898 r246004  
    4848
    4949    void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
     50
     51    bool isIOSFamily() const
     52    {
     53#if PLATFORM(IOS_FAMILY)
     54        return true;
     55#else
     56        return false;
     57#endif
     58    }
    5059
    5160    bool isWebKit2() const { return true; }
Note: See TracChangeset for help on using the changeset viewer.