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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 origin.c_str(), | 230 origin.c_str(), |
231 action.c_str(), | 231 action.c_str(), |
232 L"submit_element", | 232 L"submit_element", |
233 L"username_element", | 233 L"username_element", |
234 L"password_element", | 234 L"password_element", |
235 autofillable ? L"username_value" : NULL, | 235 autofillable ? L"username_value" : NULL, |
236 autofillable ? L"password_value" : NULL, | 236 autofillable ? L"password_value" : NULL, |
237 autofillable, | 237 autofillable, |
238 false, | 238 false, |
239 static_cast<double>(i + 1)}; | 239 static_cast<double>(i + 1)}; |
240 forms->push_back(CreatePasswordFormFromData(data).release()); | 240 forms->push_back(CreatePasswordFormFromDataForTesting(data).release()); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 } // anonymous namespace | 244 } // anonymous namespace |
245 | 245 |
246 enum BackendType { | 246 enum BackendType { |
247 NO_BACKEND, | 247 NO_BACKEND, |
248 FAILING_BACKEND, | 248 FAILING_BACKEND, |
249 WORKING_BACKEND | 249 WORKING_BACKEND |
250 }; | 250 }; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 login_db.Pass(), GetBackend())); | 289 login_db.Pass(), GetBackend())); |
290 store->Init(syncer::SyncableService::StartSyncFlare()); | 290 store->Init(syncer::SyncableService::StartSyncFlare()); |
291 | 291 |
292 password_manager::PasswordFormData form_data = { | 292 password_manager::PasswordFormData form_data = { |
293 PasswordForm::SCHEME_HTML, "http://bar.example.com", | 293 PasswordForm::SCHEME_HTML, "http://bar.example.com", |
294 "http://bar.example.com/origin", "http://bar.example.com/action", | 294 "http://bar.example.com/origin", "http://bar.example.com/action", |
295 L"submit_element", L"username_element", | 295 L"submit_element", L"username_element", |
296 L"password_element", L"username_value", | 296 L"password_element", L"username_value", |
297 L"password_value", true, | 297 L"password_value", true, |
298 false, 1}; | 298 false, 1}; |
299 scoped_ptr<PasswordForm> form = CreatePasswordFormFromData(form_data); | 299 scoped_ptr<PasswordForm> form = |
| 300 CreatePasswordFormFromDataForTesting(form_data); |
300 | 301 |
301 MockPasswordStoreObserver observer; | 302 MockPasswordStoreObserver observer; |
302 store->AddObserver(&observer); | 303 store->AddObserver(&observer); |
303 | 304 |
304 const PasswordStoreChange expected_add_changes[] = { | 305 const PasswordStoreChange expected_add_changes[] = { |
305 PasswordStoreChange(PasswordStoreChange::ADD, *form), | 306 PasswordStoreChange(PasswordStoreChange::ADD, *form), |
306 }; | 307 }; |
307 | 308 |
308 EXPECT_CALL( | 309 EXPECT_CALL( |
309 observer, | 310 observer, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 454 |
454 INSTANTIATE_TEST_CASE_P(NoBackend, | 455 INSTANTIATE_TEST_CASE_P(NoBackend, |
455 PasswordStoreXTest, | 456 PasswordStoreXTest, |
456 testing::Values(NO_BACKEND)); | 457 testing::Values(NO_BACKEND)); |
457 INSTANTIATE_TEST_CASE_P(FailingBackend, | 458 INSTANTIATE_TEST_CASE_P(FailingBackend, |
458 PasswordStoreXTest, | 459 PasswordStoreXTest, |
459 testing::Values(FAILING_BACKEND)); | 460 testing::Values(FAILING_BACKEND)); |
460 INSTANTIATE_TEST_CASE_P(WorkingBackend, | 461 INSTANTIATE_TEST_CASE_P(WorkingBackend, |
461 PasswordStoreXTest, | 462 PasswordStoreXTest, |
462 testing::Values(WORKING_BACKEND)); | 463 testing::Values(WORKING_BACKEND)); |
OLD | NEW |