OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 5 #include <windows.h> |
6 #include <wincrypt.h> | 6 #include <wincrypt.h> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 "http://example.com/action", | 213 "http://example.com/action", |
214 L"submit_element", | 214 L"submit_element", |
215 L"username_element", | 215 L"username_element", |
216 L"password_element", | 216 L"password_element", |
217 L"", | 217 L"", |
218 L"", | 218 L"", |
219 true, false, 1, | 219 true, false, 1, |
220 }; | 220 }; |
221 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); | 221 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); |
222 | 222 |
| 223 // The returned form will not have 'action' or '*_element' fields set. This |
| 224 // is because credentials imported from IE don't have this information. |
223 PasswordFormData expected_form_data = { | 225 PasswordFormData expected_form_data = { |
224 PasswordForm::SCHEME_HTML, | 226 PasswordForm::SCHEME_HTML, |
225 "http://example.com/", | 227 "http://example.com/", |
226 "http://example.com/origin", | 228 "http://example.com/origin", |
227 "http://example.com/action", | 229 "", |
228 L"submit_element", | 230 L"", |
229 L"username_element", | 231 L"", |
230 L"password_element", | 232 L"", |
231 L"abcdefgh", | 233 L"abcdefgh", |
232 L"abcdefghijkl", | 234 L"abcdefghijkl", |
233 true, false, 1, | 235 true, false, 1, |
234 }; | 236 }; |
235 std::vector<PasswordForm*> forms; | 237 std::vector<PasswordForm*> forms; |
236 forms.push_back(CreatePasswordFormFromData(expected_form_data)); | 238 forms.push_back(CreatePasswordFormFromData(expected_form_data)); |
237 | 239 |
238 // The IE7 password should be returned. | 240 // The IE7 password should be returned. |
239 EXPECT_CALL(consumer, | 241 EXPECT_CALL(consumer, |
240 OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) | 242 OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 VectorOfForms expect_none; | 422 VectorOfForms expect_none; |
421 // expect that we get no results; | 423 // expect that we get no results; |
422 EXPECT_CALL( | 424 EXPECT_CALL( |
423 consumer, | 425 consumer, |
424 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) | 426 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) |
425 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); | 427 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); |
426 | 428 |
427 store_->GetAutofillableLogins(&consumer); | 429 store_->GetAutofillableLogins(&consumer); |
428 base::MessageLoop::current()->Run(); | 430 base::MessageLoop::current()->Run(); |
429 } | 431 } |
OLD | NEW |