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 "chrome/browser/password_manager/password_store_win.h" | 5 #include "chrome/browser/password_manager/password_store_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 PasswordForm::SCHEME_HTML, | 237 PasswordForm::SCHEME_HTML, |
238 "http://example.com/", | 238 "http://example.com/", |
239 "http://example.com/origin", | 239 "http://example.com/origin", |
240 "http://example.com/action", | 240 "http://example.com/action", |
241 L"submit_element", | 241 L"submit_element", |
242 L"username_element", | 242 L"username_element", |
243 L"password_element", | 243 L"password_element", |
244 L"", | 244 L"", |
245 L"", | 245 L"", |
246 true, | 246 true, |
247 false, | |
248 1, | 247 1, |
249 }; | 248 }; |
250 std::unique_ptr<PasswordForm> form = | 249 std::unique_ptr<PasswordForm> form = |
251 CreatePasswordFormFromDataForTesting(form_data); | 250 CreatePasswordFormFromDataForTesting(form_data); |
252 | 251 |
253 // The returned form will not have 'action' or '*_element' fields set. This | 252 // The returned form will not have 'action' or '*_element' fields set. This |
254 // is because credentials imported from IE don't have this information. | 253 // is because credentials imported from IE don't have this information. |
255 PasswordFormData expected_form_data = { | 254 PasswordFormData expected_form_data = { |
256 PasswordForm::SCHEME_HTML, | 255 PasswordForm::SCHEME_HTML, |
257 "http://example.com/", | 256 "http://example.com/", |
258 "http://example.com/origin", | 257 "http://example.com/origin", |
259 "", | 258 "", |
260 L"", | 259 L"", |
261 L"", | 260 L"", |
262 L"", | 261 L"", |
263 L"abcdefgh", | 262 L"abcdefgh", |
264 L"abcdefghijkl", | 263 L"abcdefghijkl", |
265 true, | 264 true, |
266 false, | |
267 1, | 265 1, |
268 }; | 266 }; |
269 ScopedVector<autofill::PasswordForm> expected_forms; | 267 ScopedVector<autofill::PasswordForm> expected_forms; |
270 expected_forms.push_back( | 268 expected_forms.push_back( |
271 CreatePasswordFormFromDataForTesting(expected_form_data)); | 269 CreatePasswordFormFromDataForTesting(expected_form_data)); |
272 | 270 |
273 // The IE7 password should be returned. | 271 // The IE7 password should be returned. |
274 EXPECT_CALL(consumer, | 272 EXPECT_CALL(consumer, |
275 OnGetPasswordStoreResultsConstRef( | 273 OnGetPasswordStoreResultsConstRef( |
276 UnorderedPasswordFormElementsAre(expected_forms.get()))); | 274 UnorderedPasswordFormElementsAre(expected_forms.get()))); |
(...skipping 10 matching lines...) Expand all Loading... |
287 PasswordForm::SCHEME_HTML, | 285 PasswordForm::SCHEME_HTML, |
288 "http://example.com/", | 286 "http://example.com/", |
289 "http://example.com/origin", | 287 "http://example.com/origin", |
290 "http://example.com/action", | 288 "http://example.com/action", |
291 L"submit_element", | 289 L"submit_element", |
292 L"username_element", | 290 L"username_element", |
293 L"password_element", | 291 L"password_element", |
294 L"", | 292 L"", |
295 L"", | 293 L"", |
296 true, | 294 true, |
297 false, | |
298 1, | 295 1, |
299 }; | 296 }; |
300 std::unique_ptr<PasswordForm> form = | 297 std::unique_ptr<PasswordForm> form = |
301 CreatePasswordFormFromDataForTesting(form_data); | 298 CreatePasswordFormFromDataForTesting(form_data); |
302 | 299 |
303 MockPasswordStoreConsumer consumer; | 300 MockPasswordStoreConsumer consumer; |
304 store_->GetLogins(*form, &consumer); | 301 store_->GetLogins(*form, &consumer); |
305 | 302 |
306 // Release the PSW and the WDS before the query can return. | 303 // Release the PSW and the WDS before the query can return. |
307 store_->ShutdownOnUIThread(); | 304 store_->ShutdownOnUIThread(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 PasswordForm::SCHEME_HTML, | 340 PasswordForm::SCHEME_HTML, |
344 "http://example.com/", | 341 "http://example.com/", |
345 "http://example.com/origin", | 342 "http://example.com/origin", |
346 "http://example.com/action", | 343 "http://example.com/action", |
347 L"submit_element", | 344 L"submit_element", |
348 L"username_element", | 345 L"username_element", |
349 L"password_element", | 346 L"password_element", |
350 L"", | 347 L"", |
351 L"", | 348 L"", |
352 true, | 349 true, |
353 false, | |
354 1, | 350 1, |
355 }; | 351 }; |
356 std::unique_ptr<PasswordForm> form = | 352 std::unique_ptr<PasswordForm> form = |
357 CreatePasswordFormFromDataForTesting(form_data); | 353 CreatePasswordFormFromDataForTesting(form_data); |
358 | 354 |
359 PasswordFormData expected_form_data = { | 355 PasswordFormData expected_form_data = { |
360 PasswordForm::SCHEME_HTML, | 356 PasswordForm::SCHEME_HTML, |
361 "http://example.com/", | 357 "http://example.com/", |
362 "http://example.com/origin", | 358 "http://example.com/origin", |
363 "http://example.com/action", | 359 "http://example.com/action", |
364 L"submit_element", | 360 L"submit_element", |
365 L"username_element", | 361 L"username_element", |
366 L"password_element", | 362 L"password_element", |
367 L"abcdefgh", | 363 L"abcdefgh", |
368 L"abcdefghijkl", | 364 L"abcdefghijkl", |
369 true, | 365 true, |
370 false, | |
371 1, | 366 1, |
372 }; | 367 }; |
373 ScopedVector<autofill::PasswordForm> expected_forms; | 368 ScopedVector<autofill::PasswordForm> expected_forms; |
374 expected_forms.push_back( | 369 expected_forms.push_back( |
375 CreatePasswordFormFromDataForTesting(expected_form_data)); | 370 CreatePasswordFormFromDataForTesting(expected_form_data)); |
376 | 371 |
377 // The IE7 password should be returned. | 372 // The IE7 password should be returned. |
378 EXPECT_CALL(password_consumer, | 373 EXPECT_CALL(password_consumer, |
379 OnGetPasswordStoreResultsConstRef( | 374 OnGetPasswordStoreResultsConstRef( |
380 UnorderedPasswordFormElementsAre(expected_forms.get()))); | 375 UnorderedPasswordFormElementsAre(expected_forms.get()))); |
(...skipping 22 matching lines...) Expand all Loading... |
403 PasswordForm::SCHEME_HTML, | 398 PasswordForm::SCHEME_HTML, |
404 "http://example.com/", | 399 "http://example.com/", |
405 "http://example.com/origin", | 400 "http://example.com/origin", |
406 "http://example.com/action", | 401 "http://example.com/action", |
407 L"submit_element", | 402 L"submit_element", |
408 L"username_element", | 403 L"username_element", |
409 L"password_element", | 404 L"password_element", |
410 L"", | 405 L"", |
411 L"", | 406 L"", |
412 true, | 407 true, |
413 false, | |
414 1, | 408 1, |
415 }; | 409 }; |
416 std::unique_ptr<PasswordForm> form = | 410 std::unique_ptr<PasswordForm> form = |
417 CreatePasswordFormFromDataForTesting(form_data); | 411 CreatePasswordFormFromDataForTesting(form_data); |
418 | 412 |
419 MockPasswordStoreConsumer consumer; | 413 MockPasswordStoreConsumer consumer; |
420 | 414 |
421 // Make sure we quit the MessageLoop even if the test fails. | 415 // Make sure we quit the MessageLoop even if the test fails. |
422 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 416 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
423 .WillByDefault(QuitUIMessageLoop()); | 417 .WillByDefault(QuitUIMessageLoop()); |
(...skipping 28 matching lines...) Expand all Loading... |
452 | 446 |
453 // Make sure we quit the MessageLoop even if the test fails. | 447 // Make sure we quit the MessageLoop even if the test fails. |
454 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 448 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
455 .WillByDefault(QuitUIMessageLoop()); | 449 .WillByDefault(QuitUIMessageLoop()); |
456 | 450 |
457 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); | 451 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); |
458 | 452 |
459 store_->GetAutofillableLogins(&consumer); | 453 store_->GetAutofillableLogins(&consumer); |
460 base::MessageLoop::current()->Run(); | 454 base::MessageLoop::current()->Run(); |
461 } | 455 } |
OLD | NEW |