| 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 "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" | 5 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |
| 6 | 6 |
| 7 #include "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h" | 7 #include "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h" |
| 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 9 #import "ios/chrome/test/app/chrome_test_util.h" | 9 #import "ios/chrome/test/app/chrome_test_util.h" |
| 10 #include "ios/chrome/test/app/navigation_test_util.h" | 10 #include "ios/chrome/test/app/navigation_test_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 + (void)openShareMenu { | 74 + (void)openShareMenu { |
| 75 if (IsCompact()) { | 75 if (IsCompact()) { |
| 76 [ChromeEarlGreyUI openToolsMenu]; | 76 [ChromeEarlGreyUI openToolsMenu]; |
| 77 } | 77 } |
| 78 [[EarlGrey selectElementWithMatcher:chrome_test_util::ShareButton()] | 78 [[EarlGrey selectElementWithMatcher:chrome_test_util::ShareButton()] |
| 79 performAction:grey_tap()]; | 79 performAction:grey_tap()]; |
| 80 } | 80 } |
| 81 | 81 |
| 82 + (void)waitForToolbarVisible:(BOOL)isVisible { |
| 83 const NSTimeInterval kWaitForToolbarAnimationTimeout = 1.0; |
| 84 ConditionBlock condition = ^{ |
| 85 NSError* error = nil; |
| 86 id<GREYMatcher> visibleMatcher = isVisible ? grey_notNil() : grey_nil(); |
| 87 [[EarlGrey selectElementWithMatcher:chrome_test_util::ToolsMenuButton()] |
| 88 assertWithMatcher:visibleMatcher |
| 89 error:&error]; |
| 90 return error == nil; |
| 91 }; |
| 92 NSString* errorMessage = |
| 93 isVisible ? @"Toolbar was not visible" : @"Toolbar was visible"; |
| 94 GREYAssert(testing::WaitUntilConditionOrTimeout( |
| 95 kWaitForToolbarAnimationTimeout, condition), |
| 96 errorMessage); |
| 97 } |
| 98 |
| 82 @end | 99 @end |
| OLD | NEW |