OLD | NEW |
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" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 + (void)loadURL:(const GURL&)URL { | 108 + (void)loadURL:(const GURL&)URL { |
109 chrome_test_util::LoadUrl(URL); | 109 chrome_test_util::LoadUrl(URL); |
110 [ChromeEarlGrey waitForPageToFinishLoading]; | 110 [ChromeEarlGrey waitForPageToFinishLoading]; |
111 | 111 |
112 web::WebState* webState = chrome_test_util::GetCurrentWebState(); | 112 web::WebState* webState = chrome_test_util::GetCurrentWebState(); |
113 if (webState->ContentIsHTML()) | 113 if (webState->ContentIsHTML()) |
114 web::WaitUntilWindowIdInjected(webState); | 114 web::WaitUntilWindowIdInjected(webState); |
115 } | 115 } |
116 | 116 |
117 + (void)reload { | 117 + (void)reload { |
118 base::scoped_nsobject<GenericChromeCommand> reloadCommand( | 118 [chrome_test_util::BrowserCommandDispatcherForMainBVC() reload]; |
119 [[GenericChromeCommand alloc] initWithTag:IDC_RELOAD]); | |
120 chrome_test_util::RunCommandWithActiveViewController(reloadCommand); | |
121 [ChromeEarlGrey waitForPageToFinishLoading]; | 119 [ChromeEarlGrey waitForPageToFinishLoading]; |
122 } | 120 } |
123 | 121 |
124 + (void)goBack { | 122 + (void)goBack { |
125 [chrome_test_util::BrowserCommandDispatcherForMainBVC() goBack]; | 123 [chrome_test_util::BrowserCommandDispatcherForMainBVC() goBack]; |
126 | 124 |
127 [ChromeEarlGrey waitForPageToFinishLoading]; | 125 [ChromeEarlGrey waitForPageToFinishLoading]; |
128 } | 126 } |
129 | 127 |
130 + (void)goForward { | 128 + (void)goForward { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 GREYCondition* condition = [GREYCondition | 194 GREYCondition* condition = [GREYCondition |
197 conditionWithName:@"Wait for web view not containing text" | 195 conditionWithName:@"Wait for web view not containing text" |
198 block:^BOOL { | 196 block:^BOOL { |
199 return !web::test::IsWebViewContainingText( | 197 return !web::test::IsWebViewContainingText( |
200 chrome_test_util::GetCurrentWebState(), text); | 198 chrome_test_util::GetCurrentWebState(), text); |
201 }]; | 199 }]; |
202 GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout], | 200 GREYAssert([condition waitWithTimeout:testing::kWaitForUIElementTimeout], |
203 @"Failed waiting for web view not containing %s", text.c_str()); | 201 @"Failed waiting for web view not containing %s", text.c_str()); |
204 } | 202 } |
205 @end | 203 @end |
OLD | NEW |