| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/content/browser/content_credential_manager
_dispatcher.h" | 5 #include "components/password_manager/content/browser/content_credential_manager
_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 : public password_manager::StubPasswordManagerClient { | 32 : public password_manager::StubPasswordManagerClient { |
| 33 public: | 33 public: |
| 34 TestPasswordManagerClient(password_manager::PasswordStore* store) | 34 TestPasswordManagerClient(password_manager::PasswordStore* store) |
| 35 : did_prompt_user_to_save_(false), store_(store) {} | 35 : did_prompt_user_to_save_(false), store_(store) {} |
| 36 ~TestPasswordManagerClient() override {} | 36 ~TestPasswordManagerClient() override {} |
| 37 | 37 |
| 38 password_manager::PasswordStore* GetPasswordStore() override { | 38 password_manager::PasswordStore* GetPasswordStore() override { |
| 39 return store_; | 39 return store_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 password_manager::PasswordManagerDriver* GetDriver() override { | |
| 43 return &driver_; | |
| 44 } | |
| 45 | |
| 46 bool PromptUserToSavePassword( | 42 bool PromptUserToSavePassword( |
| 47 scoped_ptr<password_manager::PasswordFormManager> manager) override { | 43 scoped_ptr<password_manager::PasswordFormManager> manager) override { |
| 48 did_prompt_user_to_save_ = true; | 44 did_prompt_user_to_save_ = true; |
| 49 manager_.reset(manager.release()); | 45 manager_.reset(manager.release()); |
| 50 return true; | 46 return true; |
| 51 } | 47 } |
| 52 | 48 |
| 53 bool did_prompt_user_to_save() const { return did_prompt_user_to_save_; } | 49 bool did_prompt_user_to_save() const { return did_prompt_user_to_save_; } |
| 54 | 50 |
| 55 password_manager::PasswordFormManager* pending_manager() const { | 51 password_manager::PasswordFormManager* pending_manager() const { |
| 56 return manager_.get(); | 52 return manager_.get(); |
| 57 } | 53 } |
| 58 | 54 |
| 59 private: | 55 private: |
| 60 bool did_prompt_user_to_save_; | 56 bool did_prompt_user_to_save_; |
| 61 password_manager::PasswordStore* store_; | 57 password_manager::PasswordStore* store_; |
| 62 password_manager::StubPasswordManagerDriver driver_; | |
| 63 scoped_ptr<password_manager::PasswordFormManager> manager_; | 58 scoped_ptr<password_manager::PasswordFormManager> manager_; |
| 64 }; | 59 }; |
| 65 | 60 |
| 66 void RunAllPendingTasks() { | 61 void RunAllPendingTasks() { |
| 67 base::RunLoop run_loop; | 62 base::RunLoop run_loop; |
| 68 base::MessageLoop::current()->PostTask( | 63 base::MessageLoop::current()->PostTask( |
| 69 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 64 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 70 run_loop.Run(); | 65 run_loop.Run(); |
| 71 } | 66 } |
| 72 | 67 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 message = process()->sink().GetFirstMessageMatching(kMsgID); | 221 message = process()->sink().GetFirstMessageMatching(kMsgID); |
| 227 EXPECT_TRUE(message); | 222 EXPECT_TRUE(message); |
| 228 CredentialManagerMsg_SendCredential::Param send_param; | 223 CredentialManagerMsg_SendCredential::Param send_param; |
| 229 CredentialManagerMsg_SendCredential::Read(message, &send_param); | 224 CredentialManagerMsg_SendCredential::Read(message, &send_param); |
| 230 CredentialManagerMsg_SendCredential::Read(message, &send_param); | 225 CredentialManagerMsg_SendCredential::Read(message, &send_param); |
| 231 EXPECT_NE(CREDENTIAL_TYPE_EMPTY, send_param.b.type); | 226 EXPECT_NE(CREDENTIAL_TYPE_EMPTY, send_param.b.type); |
| 232 process()->sink().ClearMessages(); | 227 process()->sink().ClearMessages(); |
| 233 } | 228 } |
| 234 | 229 |
| 235 } // namespace password_manager | 230 } // namespace password_manager |
| OLD | NEW |