| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/password_manager/password_store_x.h" | 17 #include "chrome/browser/password_manager/password_store_x.h" |
| 18 #include "chrome/test/base/testing_browser_process.h" | 18 #include "chrome/test/base/testing_browser_process.h" |
| 19 #include "components/password_manager/core/browser/password_form_data.h" | 19 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
| 20 #include "components/password_manager/core/browser/password_store_change.h" | 20 #include "components/password_manager/core/browser/password_store_change.h" |
| 21 #include "components/password_manager/core/browser/password_store_consumer.h" | 21 #include "components/password_manager/core/browser/password_store_consumer.h" |
| 22 #include "components/password_manager/core/common/password_manager_pref_names.h" | 22 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/test/test_browser_thread_bundle.h" | 24 #include "content/public/test/test_browser_thread_bundle.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 using autofill::PasswordForm; | 28 using autofill::PasswordForm; |
| 29 using password_manager::ContainsSamePasswordForms; | 29 using password_manager::ContainsSamePasswordForms; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 origin.c_str(), | 232 origin.c_str(), |
| 233 action.c_str(), | 233 action.c_str(), |
| 234 L"submit_element", | 234 L"submit_element", |
| 235 L"username_element", | 235 L"username_element", |
| 236 L"password_element", | 236 L"password_element", |
| 237 autofillable ? L"username_value" : NULL, | 237 autofillable ? L"username_value" : NULL, |
| 238 autofillable ? L"password_value" : NULL, | 238 autofillable ? L"password_value" : NULL, |
| 239 autofillable, | 239 autofillable, |
| 240 false, | 240 false, |
| 241 static_cast<double>(i + 1)}; | 241 static_cast<double>(i + 1)}; |
| 242 forms->push_back(CreatePasswordFormFromData(data).release()); | 242 forms->push_back(CreatePasswordFormFromDataForTesting(data).release()); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // anonymous namespace | 246 } // anonymous namespace |
| 247 | 247 |
| 248 enum BackendType { | 248 enum BackendType { |
| 249 NO_BACKEND, | 249 NO_BACKEND, |
| 250 FAILING_BACKEND, | 250 FAILING_BACKEND, |
| 251 WORKING_BACKEND | 251 WORKING_BACKEND |
| 252 }; | 252 }; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 login_db.Pass(), GetBackend())); | 291 login_db.Pass(), GetBackend())); |
| 292 store->Init(syncer::SyncableService::StartSyncFlare()); | 292 store->Init(syncer::SyncableService::StartSyncFlare()); |
| 293 | 293 |
| 294 password_manager::PasswordFormData form_data = { | 294 password_manager::PasswordFormData form_data = { |
| 295 PasswordForm::SCHEME_HTML, "http://bar.example.com", | 295 PasswordForm::SCHEME_HTML, "http://bar.example.com", |
| 296 "http://bar.example.com/origin", "http://bar.example.com/action", | 296 "http://bar.example.com/origin", "http://bar.example.com/action", |
| 297 L"submit_element", L"username_element", | 297 L"submit_element", L"username_element", |
| 298 L"password_element", L"username_value", | 298 L"password_element", L"username_value", |
| 299 L"password_value", true, | 299 L"password_value", true, |
| 300 false, 1}; | 300 false, 1}; |
| 301 scoped_ptr<PasswordForm> form = CreatePasswordFormFromData(form_data); | 301 scoped_ptr<PasswordForm> form = |
| 302 CreatePasswordFormFromDataForTesting(form_data); |
| 302 | 303 |
| 303 MockPasswordStoreObserver observer; | 304 MockPasswordStoreObserver observer; |
| 304 store->AddObserver(&observer); | 305 store->AddObserver(&observer); |
| 305 | 306 |
| 306 const PasswordStoreChange expected_add_changes[] = { | 307 const PasswordStoreChange expected_add_changes[] = { |
| 307 PasswordStoreChange(PasswordStoreChange::ADD, *form), | 308 PasswordStoreChange(PasswordStoreChange::ADD, *form), |
| 308 }; | 309 }; |
| 309 | 310 |
| 310 EXPECT_CALL( | 311 EXPECT_CALL( |
| 311 observer, | 312 observer, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 456 |
| 456 INSTANTIATE_TEST_CASE_P(NoBackend, | 457 INSTANTIATE_TEST_CASE_P(NoBackend, |
| 457 PasswordStoreXTest, | 458 PasswordStoreXTest, |
| 458 testing::Values(NO_BACKEND)); | 459 testing::Values(NO_BACKEND)); |
| 459 INSTANTIATE_TEST_CASE_P(FailingBackend, | 460 INSTANTIATE_TEST_CASE_P(FailingBackend, |
| 460 PasswordStoreXTest, | 461 PasswordStoreXTest, |
| 461 testing::Values(FAILING_BACKEND)); | 462 testing::Values(FAILING_BACKEND)); |
| 462 INSTANTIATE_TEST_CASE_P(WorkingBackend, | 463 INSTANTIATE_TEST_CASE_P(WorkingBackend, |
| 463 PasswordStoreXTest, | 464 PasswordStoreXTest, |
| 464 testing::Values(WORKING_BACKEND)); | 465 testing::Values(WORKING_BACKEND)); |
| OLD | NEW |