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

Side by Side Diff: chrome/browser/password_manager/native_backend_gnome_x_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
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 <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/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EXPECT_EQ(expected.origin, actual.origin); 291 EXPECT_EQ(expected.origin, actual.origin);
292 EXPECT_EQ(expected.password_value, actual.password_value); 292 EXPECT_EQ(expected.password_value, actual.password_value);
293 EXPECT_EQ(expected.action, actual.action); 293 EXPECT_EQ(expected.action, actual.action);
294 EXPECT_EQ(expected.username_element, actual.username_element); 294 EXPECT_EQ(expected.username_element, actual.username_element);
295 EXPECT_EQ(expected.username_value, actual.username_value); 295 EXPECT_EQ(expected.username_value, actual.username_value);
296 EXPECT_EQ(expected.password_element, actual.password_element); 296 EXPECT_EQ(expected.password_element, actual.password_element);
297 EXPECT_EQ(expected.submit_element, actual.submit_element); 297 EXPECT_EQ(expected.submit_element, actual.submit_element);
298 EXPECT_EQ(expected.signon_realm, actual.signon_realm); 298 EXPECT_EQ(expected.signon_realm, actual.signon_realm);
299 EXPECT_EQ(expected.ssl_valid, actual.ssl_valid); 299 EXPECT_EQ(expected.ssl_valid, actual.ssl_valid);
300 EXPECT_EQ(expected.preferred, actual.preferred); 300 EXPECT_EQ(expected.preferred, actual.preferred);
301 // We don't check the date created. It varies due to bug in the 301 EXPECT_EQ(expected.date_created, actual.date_created);
302 // serialization. Integer seconds are saved instead of microseconds.
303 EXPECT_EQ(expected.blacklisted_by_user, actual.blacklisted_by_user); 302 EXPECT_EQ(expected.blacklisted_by_user, actual.blacklisted_by_user);
304 EXPECT_EQ(expected.type, actual.type); 303 EXPECT_EQ(expected.type, actual.type);
305 EXPECT_EQ(expected.times_used, actual.times_used); 304 EXPECT_EQ(expected.times_used, actual.times_used);
306 EXPECT_EQ(expected.scheme, actual.scheme); 305 EXPECT_EQ(expected.scheme, actual.scheme);
307 EXPECT_EQ(expected.date_synced, actual.date_synced); 306 EXPECT_EQ(expected.date_synced, actual.date_synced);
308 EXPECT_EQ(expected.display_name, actual.display_name); 307 EXPECT_EQ(expected.display_name, actual.display_name);
309 EXPECT_EQ(expected.avatar_url, actual.avatar_url); 308 EXPECT_EQ(expected.avatar_url, actual.avatar_url);
310 EXPECT_EQ(expected.federation_url, actual.federation_url); 309 EXPECT_EQ(expected.federation_url, actual.federation_url);
311 EXPECT_EQ(expected.skip_zero_click, actual.skip_zero_click); 310 EXPECT_EQ(expected.skip_zero_click, actual.skip_zero_click);
312 } 311 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 other_auth_, GURL("http://first.example.com"), scheme, NULL)); 655 other_auth_, GURL("http://first.example.com"), scheme, NULL));
657 // Do match non-HTML forms from the same origin. 656 // Do match non-HTML forms from the same origin.
658 EXPECT_TRUE(CheckCredentialAvailability( 657 EXPECT_TRUE(CheckCredentialAvailability(
659 other_auth_, GURL("http://www.example.com/"), scheme, NULL)); 658 other_auth_, GURL("http://www.example.com/"), scheme, NULL));
660 } 659 }
661 660
662 void CheckRemoveLoginsBetween(RemoveBetweenMethod date_to_test) { 661 void CheckRemoveLoginsBetween(RemoveBetweenMethod date_to_test) {
663 NativeBackendGnome backend(42); 662 NativeBackendGnome backend(42);
664 backend.Init(); 663 backend.Init();
665 664
665 base::Time now = base::Time::Now();
666 base::Time next_day = now + base::TimeDelta::FromDays(1);
666 form_google_.date_synced = base::Time(); 667 form_google_.date_synced = base::Time();
667 form_isc_.date_synced = base::Time(); 668 form_isc_.date_synced = base::Time();
668 form_google_.date_created = base::Time(); 669 form_google_.date_created = now;
669 form_isc_.date_created = base::Time(); 670 form_isc_.date_created = now;
670 base::Time now = base::Time::Now();
671 base::Time next_day = now + base::TimeDelta::FromDays(1);
672 if (date_to_test == CREATED) { 671 if (date_to_test == CREATED) {
673 // crbug/374132. Remove the next line once it's fixed.
674 next_day = base::Time::FromTimeT(next_day.ToTimeT());
675 form_google_.date_created = now; 672 form_google_.date_created = now;
676 form_isc_.date_created = next_day; 673 form_isc_.date_created = next_day;
677 } else { 674 } else {
678 form_google_.date_synced = now; 675 form_google_.date_synced = now;
679 form_isc_.date_synced = next_day; 676 form_isc_.date_synced = next_day;
680 } 677 }
681 678
682 BrowserThread::PostTask( 679 BrowserThread::PostTask(
683 BrowserThread::DB, 680 BrowserThread::DB,
684 FROM_HERE, 681 FROM_HERE,
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 1062
1066 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { 1063 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) {
1067 CheckRemoveLoginsBetween(CREATED); 1064 CheckRemoveLoginsBetween(CREATED);
1068 } 1065 }
1069 1066
1070 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { 1067 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) {
1071 CheckRemoveLoginsBetween(SYNCED); 1068 CheckRemoveLoginsBetween(SYNCED);
1072 } 1069 }
1073 1070
1074 // TODO(mdm): add more basic tests here at some point. 1071 // TODO(mdm): add more basic tests here at some point.
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/native_backend_gnome_x.cc ('k') | chrome/browser/password_manager/native_backend_kwallet_x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698