| 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 TestAuthenticationRequest::TestAuthenticationRequest( | 22 TestAuthenticationRequest::TestAuthenticationRequest( |
| 16 const TestAuthenticationRequest&) = default; | 23 const TestAuthenticationRequest&) = default; |
| 17 | 24 |
| 18 TestWebStateDelegate::TestWebStateDelegate() {} | 25 TestWebStateDelegate::TestWebStateDelegate() {} |
| 19 | 26 |
| 20 TestWebStateDelegate::~TestWebStateDelegate() = default; | 27 TestWebStateDelegate::~TestWebStateDelegate() = default; |
| 21 | 28 |
| 22 JavaScriptDialogPresenter* TestWebStateDelegate::GetJavaScriptDialogPresenter( | 29 JavaScriptDialogPresenter* TestWebStateDelegate::GetJavaScriptDialogPresenter( |
| 23 WebState*) { | 30 WebState*) { |
| 24 get_java_script_dialog_presenter_called_ = true; | 31 get_java_script_dialog_presenter_called_ = true; |
| 25 return &java_script_dialog_presenter_; | 32 return &java_script_dialog_presenter_; |
| 26 } | 33 } |
| 27 | 34 |
| 28 void TestWebStateDelegate::LoadProgressChanged(WebState*, double) { | 35 void TestWebStateDelegate::LoadProgressChanged(WebState*, double) { |
| 29 load_progress_changed_called_ = true; | 36 load_progress_changed_called_ = true; |
| 30 } | 37 } |
| 31 | 38 |
| 32 bool TestWebStateDelegate::HandleContextMenu(WebState*, | 39 bool TestWebStateDelegate::HandleContextMenu(WebState*, |
| 33 const ContextMenuParams&) { | 40 const ContextMenuParams&) { |
| 34 handle_context_menu_called_ = true; | 41 handle_context_menu_called_ = true; |
| 35 return NO; | 42 return NO; |
| 36 } | 43 } |
| 37 | 44 |
| 45 void TestWebStateDelegate::ShowRepostFormWarningDialog( |
| 46 WebState* source, |
| 47 const base::Callback<void(bool)>& callback) { |
| 48 last_repost_form_request_ = base::MakeUnique<TestRepostFormRequest>(); |
| 49 last_repost_form_request_->web_state = source; |
| 50 last_repost_form_request_->callback = callback; |
| 51 } |
| 52 |
| 38 TestJavaScriptDialogPresenter* | 53 TestJavaScriptDialogPresenter* |
| 39 TestWebStateDelegate::GetTestJavaScriptDialogPresenter() { | 54 TestWebStateDelegate::GetTestJavaScriptDialogPresenter() { |
| 40 return &java_script_dialog_presenter_; | 55 return &java_script_dialog_presenter_; |
| 41 } | 56 } |
| 42 | 57 |
| 43 void TestWebStateDelegate::OnAuthRequired( | 58 void TestWebStateDelegate::OnAuthRequired( |
| 44 WebState* source, | 59 WebState* source, |
| 45 NSURLProtectionSpace* protection_space, | 60 NSURLProtectionSpace* protection_space, |
| 46 NSURLCredential* credential, | 61 NSURLCredential* credential, |
| 47 const AuthCallback& callback) { | 62 const AuthCallback& callback) { |
| 48 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>(); | 63 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>(); |
| 49 last_authentication_request_->web_state = source; | 64 last_authentication_request_->web_state = source; |
| 50 last_authentication_request_->protection_space.reset( | 65 last_authentication_request_->protection_space.reset( |
| 51 [protection_space retain]); | 66 [protection_space retain]); |
| 52 last_authentication_request_->credential.reset([credential retain]); | 67 last_authentication_request_->credential.reset([credential retain]); |
| 53 last_authentication_request_->auth_callback = callback; | 68 last_authentication_request_->auth_callback = callback; |
| 54 } | 69 } |
| 55 | 70 |
| 56 } // namespace web | 71 } // namespace web |
| OLD | NEW |