Commit 5c105cf0 authored by olivierrobin's avatar olivierrobin Committed by Commit bot

Fix flaky NewTabPageTestCase.testOmnibox

[google_landing_controller scrolledToTop] is set at the begining of
animation.
This make taps done just after another tap flaky.
Add a wait on animateHeader to wait until animation is finished.

BUG=None

Review-Url: https://codereview.chromium.org/2606023003
Cr-Commit-Position: refs/heads/master@{#440966}
parent 3c03c1c3
...@@ -1674,10 +1674,16 @@ void SearchEngineObserver::OnTemplateURLServiceChanged() { ...@@ -1674,10 +1674,16 @@ void SearchEngineObserver::OnTemplateURLServiceChanged() {
_most_visited_sites->AddOrRemoveBlacklistedUrl(url, false); _most_visited_sites->AddOrRemoveBlacklistedUrl(url, false);
} }
#pragma mark - GoogleLandingController (ExposedForTesting) methods.
- (BOOL)scrolledToTop { - (BOOL)scrolledToTop {
return _scrolledToTop; return _scrolledToTop;
} }
- (BOOL)animateHeader {
return _animateHeader;
}
#pragma mark - OverscrollActionsControllerDelegate #pragma mark - OverscrollActionsControllerDelegate
- (void)overscrollActionsController:(OverscrollActionsController*)controller - (void)overscrollActionsController:(OverscrollActionsController*)controller
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
@interface GoogleLandingController (ExposedForTesting) @interface GoogleLandingController (ExposedForTesting)
- (BOOL)scrolledToTop; - (BOOL)scrolledToTop;
- (BOOL)animateHeader;
@end @end
namespace { namespace {
...@@ -86,6 +87,11 @@ void AssertNTPScrolledToTop(bool scrolledToTop) { ...@@ -86,6 +87,11 @@ void AssertNTPScrolledToTop(bool scrolledToTop) {
chrome_test_util::GetCurrentNewTabPageController(); chrome_test_util::GetCurrentNewTabPageController();
GoogleLandingController* google_landing_controller = GoogleLandingController* google_landing_controller =
[ntp_controller googleLandingController]; [ntp_controller googleLandingController];
[[GREYCondition
conditionWithName:@"Wait for end of animation."
block:^BOOL {
return ![google_landing_controller animateHeader];
}] waitWithTimeout:testing::kWaitForUIElementTimeout];
GREYAssertTrue([google_landing_controller scrolledToTop] == scrolledToTop, GREYAssertTrue([google_landing_controller scrolledToTop] == scrolledToTop,
@"scrolledToTop_ does not match expected value"); @"scrolledToTop_ does not match expected value");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment