Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/password_manager/password_store_x_unittest.cc

Issue 347583004: PasswordStore refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_util.h" 8 #include "base/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"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 virtual PasswordStoreChangeList AddLogin(const PasswordForm& form) OVERRIDE { 62 virtual PasswordStoreChangeList AddLogin(const PasswordForm& form) OVERRIDE {
63 return PasswordStoreChangeList(); 63 return PasswordStoreChangeList();
64 } 64 }
65 virtual bool UpdateLogin(const PasswordForm& form, 65 virtual bool UpdateLogin(const PasswordForm& form,
66 PasswordStoreChangeList* changes) OVERRIDE { 66 PasswordStoreChangeList* changes) OVERRIDE {
67 return false; 67 return false;
68 } 68 }
69 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE { return false; } 69 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE { return false; }
70 70
71 virtual bool RemoveLoginsCreatedBetween(base::Time delete_begin, 71 virtual bool RemoveLoginsCreatedBetween(
72 base::Time delete_end) OVERRIDE { 72 base::Time delete_begin,
73 base::Time delete_end,
74 password_manager::PasswordStoreChangeList* changes) OVERRIDE {
73 return false; 75 return false;
74 } 76 }
75 77
76 virtual bool RemoveLoginsSyncedBetween( 78 virtual bool RemoveLoginsSyncedBetween(
77 base::Time delete_begin, 79 base::Time delete_begin,
78 base::Time delete_end, 80 base::Time delete_end,
79 password_manager::PasswordStoreChangeList* changes) OVERRIDE { 81 password_manager::PasswordStoreChangeList* changes) OVERRIDE {
80 return false; 82 return false;
81 } 83 }
82 84
83 virtual bool GetLogins(const PasswordForm& form, 85 virtual bool GetLogins(const PasswordForm& form,
84 PasswordFormList* forms) OVERRIDE { 86 PasswordFormList* forms) OVERRIDE {
85 return false; 87 return false;
86 } 88 }
87 89
88 virtual bool GetLoginsCreatedBetween(base::Time get_begin,
89 base::Time get_end,
90 PasswordFormList* forms) OVERRIDE {
91 return false;
92 }
93
94 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE { 90 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE {
95 return false; 91 return false;
96 } 92 }
97 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE { 93 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE {
98 return false; 94 return false;
99 } 95 }
100 }; 96 };
101 97
102 class MockBackend : public PasswordStoreX::NativeBackend { 98 class MockBackend : public PasswordStoreX::NativeBackend {
103 public: 99 public:
(...skipping 16 matching lines...) Expand all
120 return true; 116 return true;
121 } 117 }
122 118
123 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE { 119 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE {
124 for (size_t i = 0; i < all_forms_.size(); ++i) 120 for (size_t i = 0; i < all_forms_.size(); ++i)
125 if (CompareForms(all_forms_[i], form, false)) 121 if (CompareForms(all_forms_[i], form, false))
126 erase(i--); 122 erase(i--);
127 return true; 123 return true;
128 } 124 }
129 125
130 virtual bool RemoveLoginsCreatedBetween(base::Time delete_begin, 126 virtual bool RemoveLoginsCreatedBetween(
131 base::Time delete_end) OVERRIDE { 127 base::Time delete_begin,
128 base::Time delete_end,
129 password_manager::PasswordStoreChangeList* changes) OVERRIDE {
132 for (size_t i = 0; i < all_forms_.size(); ++i) { 130 for (size_t i = 0; i < all_forms_.size(); ++i) {
133 if (delete_begin <= all_forms_[i].date_created && 131 if (delete_begin <= all_forms_[i].date_created &&
134 (delete_end.is_null() || all_forms_[i].date_created < delete_end)) 132 (delete_end.is_null() || all_forms_[i].date_created < delete_end))
135 erase(i--); 133 erase(i--);
136 } 134 }
137 return true; 135 return true;
138 } 136 }
139 137
140 virtual bool RemoveLoginsSyncedBetween( 138 virtual bool RemoveLoginsSyncedBetween(
141 base::Time delete_begin, 139 base::Time delete_begin,
(...skipping 12 matching lines...) Expand all
154 } 152 }
155 153
156 virtual bool GetLogins(const PasswordForm& form, 154 virtual bool GetLogins(const PasswordForm& form,
157 PasswordFormList* forms) OVERRIDE { 155 PasswordFormList* forms) OVERRIDE {
158 for (size_t i = 0; i < all_forms_.size(); ++i) 156 for (size_t i = 0; i < all_forms_.size(); ++i)
159 if (all_forms_[i].signon_realm == form.signon_realm) 157 if (all_forms_[i].signon_realm == form.signon_realm)
160 forms->push_back(new PasswordForm(all_forms_[i])); 158 forms->push_back(new PasswordForm(all_forms_[i]));
161 return true; 159 return true;
162 } 160 }
163 161
164 virtual bool GetLoginsCreatedBetween(base::Time get_begin,
165 base::Time get_end,
166 PasswordFormList* forms) OVERRIDE {
167 for (size_t i = 0; i < all_forms_.size(); ++i)
168 if (get_begin <= all_forms_[i].date_created &&
169 (get_end.is_null() || all_forms_[i].date_created < get_end))
170 forms->push_back(new PasswordForm(all_forms_[i]));
171 return true;
172 }
173
174 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE { 162 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE {
175 for (size_t i = 0; i < all_forms_.size(); ++i) 163 for (size_t i = 0; i < all_forms_.size(); ++i)
176 if (!all_forms_[i].blacklisted_by_user) 164 if (!all_forms_[i].blacklisted_by_user)
177 forms->push_back(new PasswordForm(all_forms_[i])); 165 forms->push_back(new PasswordForm(all_forms_[i]));
178 return true; 166 return true;
179 } 167 }
180 168
181 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE { 169 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE {
182 for (size_t i = 0; i < all_forms_.size(); ++i) 170 for (size_t i = 0; i < all_forms_.size(); ++i)
183 if (all_forms_[i].blacklisted_by_user) 171 if (all_forms_[i].blacklisted_by_user)
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 463
476 INSTANTIATE_TEST_CASE_P(NoBackend, 464 INSTANTIATE_TEST_CASE_P(NoBackend,
477 PasswordStoreXTest, 465 PasswordStoreXTest,
478 testing::Values(NO_BACKEND)); 466 testing::Values(NO_BACKEND));
479 INSTANTIATE_TEST_CASE_P(FailingBackend, 467 INSTANTIATE_TEST_CASE_P(FailingBackend,
480 PasswordStoreXTest, 468 PasswordStoreXTest,
481 testing::Values(FAILING_BACKEND)); 469 testing::Values(FAILING_BACKEND));
482 INSTANTIATE_TEST_CASE_P(WorkingBackend, 470 INSTANTIATE_TEST_CASE_P(WorkingBackend,
483 PasswordStoreXTest, 471 PasswordStoreXTest,
484 testing::Values(WORKING_BACKEND)); 472 testing::Values(WORKING_BACKEND));
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_x.cc ('k') | components/password_manager/core/browser/login_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698