Changeset 232351 in webkit


Ignore:
Timestamp:
May 31, 2018 9:47:31 AM (6 years ago)
Author:
Chris Dumez
Message:

[iOS] API test ScrollViewInsetTests.InnerHeightWithLargeTopContentInset is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=184893
<rdar://problem/39747271>

Reviewed by Wenson Hsieh.

Update test to wait until the view is the expected height instead of
calling waitForNextPresentationUpdate once and expect the view to
have the right height. This fixes the flakiness.

  • TestWebKitAPI/Tests/ios/ScrollViewInsetTests.mm:

(TestWebKitAPI::waitUntilInnerHeightIs):
(TestWebKitAPI::TEST):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r232343 r232351  
     12018-05-31  Chris Dumez  <cdumez@apple.com>
     2
     3        [iOS] API test ScrollViewInsetTests.InnerHeightWithLargeTopContentInset is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=184893
     5        <rdar://problem/39747271>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Update test to wait until the view is the expected height instead of
     10        calling waitForNextPresentationUpdate once and expect the view to
     11        have the right height. This fixes the flakiness.
     12
     13        * TestWebKitAPI/Tests/ios/ScrollViewInsetTests.mm:
     14        (TestWebKitAPI::waitUntilInnerHeightIs):
     15        (TestWebKitAPI::TEST):
     16
    1172018-05-31  Leo Balter  <leonardo.balter@gmail.com>
    218
  • trunk/Tools/TestWebKitAPI/Tests/ios/ScrollViewInsetTests.mm

    r230883 r232351  
    7777static NSString *veryTallDocumentMarkup = @"<meta name='viewport' content='width=device-width, initial-scale=1'><body style='width: 100%; height: 5000px'>";
    7878
     79static void waitUntilInnerHeightIs(TestWKWebView *webView, CGFloat expectedValue)
     80{
     81    int tries = 0;
     82    do {
     83        Util::sleep(0.1);
     84    } while ([[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue] != expectedValue && ++tries <= 100);
     85}
     86
    7987TEST(ScrollViewInsetTests, InnerHeightWithLargeTopContentInset)
    8088{
     
    8290    [webView scrollView].contentInset = UIEdgeInsetsMake(400, 0, 0, 0);
    8391    [webView synchronouslyLoadHTMLString:veryTallDocumentMarkup];
     92
    8493    [webView stringByEvaluatingJavaScript:@"scrollTo(0, 10)"];
    85     [webView waitForNextPresentationUpdate];
     94    waitUntilInnerHeightIs(webView.get(), viewHeight);
    8695    EXPECT_EQ(viewHeight, [[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue]);
    8796    EXPECT_EQ(10, [[webView objectByEvaluatingJavaScript:@"pageYOffset"] floatValue]);
    8897
    8998    [webView stringByEvaluatingJavaScript:@"scrollBy(0, -10)"];
    90     [webView waitForNextPresentationUpdate];
     99    waitUntilInnerHeightIs(webView.get(), viewHeight);
    91100    EXPECT_EQ(viewHeight, [[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue]);
    92101    EXPECT_EQ(0, [[webView objectByEvaluatingJavaScript:@"pageYOffset"] floatValue]);
    93102
    94103    [webView stringByEvaluatingJavaScript:@"scrollBy(0, 20)"];
    95     [webView waitForNextPresentationUpdate];
     104    waitUntilInnerHeightIs(webView.get(), viewHeight);
    96105    EXPECT_EQ(viewHeight, [[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue]);
    97106    EXPECT_EQ(20, [[webView objectByEvaluatingJavaScript:@"pageYOffset"] floatValue]);
Note: See TracChangeset for help on using the changeset viewer.