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 15 matching lines...) Expand all Loading... |
26 // Chosen by fair dice roll. Guaranteed to be random. | 26 // Chosen by fair dice roll. Guaranteed to be random. |
27 const int kRequestId = 4; | 27 const int kRequestId = 4; |
28 | 28 |
29 class TestPasswordManagerClient | 29 class TestPasswordManagerClient |
30 : public password_manager::StubPasswordManagerClient { | 30 : public password_manager::StubPasswordManagerClient { |
31 public: | 31 public: |
32 TestPasswordManagerClient(password_manager::PasswordStore* store) | 32 TestPasswordManagerClient(password_manager::PasswordStore* store) |
33 : store_(store) {} | 33 : store_(store) {} |
34 virtual ~TestPasswordManagerClient() {} | 34 virtual ~TestPasswordManagerClient() {} |
35 | 35 |
36 virtual password_manager::PasswordStore* GetPasswordStore() OVERRIDE { | 36 virtual password_manager::PasswordStore* GetPasswordStore() override { |
37 return store_; | 37 return store_; |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 password_manager::PasswordStore* store_; | 41 password_manager::PasswordStore* store_; |
42 }; | 42 }; |
43 | 43 |
44 void RunAllPendingTasks() { | 44 void RunAllPendingTasks() { |
45 base::RunLoop run_loop; | 45 base::RunLoop run_loop; |
46 base::MessageLoop::current()->PostTask( | 46 base::MessageLoop::current()->PostTask( |
(...skipping 23 matching lines...) Expand all Loading... |
70 form_.display_name = base::ASCIIToUTF16("Display Name"); | 70 form_.display_name = base::ASCIIToUTF16("Display Name"); |
71 form_.password_value = base::ASCIIToUTF16("Password"); | 71 form_.password_value = base::ASCIIToUTF16("Password"); |
72 form_.origin = web_contents()->GetLastCommittedURL().GetOrigin(); | 72 form_.origin = web_contents()->GetLastCommittedURL().GetOrigin(); |
73 form_.signon_realm = form_.origin.spec(); | 73 form_.signon_realm = form_.origin.spec(); |
74 form_.scheme = autofill::PasswordForm::SCHEME_HTML; | 74 form_.scheme = autofill::PasswordForm::SCHEME_HTML; |
75 | 75 |
76 store_->Clear(); | 76 store_->Clear(); |
77 EXPECT_TRUE(store_->IsEmpty()); | 77 EXPECT_TRUE(store_->IsEmpty()); |
78 } | 78 } |
79 | 79 |
80 virtual void TearDown() OVERRIDE { | 80 virtual void TearDown() override { |
81 store_->Shutdown(); | 81 store_->Shutdown(); |
82 content::RenderViewHostTestHarness::TearDown(); | 82 content::RenderViewHostTestHarness::TearDown(); |
83 } | 83 } |
84 | 84 |
85 ContentCredentialManagerDispatcher* dispatcher() { return dispatcher_.get(); } | 85 ContentCredentialManagerDispatcher* dispatcher() { return dispatcher_.get(); } |
86 | 86 |
87 protected: | 87 protected: |
88 autofill::PasswordForm form_; | 88 autofill::PasswordForm form_; |
89 scoped_refptr<TestPasswordStore> store_; | 89 scoped_refptr<TestPasswordStore> store_; |
90 scoped_ptr<ContentCredentialManagerDispatcher> dispatcher_; | 90 scoped_ptr<ContentCredentialManagerDispatcher> dispatcher_; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 RunAllPendingTasks(); | 191 RunAllPendingTasks(); |
192 | 192 |
193 // Check that the first request resolves. | 193 // Check that the first request resolves. |
194 kMsgID = CredentialManagerMsg_SendCredential::ID; | 194 kMsgID = CredentialManagerMsg_SendCredential::ID; |
195 message = process()->sink().GetFirstMessageMatching(kMsgID); | 195 message = process()->sink().GetFirstMessageMatching(kMsgID); |
196 EXPECT_TRUE(message); | 196 EXPECT_TRUE(message); |
197 process()->sink().ClearMessages(); | 197 process()->sink().ClearMessages(); |
198 } | 198 } |
199 | 199 |
200 } // namespace password_manager | 200 } // namespace password_manager |
OLD | NEW |