| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/public/test/fakes/test_web_state_delegate.h" | 5 #import "ios/web/public/test/fakes/test_web_state_delegate.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 | 8 |
| 9 namespace web { | 9 namespace web { |
| 10 | 10 |
| 11 TestRepostFormRequest::TestRepostFormRequest() {} |
| 12 |
| 13 TestRepostFormRequest::~TestRepostFormRequest() = default; |
| 14 |
| 15 TestRepostFormRequest::TestRepostFormRequest(const TestRepostFormRequest&) = |
| 16 default; |
| 17 |
| 11 TestAuthenticationRequest::TestAuthenticationRequest() {} | 18 TestAuthenticationRequest::TestAuthenticationRequest() {} |
| 12 | 19 |
| 13 TestAuthenticationRequest::~TestAuthenticationRequest() = default; | 20 TestAuthenticationRequest::~TestAuthenticationRequest() = default; |
| 14 | 21 |
| 15 TestWebStateDelegate::TestWebStateDelegate() {} | 22 TestWebStateDelegate::TestWebStateDelegate() {} |
| 16 | 23 |
| 17 TestWebStateDelegate::~TestWebStateDelegate() = default; | 24 TestWebStateDelegate::~TestWebStateDelegate() = default; |
| 18 | 25 |
| 19 JavaScriptDialogPresenter* TestWebStateDelegate::GetJavaScriptDialogPresenter( | 26 JavaScriptDialogPresenter* TestWebStateDelegate::GetJavaScriptDialogPresenter( |
| 20 WebState*) { | 27 WebState*) { |
| 21 get_java_script_dialog_presenter_called_ = true; | 28 get_java_script_dialog_presenter_called_ = true; |
| 22 return &java_script_dialog_presenter_; | 29 return &java_script_dialog_presenter_; |
| 23 } | 30 } |
| 24 | 31 |
| 25 void TestWebStateDelegate::LoadProgressChanged(WebState*, double) { | 32 void TestWebStateDelegate::LoadProgressChanged(WebState*, double) { |
| 26 load_progress_changed_called_ = true; | 33 load_progress_changed_called_ = true; |
| 27 } | 34 } |
| 28 | 35 |
| 29 bool TestWebStateDelegate::HandleContextMenu(WebState*, | 36 bool TestWebStateDelegate::HandleContextMenu(WebState*, |
| 30 const ContextMenuParams&) { | 37 const ContextMenuParams&) { |
| 31 handle_context_menu_called_ = true; | 38 handle_context_menu_called_ = true; |
| 32 return NO; | 39 return NO; |
| 33 } | 40 } |
| 34 | 41 |
| 42 void TestWebStateDelegate::ShowRepostFormWarningDialog( |
| 43 WebState* source, |
| 44 const base::Callback<void(bool)>& callback) { |
| 45 last_repost_form_request_ = base::MakeUnique<TestRepostFormRequest>(); |
| 46 last_repost_form_request_->web_state = source; |
| 47 last_repost_form_request_->callback = callback; |
| 48 } |
| 49 |
| 35 TestJavaScriptDialogPresenter* | 50 TestJavaScriptDialogPresenter* |
| 36 TestWebStateDelegate::GetTestJavaScriptDialogPresenter() { | 51 TestWebStateDelegate::GetTestJavaScriptDialogPresenter() { |
| 37 return &java_script_dialog_presenter_; | 52 return &java_script_dialog_presenter_; |
| 38 } | 53 } |
| 39 | 54 |
| 40 void TestWebStateDelegate::OnAuthRequired( | 55 void TestWebStateDelegate::OnAuthRequired( |
| 41 WebState* source, | 56 WebState* source, |
| 42 NSURLProtectionSpace* protection_space, | 57 NSURLProtectionSpace* protection_space, |
| 43 NSURLCredential* credential, | 58 NSURLCredential* credential, |
| 44 const AuthCallback& callback) { | 59 const AuthCallback& callback) { |
| 45 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>(); | 60 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>(); |
| 46 last_authentication_request_->web_state = source; | 61 last_authentication_request_->web_state = source; |
| 47 last_authentication_request_->protection_space.reset( | 62 last_authentication_request_->protection_space.reset( |
| 48 [protection_space retain]); | 63 [protection_space retain]); |
| 49 last_authentication_request_->credential.reset([credential retain]); | 64 last_authentication_request_->credential.reset([credential retain]); |
| 50 last_authentication_request_->auth_callback = callback; | 65 last_authentication_request_->auth_callback = callback; |
| 51 } | 66 } |
| 52 | 67 |
| 53 } // namespace web | 68 } // namespace web |
| OLD | NEW |