Title: [232351] trunk/Tools
Revision
232351
Author
[email protected]
Date
2018-05-31 09:47:31 -0700 (Thu, 31 May 2018)

Log 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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (232350 => 232351)


--- trunk/Tools/ChangeLog	2018-05-31 16:43:52 UTC (rev 232350)
+++ trunk/Tools/ChangeLog	2018-05-31 16:47:31 UTC (rev 232351)
@@ -1,3 +1,19 @@
+2018-05-31  Chris Dumez  <[email protected]>
+
+        [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):
+
 2018-05-31  Leo Balter  <[email protected]>
 
         test262-runner should run in verbose mode in automation

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/ScrollViewInsetTests.mm (232350 => 232351)


--- trunk/Tools/TestWebKitAPI/Tests/ios/ScrollViewInsetTests.mm	2018-05-31 16:43:52 UTC (rev 232350)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/ScrollViewInsetTests.mm	2018-05-31 16:47:31 UTC (rev 232351)
@@ -76,23 +76,32 @@
 static const CGFloat viewHeight = 500;
 static NSString *veryTallDocumentMarkup = @"<meta name='viewport' content='width=device-width, initial-scale=1'><body style='width: 100%; height: 5000px'>";
 
+static void waitUntilInnerHeightIs(TestWKWebView *webView, CGFloat expectedValue)
+{
+    int tries = 0;
+    do {
+        Util::sleep(0.1);
+    } while ([[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue] != expectedValue && ++tries <= 100);
+}
+
 TEST(ScrollViewInsetTests, InnerHeightWithLargeTopContentInset)
 {
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, viewHeight)]);
     [webView scrollView].contentInset = UIEdgeInsetsMake(400, 0, 0, 0);
     [webView synchronouslyLoadHTMLString:veryTallDocumentMarkup];
+
     [webView stringByEvaluatingJavaScript:@"scrollTo(0, 10)"];
-    [webView waitForNextPresentationUpdate];
+    waitUntilInnerHeightIs(webView.get(), viewHeight);
     EXPECT_EQ(viewHeight, [[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue]);
     EXPECT_EQ(10, [[webView objectByEvaluatingJavaScript:@"pageYOffset"] floatValue]);
 
     [webView stringByEvaluatingJavaScript:@"scrollBy(0, -10)"];
-    [webView waitForNextPresentationUpdate];
+    waitUntilInnerHeightIs(webView.get(), viewHeight);
     EXPECT_EQ(viewHeight, [[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue]);
     EXPECT_EQ(0, [[webView objectByEvaluatingJavaScript:@"pageYOffset"] floatValue]);
 
     [webView stringByEvaluatingJavaScript:@"scrollBy(0, 20)"];
-    [webView waitForNextPresentationUpdate];
+    waitUntilInnerHeightIs(webView.get(), viewHeight);
     EXPECT_EQ(viewHeight, [[webView objectByEvaluatingJavaScript:@"innerHeight"] floatValue]);
     EXPECT_EQ(20, [[webView objectByEvaluatingJavaScript:@"pageYOffset"] floatValue]);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to