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/common/credential_manager_messages
.h" | 5 #include "components/password_manager/content/common/credential_manager_messages
.h" |
6 #include "components/password_manager/content/renderer/credential_manager_client
.h" | 6 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
7 #include "content/public/test/render_view_test.h" | 7 #include "content/public/test/render_view_test.h" |
8 #include "ipc/ipc_test_sink.h" | 8 #include "ipc/ipc_test_sink.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/WebKit/public/platform/WebCredential.h" | 10 #include "third_party/WebKit/public/platform/WebCredential.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 break; | 68 break; |
69 } | 69 } |
70 | 70 |
71 case CredentialManagerHostMsg_NotifySignedIn::ID: { | 71 case CredentialManagerHostMsg_NotifySignedIn::ID: { |
72 base::Tuple<int, CredentialInfo> param; | 72 base::Tuple<int, CredentialInfo> param; |
73 CredentialManagerHostMsg_NotifySignedIn::Read(message, ¶m); | 73 CredentialManagerHostMsg_NotifySignedIn::Read(message, ¶m); |
74 request_id = base::get<0>(param); | 74 request_id = base::get<0>(param); |
75 break; | 75 break; |
76 } | 76 } |
77 | 77 |
78 case CredentialManagerHostMsg_NotifySignedOut::ID: { | 78 case CredentialManagerHostMsg_RequireUserMediation::ID: { |
79 base::Tuple<int> param; | 79 base::Tuple<int> param; |
80 CredentialManagerHostMsg_NotifySignedOut::Read(message, ¶m); | 80 CredentialManagerHostMsg_RequireUserMediation::Read(message, ¶m); |
81 request_id = base::get<0>(param); | 81 request_id = base::get<0>(param); |
82 break; | 82 break; |
83 } | 83 } |
84 | 84 |
85 case CredentialManagerHostMsg_RequestCredential::ID: { | 85 case CredentialManagerHostMsg_RequestCredential::ID: { |
86 base::Tuple<int, bool, std::vector<GURL>> param; | 86 base::Tuple<int, bool, std::vector<GURL>> param; |
87 CredentialManagerHostMsg_RequestCredential::Read(message, ¶m); | 87 CredentialManagerHostMsg_RequestCredential::Read(message, ¶m); |
88 request_id = base::get<0>(param); | 88 request_id = base::get<0>(param); |
89 break; | 89 break; |
90 } | 90 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 client_->dispatchSignedIn(*credential(), callbacks.release()); | 182 client_->dispatchSignedIn(*credential(), callbacks.release()); |
183 | 183 |
184 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedIn::ID, | 184 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedIn::ID, |
185 request_id)); | 185 request_id)); |
186 | 186 |
187 client_->OnAcknowledgeSignedIn(request_id); | 187 client_->OnAcknowledgeSignedIn(request_id); |
188 EXPECT_TRUE(callback_succeeded()); | 188 EXPECT_TRUE(callback_succeeded()); |
189 EXPECT_FALSE(callback_errored()); | 189 EXPECT_FALSE(callback_errored()); |
190 } | 190 } |
191 | 191 |
192 TEST_F(MAYBE_CredentialManagerClientTest, SendNotifySignedOut) { | 192 TEST_F(MAYBE_CredentialManagerClientTest, SendRequestUserMediation) { |
193 int request_id; | 193 int request_id; |
194 EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedOut::ID, | 194 EXPECT_FALSE(ExtractRequestId( |
195 request_id)); | 195 CredentialManagerHostMsg_RequireUserMediation::ID, request_id)); |
196 | 196 |
197 scoped_ptr<TestNotificationCallbacks> callbacks( | 197 scoped_ptr<TestNotificationCallbacks> callbacks( |
198 new TestNotificationCallbacks(this)); | 198 new TestNotificationCallbacks(this)); |
199 client_->dispatchSignedOut(callbacks.release()); | 199 client_->dispatchRequireUserMediation(callbacks.release()); |
200 | 200 |
201 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedOut::ID, | 201 EXPECT_TRUE(ExtractRequestId( |
202 request_id)); | 202 CredentialManagerHostMsg_RequireUserMediation::ID, request_id)); |
203 | 203 |
204 client_->OnAcknowledgeSignedOut(request_id); | 204 client_->OnAcknowledgeRequireUserMediation(request_id); |
205 EXPECT_TRUE(callback_succeeded()); | 205 EXPECT_TRUE(callback_succeeded()); |
206 EXPECT_FALSE(callback_errored()); | 206 EXPECT_FALSE(callback_errored()); |
207 } | 207 } |
208 | 208 |
209 TEST_F(MAYBE_CredentialManagerClientTest, SendRequestCredential) { | 209 TEST_F(MAYBE_CredentialManagerClientTest, SendRequestCredential) { |
210 int request_id; | 210 int request_id; |
211 EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, | 211 EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, |
212 request_id)); | 212 request_id)); |
213 | 213 |
214 scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); | 214 scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); |
(...skipping 22 matching lines...) Expand all Loading... |
237 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, | 237 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, |
238 request_id)); | 238 request_id)); |
239 | 239 |
240 CredentialInfo info; // Send an empty credential in response. | 240 CredentialInfo info; // Send an empty credential in response. |
241 client_->OnSendCredential(request_id, info); | 241 client_->OnSendCredential(request_id, info); |
242 EXPECT_TRUE(callback_succeeded()); | 242 EXPECT_TRUE(callback_succeeded()); |
243 EXPECT_FALSE(callback_errored()); | 243 EXPECT_FALSE(callback_errored()); |
244 } | 244 } |
245 | 245 |
246 } // namespace password_manager | 246 } // namespace password_manager |
OLD | NEW |