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

Side by Side Diff: ios/web/shell/test/earl_grey/shell_earl_grey.mm

Issue 2798773002: Create ChromeEarlGrey waitForWebViewContainingText. (Closed)
Patch Set: review comments Created 3 years, 6 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/web/shell/test/earl_grey/shell_earl_grey.h" 5 #import "ios/web/shell/test/earl_grey/shell_earl_grey.h"
6 6
7 #import <EarlGrey/EarlGrey.h> 7 #import <EarlGrey/EarlGrey.h>
8 8
9 #import "ios/testing/wait_util.h" 9 #import "ios/testing/wait_util.h"
10 #import "ios/web/public/test/earl_grey/js_test_util.h" 10 #import "ios/web/public/test/earl_grey/js_test_util.h"
11 #import "ios/web/public/test/web_view_content_test_util.h"
11 #include "ios/web/shell/test/app/navigation_test_util.h" 12 #include "ios/web/shell/test/app/navigation_test_util.h"
12 #import "ios/web/shell/test/app/web_shell_test_util.h" 13 #import "ios/web/shell/test/app/web_shell_test_util.h"
13 14
14 #if !defined(__has_feature) || !__has_feature(objc_arc) 15 #if !defined(__has_feature) || !__has_feature(objc_arc)
15 #error "This file requires ARC support." 16 #error "This file requires ARC support."
16 #endif 17 #endif
17 18
18 @implementation ShellEarlGrey 19 @implementation ShellEarlGrey
19 20
20 + (void)loadURL:(const GURL&)URL { 21 + (void)loadURL:(const GURL&)URL {
(...skipping 12 matching lines...) Expand all
33 34
34 web::WebState* webState = web::shell_test_util::GetCurrentWebState(); 35 web::WebState* webState = web::shell_test_util::GetCurrentWebState();
35 if (webState->ContentIsHTML()) 36 if (webState->ContentIsHTML())
36 web::WaitUntilWindowIdInjected(webState); 37 web::WaitUntilWindowIdInjected(webState);
37 38
38 // Ensure any UI elements handled by EarlGrey become idle for any subsequent 39 // Ensure any UI elements handled by EarlGrey become idle for any subsequent
39 // EarlGrey steps. 40 // EarlGrey steps.
40 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 41 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
41 } 42 }
42 43
44 + (void)waitForWebViewContainingText:(std::string)text {
45 GREYCondition* condition = [GREYCondition
46 conditionWithName:@"Wait for web view containing text"
47 block:^BOOL {
48 return web::test::IsWebViewContainingText(
49 web::shell_test_util::GetCurrentWebState(), text);
50 }];
51 GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout],
52 @"Failed waiting for web view containing %s", text.c_str());
53 }
54
43 @end 55 @end
OLDNEW
« no previous file with comments | « ios/web/shell/test/earl_grey/shell_earl_grey.h ('k') | ios/web/shell/test/earl_grey/web_shell_test_case.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698