| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/password_manager/password_manager_test_base.h" | 5 #include "chrome/browser/password_manager/password_manager_test_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // ManagePasswordsUIController subclass to capture the UI events. | 58 // ManagePasswordsUIController subclass to capture the UI events. |
| 59 class CustomManagePasswordsUIController : public ManagePasswordsUIController { | 59 class CustomManagePasswordsUIController : public ManagePasswordsUIController { |
| 60 public: | 60 public: |
| 61 explicit CustomManagePasswordsUIController( | 61 explicit CustomManagePasswordsUIController( |
| 62 content::WebContents* web_contents); | 62 content::WebContents* web_contents); |
| 63 | 63 |
| 64 void WaitForState(password_manager::ui::State target_state); | 64 void WaitForState(password_manager::ui::State target_state); |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 // PasswordsClientUIDelegate: | 67 // PasswordsClientUIDelegate: |
| 68 void OnPasswordSubmitted( | 68 void OnPasswordSubmitted(scoped_refptr<password_manager::PasswordFormManager> |
| 69 std::unique_ptr<password_manager::PasswordFormManager> form_manager) | 69 form_manager) override; |
| 70 override; | |
| 71 bool OnChooseCredentials( | 70 bool OnChooseCredentials( |
| 72 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials, | 71 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials, |
| 73 const GURL& origin, | 72 const GURL& origin, |
| 74 const ManagePasswordsState::CredentialsCallback& callback) override; | 73 const ManagePasswordsState::CredentialsCallback& callback) override; |
| 75 void OnPasswordAutofilled( | 74 void OnPasswordAutofilled( |
| 76 const std::map<base::string16, const autofill::PasswordForm*>& | 75 const std::map<base::string16, const autofill::PasswordForm*>& |
| 77 password_form_map, | 76 password_form_map, |
| 78 const GURL& origin, | 77 const GURL& origin, |
| 79 const std::vector<const autofill::PasswordForm*>* federated_matches) | 78 const std::vector<const autofill::PasswordForm*>* federated_matches) |
| 80 override; | 79 override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 | 102 |
| 104 void CustomManagePasswordsUIController::WaitForState( | 103 void CustomManagePasswordsUIController::WaitForState( |
| 105 password_manager::ui::State target_state) { | 104 password_manager::ui::State target_state) { |
| 106 base::RunLoop run_loop; | 105 base::RunLoop run_loop; |
| 107 target_state_ = target_state; | 106 target_state_ = target_state; |
| 108 run_loop_ = &run_loop; | 107 run_loop_ = &run_loop; |
| 109 run_loop_->Run(); | 108 run_loop_->Run(); |
| 110 } | 109 } |
| 111 | 110 |
| 112 void CustomManagePasswordsUIController::OnPasswordSubmitted( | 111 void CustomManagePasswordsUIController::OnPasswordSubmitted( |
| 113 std::unique_ptr<password_manager::PasswordFormManager> form_manager) { | 112 scoped_refptr<password_manager::PasswordFormManager> form_manager) { |
| 114 if (target_state_ == password_manager::ui::PENDING_PASSWORD_STATE) { | 113 if (target_state_ == password_manager::ui::PENDING_PASSWORD_STATE) { |
| 115 run_loop_->Quit(); | 114 run_loop_->Quit(); |
| 116 run_loop_ = nullptr; | 115 run_loop_ = nullptr; |
| 117 target_state_ = password_manager::ui::INACTIVE_STATE; | 116 target_state_ = password_manager::ui::INACTIVE_STATE; |
| 118 } | 117 } |
| 119 return ManagePasswordsUIController::OnPasswordSubmitted( | 118 return ManagePasswordsUIController::OnPasswordSubmitted( |
| 120 std::move(form_manager)); | 119 std::move(form_manager)); |
| 121 } | 120 } |
| 122 | 121 |
| 123 bool CustomManagePasswordsUIController::OnChooseCredentials( | 122 bool CustomManagePasswordsUIController::OnChooseCredentials( |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 487 |
| 489 content::BrowserThread::PostTaskAndReply( | 488 content::BrowserThread::PostTaskAndReply( |
| 490 content::BrowserThread::IO, FROM_HERE, | 489 content::BrowserThread::IO, FROM_HERE, |
| 491 base::BindOnce( | 490 base::BindOnce( |
| 492 &AddHSTSHostImpl, | 491 &AddHSTSHostImpl, |
| 493 make_scoped_refptr(browser()->profile()->GetRequestContext()), host), | 492 make_scoped_refptr(browser()->profile()->GetRequestContext()), host), |
| 494 run_loop.QuitClosure()); | 493 run_loop.QuitClosure()); |
| 495 | 494 |
| 496 run_loop.Run(); | 495 run_loop.Run(); |
| 497 } | 496 } |
| OLD | NEW |