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

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

Issue 895653002: Serialize date_created in PasswordStoreX properly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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
« no previous file with comments | « chrome/browser/password_manager/native_backend_libsecret.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 <stdarg.h> 5 #include <stdarg.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 EXPECT_EQ(expected.origin, actual.origin); 229 EXPECT_EQ(expected.origin, actual.origin);
230 EXPECT_EQ(expected.password_value, actual.password_value); 230 EXPECT_EQ(expected.password_value, actual.password_value);
231 EXPECT_EQ(expected.action, actual.action); 231 EXPECT_EQ(expected.action, actual.action);
232 EXPECT_EQ(expected.username_element, actual.username_element); 232 EXPECT_EQ(expected.username_element, actual.username_element);
233 EXPECT_EQ(expected.username_value, actual.username_value); 233 EXPECT_EQ(expected.username_value, actual.username_value);
234 EXPECT_EQ(expected.password_element, actual.password_element); 234 EXPECT_EQ(expected.password_element, actual.password_element);
235 EXPECT_EQ(expected.submit_element, actual.submit_element); 235 EXPECT_EQ(expected.submit_element, actual.submit_element);
236 EXPECT_EQ(expected.signon_realm, actual.signon_realm); 236 EXPECT_EQ(expected.signon_realm, actual.signon_realm);
237 EXPECT_EQ(expected.ssl_valid, actual.ssl_valid); 237 EXPECT_EQ(expected.ssl_valid, actual.ssl_valid);
238 EXPECT_EQ(expected.preferred, actual.preferred); 238 EXPECT_EQ(expected.preferred, actual.preferred);
239 // We don't check the date created. It varies due to bug in the 239 EXPECT_EQ(expected.date_created, actual.date_created);
240 // serialization. Integer seconds are saved instead of microseconds.
241 EXPECT_EQ(expected.blacklisted_by_user, actual.blacklisted_by_user); 240 EXPECT_EQ(expected.blacklisted_by_user, actual.blacklisted_by_user);
242 EXPECT_EQ(expected.type, actual.type); 241 EXPECT_EQ(expected.type, actual.type);
243 EXPECT_EQ(expected.times_used, actual.times_used); 242 EXPECT_EQ(expected.times_used, actual.times_used);
244 EXPECT_EQ(expected.scheme, actual.scheme); 243 EXPECT_EQ(expected.scheme, actual.scheme);
245 EXPECT_EQ(expected.date_synced, actual.date_synced); 244 EXPECT_EQ(expected.date_synced, actual.date_synced);
246 EXPECT_EQ(expected.display_name, actual.display_name); 245 EXPECT_EQ(expected.display_name, actual.display_name);
247 EXPECT_EQ(expected.avatar_url, actual.avatar_url); 246 EXPECT_EQ(expected.avatar_url, actual.avatar_url);
248 EXPECT_EQ(expected.federation_url, actual.federation_url); 247 EXPECT_EQ(expected.federation_url, actual.federation_url);
249 EXPECT_EQ(expected.skip_zero_click, actual.skip_zero_click); 248 EXPECT_EQ(expected.skip_zero_click, actual.skip_zero_click);
250 } 249 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 EXPECT_FALSE(CheckCredentialAvailability( 520 EXPECT_FALSE(CheckCredentialAvailability(
522 other_auth_, GURL("http://first.example.com"), scheme, nullptr)); 521 other_auth_, GURL("http://first.example.com"), scheme, nullptr));
523 // Do match non-HTML forms from the same origin. 522 // Do match non-HTML forms from the same origin.
524 EXPECT_TRUE(CheckCredentialAvailability( 523 EXPECT_TRUE(CheckCredentialAvailability(
525 other_auth_, GURL("http://www.example.com/"), scheme, nullptr)); 524 other_auth_, GURL("http://www.example.com/"), scheme, nullptr));
526 } 525 }
527 526
528 void CheckRemoveLoginsBetween(RemoveBetweenMethod date_to_test) { 527 void CheckRemoveLoginsBetween(RemoveBetweenMethod date_to_test) {
529 NativeBackendLibsecret backend(42); 528 NativeBackendLibsecret backend(42);
530 529
530 base::Time now = base::Time::Now();
531 base::Time next_day = now + base::TimeDelta::FromDays(1);
531 form_google_.date_synced = base::Time(); 532 form_google_.date_synced = base::Time();
532 form_isc_.date_synced = base::Time(); 533 form_isc_.date_synced = base::Time();
533 form_google_.date_created = base::Time(); 534 form_google_.date_created = now;
534 form_isc_.date_created = base::Time(); 535 form_isc_.date_created = now;
535 base::Time now = base::Time::Now();
536 base::Time next_day = now + base::TimeDelta::FromDays(1);
537 if (date_to_test == CREATED) { 536 if (date_to_test == CREATED) {
538 // http://crbug.com/374132. Remove the next line once it's fixed.
539 next_day = base::Time::FromTimeT(next_day.ToTimeT());
540 form_google_.date_created = now; 537 form_google_.date_created = now;
541 form_isc_.date_created = next_day; 538 form_isc_.date_created = next_day;
542 } else { 539 } else {
543 form_google_.date_synced = now; 540 form_google_.date_synced = now;
544 form_isc_.date_synced = next_day; 541 form_isc_.date_synced = next_day;
545 } 542 }
546 543
547 backend.AddLogin(form_google_); 544 backend.AddLogin(form_google_);
548 backend.AddLogin(form_isc_); 545 backend.AddLogin(form_isc_);
549 546
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 833
837 ScopedVector<autofill::PasswordForm> form_list; 834 ScopedVector<autofill::PasswordForm> form_list;
838 backend.GetAutofillableLogins(&form_list); 835 backend.GetAutofillableLogins(&form_list);
839 836
840 EXPECT_EQ(1u, form_list.size()); 837 EXPECT_EQ(1u, form_list.size());
841 EXPECT_EQ(GURL(""), form_list[0]->avatar_url); 838 EXPECT_EQ(GURL(""), form_list[0]->avatar_url);
842 EXPECT_FALSE(form_list[0]->ssl_valid); 839 EXPECT_FALSE(form_list[0]->ssl_valid);
843 } 840 }
844 841
845 // TODO(mdm): add more basic tests here at some point. 842 // TODO(mdm): add more basic tests here at some point.
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/native_backend_libsecret.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698