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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 request_id)); | 202 request_id)); |
203 | 203 |
204 scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); | 204 scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); |
205 std::vector<GURL> federations; | 205 std::vector<GURL> federations; |
206 client_->dispatchRequest(false, federations, callbacks.release()); | 206 client_->dispatchRequest(false, federations, callbacks.release()); |
207 | 207 |
208 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, | 208 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, |
209 request_id)); | 209 request_id)); |
210 | 210 |
211 CredentialInfo info; | 211 CredentialInfo info; |
212 info.type = CREDENTIAL_TYPE_LOCAL; | 212 info.type = CredentialType::CREDENTIAL_TYPE_LOCAL; |
213 client_->OnSendCredential(request_id, info); | 213 client_->OnSendCredential(request_id, info); |
214 EXPECT_TRUE(callback_succeeded()); | 214 EXPECT_TRUE(callback_succeeded()); |
215 EXPECT_FALSE(callback_errored()); | 215 EXPECT_FALSE(callback_errored()); |
216 } | 216 } |
217 | 217 |
218 TEST_F(CredentialManagerClientTest, SendRequestCredentialEmpty) { | 218 TEST_F(CredentialManagerClientTest, SendRequestCredentialEmpty) { |
219 int request_id; | 219 int request_id; |
220 EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, | 220 EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, |
221 request_id)); | 221 request_id)); |
222 | 222 |
223 scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); | 223 scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); |
224 std::vector<GURL> federations; | 224 std::vector<GURL> federations; |
225 client_->dispatchRequest(false, federations, callbacks.release()); | 225 client_->dispatchRequest(false, federations, callbacks.release()); |
226 | 226 |
227 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, | 227 EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, |
228 request_id)); | 228 request_id)); |
229 | 229 |
230 CredentialInfo info; // Send an empty credential in response. | 230 CredentialInfo info; // Send an empty credential in response. |
231 client_->OnSendCredential(request_id, info); | 231 client_->OnSendCredential(request_id, info); |
232 EXPECT_TRUE(callback_succeeded()); | 232 EXPECT_TRUE(callback_succeeded()); |
233 EXPECT_FALSE(callback_errored()); | 233 EXPECT_FALSE(callback_errored()); |
234 } | 234 } |
235 | 235 |
236 } // namespace password_manager | 236 } // namespace password_manager |
OLD | NEW |