Chromium Code Reviews| 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" | |
| 11 #import "ios/testing/earl_grey/disabled_test_macros.h" | |
| 10 #import "ios/web/public/test/http_server.h" | 12 #import "ios/web/public/test/http_server.h" |
| 11 #include "ios/web/public/test/http_server_util.h" | 13 #include "ios/web/public/test/http_server_util.h" |
| 12 #import "ios/web/shell/test/earl_grey/shell_base_test_case.h" | 14 #import "ios/web/shell/test/earl_grey/shell_base_test_case.h" |
| 13 #import "ios/web/shell/test/earl_grey/shell_earl_grey.h" | 15 #import "ios/web/shell/test/earl_grey/shell_earl_grey.h" |
| 14 #import "ios/web/shell/test/earl_grey/shell_matchers.h" | 16 #import "ios/web/shell/test/earl_grey/shell_matchers.h" |
| 15 | 17 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) | 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." | 19 #error "This file requires ARC support." |
| 18 #endif | 20 #endif |
| 19 | 21 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 53 |
| 52 // Page state test cases for the web shell. | 54 // Page state test cases for the web shell. |
| 53 @interface PageStateTestCase : ShellBaseTestCase | 55 @interface PageStateTestCase : ShellBaseTestCase |
| 54 @end | 56 @end |
| 55 | 57 |
| 56 @implementation PageStateTestCase | 58 @implementation PageStateTestCase |
| 57 | 59 |
| 58 // 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 |
| 59 // page via the back/forward buttons. | 61 // page via the back/forward buttons. |
| 60 - (void)testScrollPositionRestoring { | 62 - (void)testScrollPositionRestoring { |
| 63 // TODO(crbug.com/670700): Re-enable this test. | |
| 64 if (!base::ios::IsRunningOnIOS10OrLater()) { | |
|
Eugene But (OOO till 7-30)
2016/12/02 16:50:36
Is it flaky on both device and simulator?
| |
| 65 EARL_GREY_TEST_DISABLED(@"Test disabled on pre-iOS 10"); | |
| 66 } | |
| 61 web::test::SetUpFileBasedHttpServer(); | 67 web::test::SetUpFileBasedHttpServer(); |
| 62 | 68 |
| 63 // Load first URL which is a long page. | 69 // Load first URL which is a long page. |
| 64 [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage1)]; | 70 [ShellEarlGrey loadURL:HttpServer::MakeUrl(kLongPage1)]; |
| 65 | 71 |
| 66 // Scroll the first page and verify the offset. | 72 // Scroll the first page and verify the offset. |
| 67 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] | 73 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] |
| 68 performAction:grey_scrollInDirection(kGREYDirectionDown, kScrollOffset1)]; | 74 performAction:grey_scrollInDirection(kGREYDirectionDown, kScrollOffset1)]; |
| 69 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] | 75 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] |
| 70 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; | 76 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 85 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; | 91 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset1))]; |
| 86 | 92 |
| 87 // 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. |
| 88 [[EarlGrey selectElementWithMatcher:web::forwardButton()] | 94 [[EarlGrey selectElementWithMatcher:web::forwardButton()] |
| 89 performAction:grey_tap()]; | 95 performAction:grey_tap()]; |
| 90 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] | 96 [[EarlGrey selectElementWithMatcher:web::webViewScrollView()] |
| 91 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset2))]; | 97 assertWithMatcher:contentOffset(CGPointMake(0, kScrollOffset2))]; |
| 92 } | 98 } |
| 93 | 99 |
| 94 @end | 100 @end |
| OLD | NEW |