| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <CoreGraphics/CoreGraphics.h> | 5 #import <CoreGraphics/CoreGraphics.h> |
| 6 #import <EarlGrey/EarlGrey.h> | 6 #import <EarlGrey/EarlGrey.h> |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 #import <XCTest/XCTest.h> | 8 #import <XCTest/XCTest.h> |
| 9 | 9 |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 using web::test::HttpServer; | 59 using web::test::HttpServer; |
| 60 | 60 |
| 61 // Page state test cases for the web shell. | 61 // Page state test cases for the web shell. |
| 62 @interface PageStateTestCase : WebShellTestCase | 62 @interface PageStateTestCase : WebShellTestCase |
| 63 @end | 63 @end |
| 64 | 64 |
| 65 @implementation PageStateTestCase | 65 @implementation PageStateTestCase |
| 66 | 66 |
| 67 // Tests that page scroll position of a page is restored upon returning to the | 67 // Tests that page scroll position of a page is restored upon returning to the |
| 68 // page via the back/forward buttons. | 68 // page via the back/forward buttons. |
| 69 - (void)testScrollPositionRestoring { | 69 // TODO(crbug.com/702410): This test flakily fails when it scrolls too far down |
| 70 // the page. |
| 71 - (void)FLAKY_testScrollPositionRestoring { |
| 70 web::test::SetUpFileBasedHttpServer(); | 72 web::test::SetUpFileBasedHttpServer(); |
| 71 | 73 |
| 72 // Load first URL which is a long page. | 74 // Load first URL which is a long page. |
| 73 [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage1)]; | 75 [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage1)]; |
| 74 | 76 |
| 75 // Scroll the first page and verify the offset. | 77 // Scroll the first page and verify the offset. |
| 76 [[EarlGrey selectElementWithMatcher:web::WebViewScrollView()] | 78 [[EarlGrey selectElementWithMatcher:web::WebViewScrollView()] |
| 77 performAction:grey_scrollInDirection(kGREYDirectionDown, kOffset1)]; | 79 performAction:grey_scrollInDirection(kGREYDirectionDown, kOffset1)]; |
| 78 [[EarlGrey selectElementWithMatcher:web::WebViewScrollView()] | 80 [[EarlGrey selectElementWithMatcher:web::WebViewScrollView()] |
| 79 assertWithMatcher:grey_scrollViewContentOffset(CGPointMake(0, kOffset1))]; | 81 assertWithMatcher:grey_scrollViewContentOffset(CGPointMake(0, kOffset1))]; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 performAction:grey_tap()]; | 94 performAction:grey_tap()]; |
| 93 WaitForOffset(kOffset1); | 95 WaitForOffset(kOffset1); |
| 94 | 96 |
| 95 // Go forward and verify that the second page offset has been restored. | 97 // Go forward and verify that the second page offset has been restored. |
| 96 [[EarlGrey selectElementWithMatcher:web::ForwardButton()] | 98 [[EarlGrey selectElementWithMatcher:web::ForwardButton()] |
| 97 performAction:grey_tap()]; | 99 performAction:grey_tap()]; |
| 98 WaitForOffset(kOffset2); | 100 WaitForOffset(kOffset2); |
| 99 } | 101 } |
| 100 | 102 |
| 101 @end | 103 @end |
| OLD | NEW |