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