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/renderer/credential_manager_client
.h" | 5 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 bindings_.AddBinding(this, std::move(request)); | 44 bindings_.AddBinding(this, std::move(request)); |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 // mojom::CredentialManager methods: | 48 // mojom::CredentialManager methods: |
49 void Store(const CredentialInfo& credential, | 49 void Store(const CredentialInfo& credential, |
50 StoreCallback callback) override { | 50 StoreCallback callback) override { |
51 std::move(callback).Run(); | 51 std::move(callback).Run(); |
52 } | 52 } |
53 | 53 |
54 void RequireUserMediation(RequireUserMediationCallback callback) override { | 54 void PreventSilentAccess(PreventSilentAccessCallback callback) override { |
55 std::move(callback).Run(); | 55 std::move(callback).Run(); |
56 } | 56 } |
57 | 57 |
58 void Get(CredentialMediationRequirement mediation, | 58 void Get(CredentialMediationRequirement mediation, |
59 bool include_passwords, | 59 bool include_passwords, |
60 const std::vector<GURL>& federations, | 60 const std::vector<GURL>& federations, |
61 GetCallback callback) override { | 61 GetCallback callback) override { |
62 const std::string& url = federations[0].spec(); | 62 const std::string& url = federations[0].spec(); |
63 | 63 |
64 if (url == kTestCredentialPassword) { | 64 if (url == kTestCredentialPassword) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 RunAllPendingTasks(); | 190 RunAllPendingTasks(); |
191 | 191 |
192 EXPECT_TRUE(callback_succeeded()); | 192 EXPECT_TRUE(callback_succeeded()); |
193 EXPECT_FALSE(callback_errored()); | 193 EXPECT_FALSE(callback_errored()); |
194 } | 194 } |
195 | 195 |
196 TEST_F(CredentialManagerClientTest, SendRequestUserMediation) { | 196 TEST_F(CredentialManagerClientTest, SendRequestUserMediation) { |
197 std::unique_ptr<TestNotificationCallbacks> callbacks( | 197 std::unique_ptr<TestNotificationCallbacks> callbacks( |
198 new TestNotificationCallbacks(this)); | 198 new TestNotificationCallbacks(this)); |
199 client_->DispatchRequireUserMediation(callbacks.release()); | 199 client_->DispatchPreventSilentAccess(callbacks.release()); |
200 | 200 |
201 RunAllPendingTasks(); | 201 RunAllPendingTasks(); |
202 | 202 |
203 EXPECT_TRUE(callback_succeeded()); | 203 EXPECT_TRUE(callback_succeeded()); |
204 EXPECT_FALSE(callback_errored()); | 204 EXPECT_FALSE(callback_errored()); |
205 } | 205 } |
206 | 206 |
207 TEST_F(CredentialManagerClientTest, SendRequestCredential) { | 207 TEST_F(CredentialManagerClientTest, SendRequestCredential) { |
208 std::unique_ptr<TestRequestCallbacks> callbacks( | 208 std::unique_ptr<TestRequestCallbacks> callbacks( |
209 new TestRequestCallbacks(this)); | 209 new TestRequestCallbacks(this)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 EXPECT_FALSE(callback_succeeded()); | 248 EXPECT_FALSE(callback_succeeded()); |
249 EXPECT_TRUE(callback_errored()); | 249 EXPECT_TRUE(callback_errored()); |
250 EXPECT_FALSE(credential_); | 250 EXPECT_FALSE(credential_); |
251 EXPECT_EQ(blink::WebCredentialManagerError:: | 251 EXPECT_EQ(blink::WebCredentialManagerError:: |
252 kWebCredentialManagerPasswordStoreUnavailableError, | 252 kWebCredentialManagerPasswordStoreUnavailableError, |
253 error_); | 253 error_); |
254 } | 254 } |
255 | 255 |
256 } // namespace password_manager | 256 } // namespace password_manager |
OLD | NEW |