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

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

Issue 2806743004: Fixing testBrowsingPostEntryWithButton flakiness. (Closed)
Patch Set: Created 3 years, 8 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
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 "ios/chrome/test/earl_grey/chrome_earl_grey.h" 5 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #import <WebKit/WebKit.h> 8 #import <WebKit/WebKit.h>
9 9
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #import "base/test/ios/wait_util.h" 12 #import "base/test/ios/wait_util.h"
13 #include "components/strings/grit/components_strings.h" 13 #include "components/strings/grit/components_strings.h"
14 #import "ios/chrome/browser/ui/static_content/static_html_view_controller.h" 14 #import "ios/chrome/browser/ui/static_content/static_html_view_controller.h"
15 #import "ios/chrome/test/app/chrome_test_util.h" 15 #import "ios/chrome/test/app/chrome_test_util.h"
16 #import "ios/chrome/test/app/history_test_util.h" 16 #import "ios/chrome/test/app/history_test_util.h"
17 #include "ios/chrome/test/app/navigation_test_util.h" 17 #include "ios/chrome/test/app/navigation_test_util.h"
18 #import "ios/chrome/test/app/static_html_view_test_util.h" 18 #import "ios/chrome/test/app/static_html_view_test_util.h"
19 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
19 #import "ios/testing/wait_util.h" 20 #import "ios/testing/wait_util.h"
20 #import "ios/web/public/test/earl_grey/js_test_util.h" 21 #import "ios/web/public/test/earl_grey/js_test_util.h"
21 #import "ios/web/public/test/web_view_interaction_test_util.h" 22 #import "ios/web/public/test/web_view_interaction_test_util.h"
22 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" 23 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
23 #import "ios/web/public/web_state/web_state.h" 24 #import "ios/web/public/web_state/web_state.h"
24 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
25 26
26 #if !defined(__has_feature) || !__has_feature(objc_arc) 27 #if !defined(__has_feature) || !__has_feature(objc_arc)
27 #error "This file requires ARC support." 28 #error "This file requires ARC support."
28 #endif 29 #endif
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 conditionWithName:@"Wait for absence of static HTML text." 154 conditionWithName:@"Wait for absence of static HTML text."
154 block:^BOOL { 155 block:^BOOL {
155 return !chrome_test_util::StaticHtmlViewContainingText( 156 return !chrome_test_util::StaticHtmlViewContainingText(
156 chrome_test_util::GetCurrentWebState(), 157 chrome_test_util::GetCurrentWebState(),
157 base::SysNSStringToUTF8(text)); 158 base::SysNSStringToUTF8(text));
158 }]; 159 }];
159 GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout], 160 GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout],
160 @"Failed, there was a static html view containing %@", text); 161 @"Failed, there was a static html view containing %@", text);
161 } 162 }
162 163
164 + (void)waitForOmniboxText:(NSString*)text {
165 GREYCondition* condition = [GREYCondition
166 conditionWithName:@"Wait for omnibox text."
167 block:^BOOL {
168 NSError* error = nil;
169 [[EarlGrey
170 selectElementWithMatcher:chrome_test_util::OmniboxText(
171 base::SysNSStringToUTF8(
172 text))]
gchatz 2017/04/08 00:17:05 Could the matcher be made a local variable to have
Eugene But (OOO till 7-30) 2017/04/08 00:20:36 Using functions for matchers instead of local vari
liaoyuke 2017/04/08 00:43:07 replied in another comment, will make the change i
173 assertWithMatcher:grey_notNil()
174 error:&error];
175 return error == nil;
176 }];
177 GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout],
178 @"Failed, omnibox was not %@", text);
179 }
180
163 @end 181 @end
OLDNEW
« ios/chrome/browser/web/forms_egtest.mm ('K') | « ios/chrome/test/earl_grey/chrome_earl_grey.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698