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

Unified Diff: chrome/browser/profiles/profile_info_cache_unittest.cc

Issue 134863002: Track when profiles are last used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't send notifications for active-time updates; nobody wants it and some tests aren't prepared fo… Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/profiles/profile_info_interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_info_cache_unittest.cc
diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc
index 571411501df6202e6bf58638e5e5fc9f24df01b3..5e110f65983a6ea4079d13ad179e4e5f0bdd9f4b 100644
--- a/chrome/browser/profiles/profile_info_cache_unittest.cc
+++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -9,6 +9,7 @@
#include "base/prefs/testing_pref_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
@@ -307,6 +308,18 @@ TEST_F(ProfileInfoCacheTest, HasMigrated) {
EXPECT_FALSE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(1));
}
+TEST_F(ProfileInfoCacheTest, ProfileActiveTime) {
+ GetCache()->AddProfileToCache(
+ GetProfilePath("path_1"), ASCIIToUTF16("name_1"),
+ base::string16(), 0, std::string());
+ EXPECT_EQ(base::Time(), GetCache()->GetProfileActiveTimeAtIndex(0));
+ base::Time before = base::Time::Now();
+ GetCache()->SetProfileActiveTimeAtIndex(0);
+ base::Time after = base::Time::Now();
+ EXPECT_LE(before, GetCache()->GetProfileActiveTimeAtIndex(0));
+ EXPECT_GE(after, GetCache()->GetProfileActiveTimeAtIndex(0));
+}
+
TEST_F(ProfileInfoCacheTest, GAIAName) {
GetCache()->AddProfileToCache(
GetProfilePath("path_1"), ASCIIToUTF16("name_1"),
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/profiles/profile_info_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698