| 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" |  | 
|   10 #include "ios/chrome/browser/ui/ui_util.h" |    9 #include "ios/chrome/browser/ui/ui_util.h" | 
|   11 #include "ios/chrome/grit/ios_strings.h" |   10 #include "ios/chrome/grit/ios_strings.h" | 
|   12 #import "ios/chrome/test/app/chrome_test_util.h" |   11 #import "ios/chrome/test/app/chrome_test_util.h" | 
|   13 #import "ios/chrome/test/app/settings_test_util.h" |   12 #import "ios/chrome/test/app/settings_test_util.h" | 
|   14 #import "ios/chrome/test/app/tab_test_util.h" |   13 #import "ios/chrome/test/app/tab_test_util.h" | 
|   15 #include "ios/chrome/test/app/web_view_interaction_test_util.h" |   14 #include "ios/chrome/test/app/web_view_interaction_test_util.h" | 
|   16 #import "ios/chrome/test/earl_grey/chrome_actions.h" |   15 #import "ios/chrome/test/earl_grey/chrome_actions.h" | 
|   17 #import "ios/chrome/test/earl_grey/chrome_assertions.h" |   16 #import "ios/chrome/test/earl_grey/chrome_assertions.h" | 
|   18 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |   17 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 
|   19 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |   18 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" | 
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  217   // TODO(crbug.com/702272): Try to replace this with one EarlGrey method call. |  216   // TODO(crbug.com/702272): Try to replace this with one EarlGrey method call. | 
|  218   [[EarlGrey |  217   [[EarlGrey | 
|  219       selectElementWithMatcher:WebViewScrollView( |  218       selectElementWithMatcher:WebViewScrollView( | 
|  220                                    chrome_test_util::GetCurrentWebState())] |  219                                    chrome_test_util::GetCurrentWebState())] | 
|  221       performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; |  220       performAction:grey_swipeFastInDirection(kGREYDirectionUp)]; | 
|  222   [[EarlGrey |  221   [[EarlGrey | 
|  223       selectElementWithMatcher:WebViewScrollView( |  222       selectElementWithMatcher:WebViewScrollView( | 
|  224                                    chrome_test_util::GetCurrentWebState())] |  223                                    chrome_test_util::GetCurrentWebState())] | 
|  225       performAction:grey_scrollToContentEdge(kGREYContentEdgeBottom)]; |  224       performAction:grey_scrollToContentEdge(kGREYContentEdgeBottom)]; | 
|  226  |  225  | 
|  227   [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |  226   [ChromeEarlGrey waitForWebViewContainingText:kDestinationLinkID]; | 
|  228                                           kDestinationLinkID)] |  | 
|  229       assertWithMatcher:grey_notNil()]; |  | 
|  230  |  227  | 
|  231   LongPressElementAndTapOnButton(kDestinationLinkID, OpenLinkInNewTabButton()); |  228   LongPressElementAndTapOnButton(kDestinationLinkID, OpenLinkInNewTabButton()); | 
|  232  |  229  | 
|  233   // Earl Grey cannot preperly synchronize some animations, so adding a |  230   // Earl Grey cannot preperly synchronize some animations, so adding a | 
|  234   // WaitUntilCondition to wait for the new tab opening animation to finish |  231   // WaitUntilCondition to wait for the new tab opening animation to finish | 
|  235   // and the scroll view to become interactable. |  232   // and the scroll view to become interactable. | 
|  236   ConditionBlock condition = ^{ |  233   ConditionBlock condition = ^{ | 
|  237     NSError* error = nil; |  234     NSError* error = nil; | 
|  238     [[EarlGrey |  235     [[EarlGrey | 
|  239         selectElementWithMatcher:WebViewScrollView( |  236         selectElementWithMatcher:WebViewScrollView( | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|  257   SelectTabAtIndexInCurrentMode(1U); |  254   SelectTabAtIndexInCurrentMode(1U); | 
|  258  |  255  | 
|  259   // Verify url and tab count. |  256   // Verify url and tab count. | 
|  260   [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |  257   [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( | 
|  261                                           destinationURL.GetContent())] |  258                                           destinationURL.GetContent())] | 
|  262       assertWithMatcher:grey_notNil()]; |  259       assertWithMatcher:grey_notNil()]; | 
|  263   chrome_test_util::AssertMainTabCount(2U); |  260   chrome_test_util::AssertMainTabCount(2U); | 
|  264 } |  261 } | 
|  265  |  262  | 
|  266 @end |  263 @end | 
| OLD | NEW |