Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: ios/web/shell/test/page_state_egtest.mm

Issue 2805573002: Fixed PageStateTest.testScrollPositionRestoring flake. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/shell/test/page_state_egtest.mm
diff --git a/ios/web/shell/test/page_state_egtest.mm b/ios/web/shell/test/page_state_egtest.mm
index ab9a244f1f4bb00b8a0e0236bbf2bd8d9909064d..37aef66e888639359eec186df5be334d31d09163 100644
--- a/ios/web/shell/test/page_state_egtest.mm
+++ b/ios/web/shell/test/page_state_egtest.mm
@@ -53,6 +53,17 @@ void WaitForOffset(CGFloat y_offset) {
GREYAssert([condition waitWithTimeout:10], error_text);
}
+// Loads the long page at |url|, scrolls to the top, and waits for the offset to
+// be {0, 0} before returning.
+void LoadLongPageAndScrollToTop(const GURL& url) {
+ // Load the page and swipe down.
+ [ShellEarlGrey loadURL:url];
+ [[EarlGrey selectElementWithMatcher:web::WebViewScrollView()]
+ performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
baxley 2017/04/06 13:02:39 Can you use grey_scrollToContentEdge instead? grey
Eugene But (OOO till 7-30) 2017/04/06 15:28:46 Why do we need to scroll the page to the top? If t
kkhorimoto 2017/04/06 23:48:10 I've updated to use scrollToContentEdge. I agree
Eugene But (OOO till 7-30) 2017/04/07 00:45:49 Does this test actually fail on Flaky bots? Should
kkhorimoto 2017/04/12 05:03:28 I've investigated, and it turns out that that's no
+ // Waits for the {0, 0} offset.
+ WaitForOffset(0.0);
baxley 2017/04/06 13:02:38 This may not be necessary if we do the call to gre
kkhorimoto 2017/04/06 23:48:10 I left it in since at best it will help reduce fla
+}
+
} // namespace
using web::test::HttpServer;
@@ -65,13 +76,11 @@ @implementation PageStateTestCase
// Tests that page scroll position of a page is restored upon returning to the
// page via the back/forward buttons.
-// TODO(crbug.com/702410): This test flakily fails when it scrolls too far down
-// the page.
-- (void)FLAKY_testScrollPositionRestoring {
+- (void)testScrollPositionRestoring {
web::test::SetUpFileBasedHttpServer();
// Load first URL which is a long page.
baxley 2017/04/06 13:02:39 Do you want to delete this comment? I think the ne
kkhorimoto 2017/04/06 23:48:10 Done.
- [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage1)];
+ LoadLongPageAndScrollToTop(HttpServer::MakeUrl(kLongPage1));
// Scroll the first page and verify the offset.
[[EarlGrey selectElementWithMatcher:web::WebViewScrollView()]
@@ -80,7 +89,7 @@ - (void)FLAKY_testScrollPositionRestoring {
assertWithMatcher:grey_scrollViewContentOffset(CGPointMake(0, kOffset1))];
// Load second URL, which is also a long page.
baxley 2017/04/06 13:02:39 Delete comment?
kkhorimoto 2017/04/06 23:48:10 Done.
- [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage2)];
+ LoadLongPageAndScrollToTop(HttpServer::MakeUrl(kLongPage2));
// Scroll the second page and verify the offset.
[[EarlGrey selectElementWithMatcher:web::WebViewScrollView()]
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698