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

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

Issue 316243002: Add date_synced to PasswordForm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +comment 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 "testing/gmock/include/gmock/gmock.h" 5 #include "testing/gmock/include/gmock/gmock.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 // Creates and returns a new PasswordForm built from form_data. Caller is 180 // Creates and returns a new PasswordForm built from form_data. Caller is
181 // responsible for deleting the object when finished with it. 181 // responsible for deleting the object when finished with it.
182 static PasswordForm* CreatePasswordFormFromData( 182 static PasswordForm* CreatePasswordFormFromData(
183 const PasswordFormData& form_data) { 183 const PasswordFormData& form_data) {
184 PasswordForm* form = new PasswordForm(); 184 PasswordForm* form = new PasswordForm();
185 form->scheme = form_data.scheme; 185 form->scheme = form_data.scheme;
186 form->preferred = form_data.preferred; 186 form->preferred = form_data.preferred;
187 form->ssl_valid = form_data.ssl_valid; 187 form->ssl_valid = form_data.ssl_valid;
188 form->date_created = base::Time::FromDoubleT(form_data.creation_time); 188 form->date_created = base::Time::FromDoubleT(form_data.creation_time);
189 form->date_synced = form->date_created + base::TimeDelta::FromDays(1);
189 if (form_data.signon_realm) 190 if (form_data.signon_realm)
190 form->signon_realm = std::string(form_data.signon_realm); 191 form->signon_realm = std::string(form_data.signon_realm);
191 if (form_data.origin) 192 if (form_data.origin)
192 form->origin = GURL(form_data.origin); 193 form->origin = GURL(form_data.origin);
193 if (form_data.action) 194 if (form_data.action)
194 form->action = GURL(form_data.action); 195 form->action = GURL(form_data.action);
195 if (form_data.submit_element) 196 if (form_data.submit_element)
196 form->submit_element = WideToUTF16(form_data.submit_element); 197 form->submit_element = WideToUTF16(form_data.submit_element);
197 if (form_data.username_element) 198 if (form_data.username_element)
198 form->username_element = WideToUTF16(form_data.username_element); 199 form->username_element = WideToUTF16(form_data.username_element);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 form->username_value) << test_label; 250 form->username_value) << test_label;
250 EXPECT_EQ(WideToUTF16(expectation->password_value), 251 EXPECT_EQ(WideToUTF16(expectation->password_value),
251 form->password_value) << test_label; 252 form->password_value) << test_label;
252 } else { 253 } else {
253 EXPECT_TRUE(form->blacklisted_by_user) << test_label; 254 EXPECT_TRUE(form->blacklisted_by_user) << test_label;
254 } 255 }
255 EXPECT_EQ(expectation->preferred, form->preferred) << test_label; 256 EXPECT_EQ(expectation->preferred, form->preferred) << test_label;
256 EXPECT_EQ(expectation->ssl_valid, form->ssl_valid) << test_label; 257 EXPECT_EQ(expectation->ssl_valid, form->ssl_valid) << test_label;
257 EXPECT_DOUBLE_EQ(expectation->creation_time, 258 EXPECT_DOUBLE_EQ(expectation->creation_time,
258 form->date_created.ToDoubleT()) << test_label; 259 form->date_created.ToDoubleT()) << test_label;
260 base::Time created = base::Time::FromDoubleT(expectation->creation_time);
261 EXPECT_EQ(created + base::TimeDelta::FromDays(1),
262 form->date_synced) << test_label;
259 } 263 }
260 } 264 }
261 265
262 #pragma mark - 266 #pragma mark -
263 267
264 TEST_F(PasswordStoreMacInternalsTest, TestKeychainToFormTranslation) { 268 TEST_F(PasswordStoreMacInternalsTest, TestKeychainToFormTranslation) {
265 typedef struct { 269 typedef struct {
266 const PasswordForm::Scheme scheme; 270 const PasswordForm::Scheme scheme;
267 const char* signon_realm; 271 const char* signon_realm;
268 const char* origin; 272 const char* origin;
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 EXPECT_EQ(0u, matching_items.size()); 1247 EXPECT_EQ(0u, matching_items.size());
1244 login_db_->GetLogins(*www_form, &matching_items); 1248 login_db_->GetLogins(*www_form, &matching_items);
1245 EXPECT_EQ(0u, matching_items.size()); 1249 EXPECT_EQ(0u, matching_items.size());
1246 // No trace of m.facebook.com. 1250 // No trace of m.facebook.com.
1247 matching_items = owned_keychain_adapter.PasswordsFillingForm( 1251 matching_items = owned_keychain_adapter.PasswordsFillingForm(
1248 m_form.signon_realm, m_form.scheme); 1252 m_form.signon_realm, m_form.scheme);
1249 EXPECT_EQ(0u, matching_items.size()); 1253 EXPECT_EQ(0u, matching_items.size());
1250 login_db_->GetLogins(m_form, &matching_items); 1254 login_db_->GetLogins(m_form, &matching_items);
1251 EXPECT_EQ(0u, matching_items.size()); 1255 EXPECT_EQ(0u, matching_items.size());
1252 } 1256 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc ('k') | components/autofill/core/common/password_form.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698