Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: ios/chrome/test/earl_grey/chrome_util.mm

Issue 2751523004: Move EarlGrey helper to check toolbar visibility into ChromeEarlGreyUI. (Closed)
Patch Set: return void Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/test/earl_grey/chrome_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "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 #if !defined(__has_feature) || !__has_feature(objc_arc)
15 #error "This file requires ARC support."
16 #endif
17
18 namespace {
19 const NSTimeInterval kWaitForToolbarAnimationTimeout = 1.0;
20 } // namespace
21
22 namespace chrome_test_util {
23
24 void AssertToolbarNotVisible() {
25 ConditionBlock condition = ^{
26 id<GREYMatcher> toolsMenuButton =
27 grey_allOf(grey_accessibilityID(kToolbarToolsMenuButtonIdentifier),
28 grey_sufficientlyVisible(), nil);
29 NSError* error = nil;
30 [[EarlGrey selectElementWithMatcher:toolsMenuButton]
31 assertWithMatcher:grey_notNil()
32 error:&error];
33 return error != nil;
34 };
35 GREYAssert(testing::WaitUntilConditionOrTimeout(
36 kWaitForToolbarAnimationTimeout, condition),
37 @"The toolbar is still visible.");
38 }
39
40 void AssertToolbarVisible() {
41 ConditionBlock condition = ^{
42 id<GREYMatcher> toolsMenuButton =
43 grey_allOf(grey_accessibilityID(kToolbarToolsMenuButtonIdentifier),
44 grey_sufficientlyVisible(), nil);
45 NSError* error = nil;
46 [[EarlGrey selectElementWithMatcher:toolsMenuButton]
47 assertWithMatcher:grey_notNil()
48 error:&error];
49 return error == nil;
50 };
51 GREYAssert(testing::WaitUntilConditionOrTimeout(
52 kWaitForToolbarAnimationTimeout, condition),
53 @"The toolbar is not visible.");
54 }
55
56 } // namespace chrome_test_util
OLDNEW
« no previous file with comments | « ios/chrome/test/earl_grey/chrome_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698