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 <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 | 8 |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "ios/chrome/browser/ui/ui_util.h" | 10 #include "ios/chrome/browser/ui/ui_util.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 responses[initialURL] = | 201 responses[initialURL] = |
| 202 "<div style='height:4000px'></div>" | 202 "<div style='height:4000px'></div>" |
| 203 "<a style='margin-left:50px' href='" + | 203 "<a style='margin-left:50px' href='" + |
| 204 destinationURL.spec() + "' id='link'>link</a>"; | 204 destinationURL.spec() + "' id='link'>link</a>"; |
| 205 responses[destinationURL] = kDestinationHtml; | 205 responses[destinationURL] = kDestinationHtml; |
| 206 | 206 |
| 207 web::test::SetUpSimpleHttpServer(responses); | 207 web::test::SetUpSimpleHttpServer(responses); |
| 208 [ChromeEarlGrey loadURL:initialURL]; | 208 [ChromeEarlGrey loadURL:initialURL]; |
| 209 chrome_test_util::AssertMainTabCount(1U); | 209 chrome_test_util::AssertMainTabCount(1U); |
| 210 | 210 |
| 211 // Scroll down on the web view to make sure the toolbar disappears. | |
| 212 [[EarlGrey | |
| 213 selectElementWithMatcher:WebViewScrollView( | |
| 214 chrome_test_util::GetCurrentWebState())] | |
| 215 performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; | |
|
Eugene But (OOO till 7-30)
2017/03/13 22:35:01
Instead of scrolling twice should we keep scrollin
baxley
2017/03/13 22:43:41
This API does (or should) scroll to the bottom. I'
Eugene But (OOO till 7-30)
2017/03/13 22:54:28
Maybe this is because WebView's height has changed
baxley
2017/03/14 23:32:10
Yes, that's my guess. This method is used in fulls
| |
| 216 | |
| 211 // Scroll down on the web view to make the link visible. | 217 // Scroll down on the web view to make the link visible. |
| 212 [[EarlGrey | 218 [[EarlGrey |
| 213 selectElementWithMatcher:WebViewScrollView( | 219 selectElementWithMatcher:WebViewScrollView( |
| 214 chrome_test_util::GetCurrentWebState())] | 220 chrome_test_util::GetCurrentWebState())] |
| 215 performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; | 221 performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; |
| 216 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( | 222 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 217 kDestinationLinkID)] | 223 kDestinationLinkID)] |
| 218 assertWithMatcher:grey_notNil()]; | 224 assertWithMatcher:grey_notNil()]; |
| 219 | 225 |
| 220 LongPressElementAndTapOnButton(kDestinationLinkID, OpenLinkInNewTabButton()); | 226 LongPressElementAndTapOnButton(kDestinationLinkID, OpenLinkInNewTabButton()); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 246 SelectTabAtIndexInCurrentMode(1U); | 252 SelectTabAtIndexInCurrentMode(1U); |
| 247 | 253 |
| 248 // Verify url and tab count. | 254 // Verify url and tab count. |
| 249 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( | 255 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 250 destinationURL.GetContent())] | 256 destinationURL.GetContent())] |
| 251 assertWithMatcher:grey_notNil()]; | 257 assertWithMatcher:grey_notNil()]; |
| 252 chrome_test_util::AssertMainTabCount(2U); | 258 chrome_test_util::AssertMainTabCount(2U); |
| 253 } | 259 } |
| 254 | 260 |
| 255 @end | 261 @end |
| OLD | NEW |