| 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/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/web/public/test/earl_grey/js_test_util.h" | 9 #import "ios/web/public/test/earl_grey/js_test_util.h" |
| 10 #include "ios/web/shell/test/app/navigation_test_util.h" | 10 #include "ios/web/shell/test/app/navigation_test_util.h" |
| 11 #import "ios/web/shell/test/app/web_shell_test_util.h" | 11 #import "ios/web/shell/test/app/web_shell_test_util.h" |
| 12 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
| 13 namespace { | 17 namespace { |
| 14 const NSTimeInterval kWaitForPageLoadTimeout = 10.0; | 18 const NSTimeInterval kWaitForPageLoadTimeout = 10.0; |
| 15 } // namespace | 19 } // namespace |
| 16 | 20 |
| 17 @implementation ShellEarlGrey | 21 @implementation ShellEarlGrey |
| 18 | 22 |
| 19 + (void)loadURL:(const GURL&)URL { | 23 + (void)loadURL:(const GURL&)URL { |
| 20 web::shell_test_util::LoadUrl(URL); | 24 web::shell_test_util::LoadUrl(URL); |
| 21 | 25 |
| 22 // Make sure that the page started loading. | 26 // Make sure that the page started loading. |
| 23 GREYAssert(web::shell_test_util::IsLoading(), @"Page did not start loading."); | 27 GREYAssert(web::shell_test_util::IsLoading(), @"Page did not start loading."); |
| 24 | 28 |
| 25 GREYCondition* condition = | 29 GREYCondition* condition = |
| 26 [GREYCondition conditionWithName:@"Wait for page to complete loading." | 30 [GREYCondition conditionWithName:@"Wait for page to complete loading." |
| 27 block:^BOOL { | 31 block:^BOOL { |
| 28 return !web::shell_test_util::IsLoading(); | 32 return !web::shell_test_util::IsLoading(); |
| 29 }]; | 33 }]; |
| 30 GREYAssert([condition waitWithTimeout:kWaitForPageLoadTimeout], | 34 GREYAssert([condition waitWithTimeout:kWaitForPageLoadTimeout], |
| 31 @"Page did not complete loading."); | 35 @"Page did not complete loading."); |
| 32 | 36 |
| 33 web::WebState* webState = web::shell_test_util::GetCurrentWebState(); | 37 web::WebState* webState = web::shell_test_util::GetCurrentWebState(); |
| 34 if (webState->ContentIsHTML()) | 38 if (webState->ContentIsHTML()) |
| 35 web::WaitUntilWindowIdInjected(webState); | 39 web::WaitUntilWindowIdInjected(webState); |
| 36 } | 40 } |
| 37 | 41 |
| 38 @end | 42 @end |
| OLD | NEW |