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

Unified Diff: net/cookies/cookie_monster_unittest.cc

Issue 1988343003: Access-time threshold unit failure in CookieMonster. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: deconst Created 4 years, 7 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 | « net/cookies/cookie_monster.cc ('k') | net/cookies/cookie_store_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_monster_unittest.cc
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index c5364a2c897499fb9d6cdc444a090ec79127d23c..8c12cdecde4371af6e4cc1b03be60115e3949034 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -1506,11 +1506,14 @@ TEST_F(CookieMonsterTest,
EXPECT_EQ(0, DeleteAll(cm.get()));
}
-static const int kAccessDelayMs = kLastAccessThresholdMilliseconds + 20;
+static const base::TimeDelta kLastAccessThreshold =
+ base::TimeDelta::FromMilliseconds(200);
+static const base::TimeDelta kAccessDelay =
+ kLastAccessThreshold + base::TimeDelta::FromMilliseconds(20);
TEST_F(CookieMonsterTest, TestLastAccess) {
std::unique_ptr<CookieMonster> cm(
- new CookieMonster(nullptr, nullptr, kLastAccessThresholdMilliseconds));
+ new CookieMonster(nullptr, nullptr, kLastAccessThreshold));
EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "A=B"));
const Time last_access_date(GetFirstCookieAccessDate(cm.get()));
@@ -1523,8 +1526,7 @@ TEST_F(CookieMonsterTest, TestLastAccess) {
// Reading after a short wait will update the access date, if the cookie
// is requested with options that would update the access date. First, test
// that the flag's behavior is respected.
- base::PlatformThread::Sleep(
- base::TimeDelta::FromMilliseconds(kAccessDelayMs));
+ base::PlatformThread::Sleep(kAccessDelay);
CookieOptions options;
options.set_do_not_update_access_time();
EXPECT_EQ("A=B",
@@ -1584,7 +1586,7 @@ TEST_F(CookieMonsterTest, SetCookieableSchemes) {
TEST_F(CookieMonsterTest, GetAllCookiesForURL) {
std::unique_ptr<CookieMonster> cm(
- new CookieMonster(nullptr, nullptr, kLastAccessThresholdMilliseconds));
+ new CookieMonster(nullptr, nullptr, kLastAccessThreshold));
// Create an httponly cookie.
CookieOptions options;
@@ -1601,8 +1603,7 @@ TEST_F(CookieMonsterTest, GetAllCookiesForURL) {
const Time last_access_date(GetFirstCookieAccessDate(cm.get()));
- base::PlatformThread::Sleep(
- base::TimeDelta::FromMilliseconds(kAccessDelayMs));
+ base::PlatformThread::Sleep(kAccessDelay);
// Check cookies for url.
CookieList cookies = GetAllCookiesForURL(cm.get(), http_www_google_.url());
« no previous file with comments | « net/cookies/cookie_monster.cc ('k') | net/cookies/cookie_store_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698