| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/test/web_test.h" | 5 #import "ios/web/test/web_test.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/base64.h" | 9 #include "base/base64.h" |
| 8 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 9 #import "base/test/ios/wait_util.h" | 11 #import "base/test/ios/wait_util.h" |
| 10 #import "ios/testing/ocmock_complex_type_helper.h" | 12 #import "ios/testing/ocmock_complex_type_helper.h" |
| 11 #import "ios/web/navigation/crw_session_controller.h" | 13 #import "ios/web/navigation/crw_session_controller.h" |
| 12 #import "ios/web/net/crw_url_verifying_protocol_handler.h" | 14 #import "ios/web/net/crw_url_verifying_protocol_handler.h" |
| 13 #include "ios/web/public/active_state_manager.h" | 15 #include "ios/web/public/active_state_manager.h" |
| 14 #include "ios/web/public/referrer.h" | 16 #include "ios/web/public/referrer.h" |
| 15 #import "ios/web/public/web_state/ui/crw_web_delegate.h" | 17 #import "ios/web/public/web_state/ui/crw_web_delegate.h" |
| 16 #import "ios/web/web_state/js/crw_js_invoke_parameter_queue.h" | 18 #import "ios/web/web_state/js/crw_js_invoke_parameter_queue.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 258 |
| 257 NSString* WebTestWithWebController::CreateLoadCheck() { | 259 NSString* WebTestWithWebController::CreateLoadCheck() { |
| 258 return [NSString stringWithFormat:@"<p style=\"display: none;\">%d</p>", | 260 return [NSString stringWithFormat:@"<p style=\"display: none;\">%d</p>", |
| 259 s_html_load_count++]; | 261 s_html_load_count++]; |
| 260 } | 262 } |
| 261 | 263 |
| 262 #pragma mark - | 264 #pragma mark - |
| 263 | 265 |
| 264 CRWWebController* WebTestWithUIWebViewWebController::CreateWebController() { | 266 CRWWebController* WebTestWithUIWebViewWebController::CreateWebController() { |
| 265 scoped_ptr<WebStateImpl> web_state_impl(new WebStateImpl(GetBrowserState())); | 267 scoped_ptr<WebStateImpl> web_state_impl(new WebStateImpl(GetBrowserState())); |
| 266 return [[TestWebController alloc] initWithWebState:web_state_impl.Pass()]; | 268 return [[TestWebController alloc] initWithWebState:std::move(web_state_impl)]; |
| 267 } | 269 } |
| 268 | 270 |
| 269 void WebTestWithUIWebViewWebController::LoadCommands(NSString* commands, | 271 void WebTestWithUIWebViewWebController::LoadCommands(NSString* commands, |
| 270 const GURL& origin_url, | 272 const GURL& origin_url, |
| 271 BOOL user_is_interacting) { | 273 BOOL user_is_interacting) { |
| 272 [static_cast<CRWUIWebViewWebController*>(webController_) | 274 [static_cast<CRWUIWebViewWebController*>(webController_) |
| 273 respondToMessageQueue:commands | 275 respondToMessageQueue:commands |
| 274 userIsInteracting:user_is_interacting | 276 userIsInteracting:user_is_interacting |
| 275 originURL:origin_url]; | 277 originURL:origin_url]; |
| 276 } | 278 } |
| 277 | 279 |
| 278 #pragma mark - | 280 #pragma mark - |
| 279 | 281 |
| 280 CRWWebController* WebTestWithWKWebViewWebController::CreateWebController() { | 282 CRWWebController* WebTestWithWKWebViewWebController::CreateWebController() { |
| 281 scoped_ptr<WebStateImpl> web_state_impl(new WebStateImpl(GetBrowserState())); | 283 scoped_ptr<WebStateImpl> web_state_impl(new WebStateImpl(GetBrowserState())); |
| 282 return [[CRWWKWebViewWebController alloc] initWithWebState: | 284 return [[CRWWKWebViewWebController alloc] |
| 283 web_state_impl.Pass()]; | 285 initWithWebState:std::move(web_state_impl)]; |
| 284 } | 286 } |
| 285 | 287 |
| 286 } // namespace web | 288 } // namespace web |
| 287 | 289 |
| 288 #pragma mark - | 290 #pragma mark - |
| 289 | 291 |
| 290 // Declare CRWUIWebViewWebController's (private) implementation of | 292 // Declare CRWUIWebViewWebController's (private) implementation of |
| 291 // UIWebViewDelegate. | 293 // UIWebViewDelegate. |
| 292 @interface CRWUIWebViewWebController(TestProtocolDeclaration)<UIWebViewDelegate> | 294 @interface CRWUIWebViewWebController(TestProtocolDeclaration)<UIWebViewDelegate> |
| 293 @end | 295 @end |
| (...skipping 18 matching lines...) Expand all Loading... |
| 312 _requestIntercepted = true; | 314 _requestIntercepted = true; |
| 313 return false; | 315 return false; |
| 314 } | 316 } |
| 315 BOOL result = [super webView:webView | 317 BOOL result = [super webView:webView |
| 316 shouldStartLoadWithRequest:request | 318 shouldStartLoadWithRequest:request |
| 317 navigationType:navigationType]; | 319 navigationType:navigationType]; |
| 318 _invokeShouldStartLoadWithRequestNavigationTypeDone = true; | 320 _invokeShouldStartLoadWithRequestNavigationTypeDone = true; |
| 319 return result; | 321 return result; |
| 320 } | 322 } |
| 321 @end | 323 @end |
| OLD | NEW |