| 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 #import "ios/web/public/test/http_server.h" | 10 #import "ios/web/public/test/http_server.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 nil); | 45 nil); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 using web::shell_test_util::LoadUrl; | 50 using web::shell_test_util::LoadUrl; |
| 51 using web::test::HttpServer; | 51 using web::test::HttpServer; |
| 52 using web::webViewContainingText; | 52 using web::webViewContainingText; |
| 53 | 53 |
| 54 // Page state test cases for the web shell. | 54 // Page state test cases for the web shell. |
| 55 @interface PageStateTest : ShellBaseTestCase | 55 @interface PageStateTestCase : ShellBaseTestCase |
| 56 @end | 56 @end |
| 57 | 57 |
| 58 @implementation PageStateTest | 58 @implementation PageStateTestCase |
| 59 | 59 |
| 60 // 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 |
| 61 // page via the back/forward buttons. | 61 // page via the back/forward buttons. |
| 62 - (void)testScrollPositionRestoring { | 62 - (void)testScrollPositionRestoring { |
| 63 web::test::SetUpFileBasedHttpServer(); | 63 web::test::SetUpFileBasedHttpServer(); |
| 64 | 64 |
| 65 // Load first URL which is a long page. | 65 // Load first URL which is a long page. |
| 66 LoadUrl(HttpServer::MakeUrl(kLongPage1)); | 66 LoadUrl(HttpServer::MakeUrl(kLongPage1)); |
| 67 // TODO(crbug.com/629116): Remove this once |LoadUrl| waits for the load | 67 // TODO(crbug.com/629116): Remove this once |LoadUrl| waits for the load |
| 68 // completion. | 68 // completion. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 98 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; | 98 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; |
| 99 | 99 |
| 100 // Go forward and verify that the second page offset has been restored. | 100 // Go forward and verify that the second page offset has been restored. |
| 101 [[EarlGrey selectElementWithMatcher:web::forwardButton()] | 101 [[EarlGrey selectElementWithMatcher:web::forwardButton()] |
| 102 performAction:grey_tap()]; | 102 performAction:grey_tap()]; |
| 103 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] | 103 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] |
| 104 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset2))]; | 104 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset2))]; |
| 105 } | 105 } |
| 106 | 106 |
| 107 @end | 107 @end |
| OLD | NEW |