| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 using web::test::HttpServer; | 52 using web::test::HttpServer; |
| 53 | 53 |
| 54 // Page state test cases for the web shell. | 54 // Page state test cases for the web shell. |
| 55 @interface PageStateTestCase : ShellBaseTestCase | 55 @interface PageStateTestCase : ShellBaseTestCase |
| 56 @end | 56 @end |
| 57 | 57 |
| 58 @implementation PageStateTestCase | 58 @implementation PageStateTestCase |
| 59 | 59 |
| 60 // TODO(crbug.com/675015): Re-enable this test on device. | |
| 61 #if TARGET_IPHONE_SIMULATOR | |
| 62 #define MAYBE_testScrollPositionRestoring testScrollPositionRestoring | |
| 63 #else | |
| 64 #define MAYBE_testScrollPositionRestoring FLAKY_testScrollPositionRestoring | |
| 65 #endif | |
| 66 // Tests that page scroll position of a page is restored upon returning to the | 60 // Tests that page scroll position of a page is restored upon returning to the |
| 67 // page via the back/forward buttons. | 61 // page via the back/forward buttons. |
| 68 - (void)MAYBE_testScrollPositionRestoring { | 62 - (void)testScrollPositionRestoring { |
| 69 // TODO(crbug.com/670700): Re-enable this test. | 63 // TODO(crbug.com/670700): Re-enable this test. |
| 70 if (!base::ios::IsRunningOnIOS10OrLater()) { | 64 if (!base::ios::IsRunningOnIOS10OrLater()) { |
| 71 EARL_GREY_TEST_DISABLED(@"Test disabled on pre-iOS 10"); | 65 EARL_GREY_TEST_DISABLED(@"Test disabled on pre-iOS 10"); |
| 72 } | 66 } |
| 73 web::test::SetUpFileBasedHttpServer(); | 67 web::test::SetUpFileBasedHttpServer(); |
| 74 | 68 |
| 75 // Load first URL which is a long page. | 69 // Load first URL which is a long page. |
| 76 [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage1)]; | 70 [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage1)]; |
| 77 | 71 |
| 78 // Scroll the first page and verify the offset. | 72 // Scroll the first page and verify the offset. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 97 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; | 91 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; |
| 98 | 92 |
| 99 // Go forward and verify that the second page offset has been restored. | 93 // Go forward and verify that the second page offset has been restored. |
| 100 [[EarlGrey selectElementWithMatcher:web::forwardButton()] | 94 [[EarlGrey selectElementWithMatcher:web::forwardButton()] |
| 101 performAction:grey_tap()]; | 95 performAction:grey_tap()]; |
| 102 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] | 96 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] |
| 103 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset2))]; | 97 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset2))]; |
| 104 } | 98 } |
| 105 | 99 |
| 106 @end | 100 @end |
| OLD | NEW |