OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/stringprintf.h" |
11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
12 #include "base/time.h" | 13 #include "base/time.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/password_manager/password_form_data.h" | 15 #include "chrome/browser/password_manager/password_form_data.h" |
15 #include "chrome/browser/password_manager/password_store_change.h" | 16 #include "chrome/browser/password_manager/password_store_change.h" |
16 #include "chrome/browser/password_manager/password_store_consumer.h" | 17 #include "chrome/browser/password_manager/password_store_consumer.h" |
17 #include "chrome/browser/password_manager/password_store_x.h" | 18 #include "chrome/browser/password_manager/password_store_x.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/webdata/web_data_service.h" | 20 #include "chrome/browser/webdata/web_data_service.h" |
20 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 private: | 239 private: |
239 LoginDatabase* login_db_; | 240 LoginDatabase* login_db_; |
240 bool autofillable_; | 241 bool autofillable_; |
241 MockLoginDatabaseReturn* mock_return_; | 242 MockLoginDatabaseReturn* mock_return_; |
242 }; | 243 }; |
243 | 244 |
244 // Generate |count| expected logins, either autofillable or blacklisted. | 245 // Generate |count| expected logins, either autofillable or blacklisted. |
245 void InitExpectedForms(bool autofillable, size_t count, VectorOfForms* forms) { | 246 void InitExpectedForms(bool autofillable, size_t count, VectorOfForms* forms) { |
246 const char* domain = autofillable ? "example" : "blacklisted"; | 247 const char* domain = autofillable ? "example" : "blacklisted"; |
247 for (size_t i = 0; i < count; ++i) { | 248 for (size_t i = 0; i < count; ++i) { |
248 std::string realm = StringPrintf("http://%zu.%s.com", i, domain); | 249 std::string realm = base::StringPrintf("http://%zu.%s.com", i, domain); |
249 std::string origin = StringPrintf("http://%zu.%s.com/origin", i, domain); | 250 std::string origin = base::StringPrintf("http://%zu.%s.com/origin", |
250 std::string action = StringPrintf("http://%zu.%s.com/action", i, domain); | 251 i, domain); |
| 252 std::string action = base::StringPrintf("http://%zu.%s.com/action", |
| 253 i, domain); |
251 PasswordFormData data = { | 254 PasswordFormData data = { |
252 PasswordForm::SCHEME_HTML, | 255 PasswordForm::SCHEME_HTML, |
253 realm.c_str(), | 256 realm.c_str(), |
254 origin.c_str(), | 257 origin.c_str(), |
255 action.c_str(), | 258 action.c_str(), |
256 L"submit_element", | 259 L"submit_element", |
257 L"username_element", | 260 L"username_element", |
258 L"password_element", | 261 L"password_element", |
259 autofillable ? L"username_value" : NULL, | 262 autofillable ? L"username_value" : NULL, |
260 autofillable ? L"password_value" : NULL, | 263 autofillable ? L"password_value" : NULL, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 765 |
763 INSTANTIATE_TEST_CASE_P(NoBackend, | 766 INSTANTIATE_TEST_CASE_P(NoBackend, |
764 PasswordStoreXTest, | 767 PasswordStoreXTest, |
765 testing::Values(NO_BACKEND)); | 768 testing::Values(NO_BACKEND)); |
766 INSTANTIATE_TEST_CASE_P(FailingBackend, | 769 INSTANTIATE_TEST_CASE_P(FailingBackend, |
767 PasswordStoreXTest, | 770 PasswordStoreXTest, |
768 testing::Values(FAILING_BACKEND)); | 771 testing::Values(FAILING_BACKEND)); |
769 INSTANTIATE_TEST_CASE_P(WorkingBackend, | 772 INSTANTIATE_TEST_CASE_P(WorkingBackend, |
770 PasswordStoreXTest, | 773 PasswordStoreXTest, |
771 testing::Values(WORKING_BACKEND)); | 774 testing::Values(WORKING_BACKEND)); |
OLD | NEW |