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_x.h" | 5 #include "chrome/browser/password_manager/password_store_x.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 PasswordForm::SCHEME_HTML, | 270 PasswordForm::SCHEME_HTML, |
271 realm.c_str(), | 271 realm.c_str(), |
272 origin.c_str(), | 272 origin.c_str(), |
273 action.c_str(), | 273 action.c_str(), |
274 L"submit_element", | 274 L"submit_element", |
275 L"username_element", | 275 L"username_element", |
276 L"password_element", | 276 L"password_element", |
277 autofillable ? L"username_value" : nullptr, | 277 autofillable ? L"username_value" : nullptr, |
278 autofillable ? L"password_value" : nullptr, | 278 autofillable ? L"password_value" : nullptr, |
279 autofillable, | 279 autofillable, |
280 false, | |
281 static_cast<double>(i + 1)}; | 280 static_cast<double>(i + 1)}; |
282 forms->push_back(CreatePasswordFormFromDataForTesting(data)); | 281 forms->push_back(CreatePasswordFormFromDataForTesting(data)); |
283 } | 282 } |
284 } | 283 } |
285 | 284 |
286 PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) { | 285 PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) { |
287 return PasswordStoreChangeList( | 286 return PasswordStoreChangeList( |
288 1, PasswordStoreChange(PasswordStoreChange::ADD, form)); | 287 1, PasswordStoreChange(PasswordStoreChange::ADD, form)); |
289 } | 288 } |
290 | 289 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 404 |
406 TEST_P(PasswordStoreXTest, Notifications) { | 405 TEST_P(PasswordStoreXTest, Notifications) { |
407 std::unique_ptr<password_manager::LoginDatabase> login_db( | 406 std::unique_ptr<password_manager::LoginDatabase> login_db( |
408 new password_manager::LoginDatabase(test_login_db_file_path())); | 407 new password_manager::LoginDatabase(test_login_db_file_path())); |
409 scoped_refptr<PasswordStoreX> store(new PasswordStoreX( | 408 scoped_refptr<PasswordStoreX> store(new PasswordStoreX( |
410 base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(), | 409 base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(), |
411 std::move(login_db), GetBackend(GetParam()))); | 410 std::move(login_db), GetBackend(GetParam()))); |
412 store->Init(syncer::SyncableService::StartSyncFlare()); | 411 store->Init(syncer::SyncableService::StartSyncFlare()); |
413 | 412 |
414 password_manager::PasswordFormData form_data = { | 413 password_manager::PasswordFormData form_data = { |
415 PasswordForm::SCHEME_HTML, "http://bar.example.com", | 414 PasswordForm::SCHEME_HTML, |
416 "http://bar.example.com/origin", "http://bar.example.com/action", | 415 "http://bar.example.com", |
417 L"submit_element", L"username_element", | 416 "http://bar.example.com/origin", |
418 L"password_element", L"username_value", | 417 "http://bar.example.com/action", |
419 L"password_value", true, | 418 L"submit_element", |
420 false, 1}; | 419 L"username_element", |
| 420 L"password_element", |
| 421 L"username_value", |
| 422 L"password_value", |
| 423 true, |
| 424 1}; |
421 std::unique_ptr<PasswordForm> form = | 425 std::unique_ptr<PasswordForm> form = |
422 CreatePasswordFormFromDataForTesting(form_data); | 426 CreatePasswordFormFromDataForTesting(form_data); |
423 | 427 |
424 password_manager::MockPasswordStoreObserver observer; | 428 password_manager::MockPasswordStoreObserver observer; |
425 store->AddObserver(&observer); | 429 store->AddObserver(&observer); |
426 | 430 |
427 const PasswordStoreChange expected_add_changes[] = { | 431 const PasswordStoreChange expected_add_changes[] = { |
428 PasswordStoreChange(PasswordStoreChange::ADD, *form), | 432 PasswordStoreChange(PasswordStoreChange::ADD, *form), |
429 }; | 433 }; |
430 | 434 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 584 |
581 INSTANTIATE_TEST_CASE_P(NoBackend, | 585 INSTANTIATE_TEST_CASE_P(NoBackend, |
582 PasswordStoreXTest, | 586 PasswordStoreXTest, |
583 testing::Values(NO_BACKEND)); | 587 testing::Values(NO_BACKEND)); |
584 INSTANTIATE_TEST_CASE_P(FailingBackend, | 588 INSTANTIATE_TEST_CASE_P(FailingBackend, |
585 PasswordStoreXTest, | 589 PasswordStoreXTest, |
586 testing::Values(FAILING_BACKEND)); | 590 testing::Values(FAILING_BACKEND)); |
587 INSTANTIATE_TEST_CASE_P(WorkingBackend, | 591 INSTANTIATE_TEST_CASE_P(WorkingBackend, |
588 PasswordStoreXTest, | 592 PasswordStoreXTest, |
589 testing::Values(WORKING_BACKEND)); | 593 testing::Values(WORKING_BACKEND)); |
OLD | NEW |