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

Side by Side Diff: ios/chrome/browser/ui/ntp/new_tab_page_egtest.mm

Issue 2606023003: Fix flaky NewTabPageTestCase.testOmnibox (Closed)
Patch Set: Created 3 years, 11 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/browser/ui/ntp/google_landing_controller.mm ('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
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 <XCTest/XCTest.h> 6 #import <XCTest/XCTest.h>
7 7
8 #include "components/strings/grit/components_strings.h" 8 #include "components/strings/grit/components_strings.h"
9 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 9 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 22
23 @implementation NewTabPageController (ExposedForTesting) 23 @implementation NewTabPageController (ExposedForTesting)
24 - (GoogleLandingController*)googleLandingController { 24 - (GoogleLandingController*)googleLandingController {
25 return googleLandingController_; 25 return googleLandingController_;
26 } 26 }
27 @end 27 @end
28 28
29 @interface GoogleLandingController (ExposedForTesting) 29 @interface GoogleLandingController (ExposedForTesting)
30 - (BOOL)scrolledToTop; 30 - (BOOL)scrolledToTop;
31 - (BOOL)animateHeader;
31 @end 32 @end
32 33
33 namespace { 34 namespace {
34 35
35 void DismissNewTabPagePanel() { 36 void DismissNewTabPagePanel() {
36 if (!IsIPadIdiom()) { 37 if (!IsIPadIdiom()) {
37 id<GREYMatcher> matcher = grey_allOf(grey_accessibilityID(@"Exit"), 38 id<GREYMatcher> matcher = grey_allOf(grey_accessibilityID(@"Exit"),
38 grey_sufficientlyVisible(), nil); 39 grey_sufficientlyVisible(), nil);
39 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; 40 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
40 } 41 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 80 }
80 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 81 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
81 } 82 }
82 83
83 void AssertNTPScrolledToTop(bool scrolledToTop) { 84 void AssertNTPScrolledToTop(bool scrolledToTop) {
84 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 85 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
85 NewTabPageController* ntp_controller = 86 NewTabPageController* ntp_controller =
86 chrome_test_util::GetCurrentNewTabPageController(); 87 chrome_test_util::GetCurrentNewTabPageController();
87 GoogleLandingController* google_landing_controller = 88 GoogleLandingController* google_landing_controller =
88 [ntp_controller googleLandingController]; 89 [ntp_controller googleLandingController];
90 [[GREYCondition
91 conditionWithName:@"Wait for end of animation."
92 block:^BOOL {
93 return ![google_landing_controller animateHeader];
94 }] waitWithTimeout:testing::kWaitForUIElementTimeout];
89 GREYAssertTrue([google_landing_controller scrolledToTop] == scrolledToTop, 95 GREYAssertTrue([google_landing_controller scrolledToTop] == scrolledToTop,
90 @"scrolledToTop_ does not match expected value"); 96 @"scrolledToTop_ does not match expected value");
91 } 97 }
92 98
93 } // namespace 99 } // namespace
94 100
95 @interface UIWindow (Hidden) 101 @interface UIWindow (Hidden)
96 - (UIResponder*)firstResponder; 102 - (UIResponder*)firstResponder;
97 @end 103 @end
98 104
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 AssertNTPScrolledToTop(YES); 306 AssertNTPScrolledToTop(YES);
301 307
302 // Check that tab switcher and tools menu buttons are not on screen. 308 // Check that tab switcher and tools menu buttons are not on screen.
303 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(tabSwitcherLabel)] 309 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(tabSwitcherLabel)]
304 assertWithMatcher:grey_notVisible()]; 310 assertWithMatcher:grey_notVisible()];
305 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)] 311 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(toolsMenuLabel)]
306 assertWithMatcher:grey_notVisible()]; 312 assertWithMatcher:grey_notVisible()];
307 } 313 }
308 314
309 @end 315 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/ntp/google_landing_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698