OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/test/earl_grey/chrome_util.h" |
| 6 |
| 7 #import <EarlGrey/EarlGrey.h> |
| 8 |
| 9 #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" |
| 10 #import "ios/chrome/test/app/chrome_test_util.h" |
| 11 #import "ios/testing/wait_util.h" |
| 12 #import "ios/web/public/test/earl_grey/web_view_matchers.h" |
| 13 |
| 14 namespace { |
| 15 const NSTimeInterval kWaitForToolbarAnimationTimeout = 1.0; |
| 16 } // namespace |
| 17 |
| 18 namespace chrome_test_util { |
| 19 |
| 20 void AssertToolbarNotVisible() { |
| 21 ConditionBlock condition = ^{ |
| 22 id<GREYMatcher> toolsMenuButton = |
| 23 grey_allOf(grey_accessibilityID(kToolbarToolsMenuButtonIdentifier), |
| 24 grey_sufficientlyVisible(), nil); |
| 25 NSError* error = nil; |
| 26 [[EarlGrey selectElementWithMatcher:toolsMenuButton] |
| 27 assertWithMatcher:grey_notNil() |
| 28 error:&error]; |
| 29 return error != nil; |
| 30 }; |
| 31 GREYAssert(testing::WaitUntilConditionOrTimeout( |
| 32 kWaitForToolbarAnimationTimeout, condition), |
| 33 @"The toolbar is still visible."); |
| 34 } |
| 35 |
| 36 void AssertToolbarVisible() { |
| 37 ConditionBlock condition = ^{ |
| 38 id<GREYMatcher> toolsMenuButton = |
| 39 grey_allOf(grey_accessibilityID(kToolbarToolsMenuButtonIdentifier), |
| 40 grey_sufficientlyVisible(), nil); |
| 41 NSError* error = nil; |
| 42 [[EarlGrey selectElementWithMatcher:toolsMenuButton] |
| 43 assertWithMatcher:grey_notNil() |
| 44 error:&error]; |
| 45 return error == nil; |
| 46 }; |
| 47 GREYAssert(testing::WaitUntilConditionOrTimeout( |
| 48 kWaitForToolbarAnimationTimeout, condition), |
| 49 @"The toolbar is not visible."); |
| 50 } |
| 51 |
| 52 } // namespace chrome_test_util |
OLD | NEW |