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

Unified Diff: net/cookies/cookie_monster_unittest.cc

Issue 2007563003: Access-time threshold unit failure in CookieMonster. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: empty 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 45c3063b70c48ef8fbd2659d9644a793ff1462a0..4665a0fc2ed12ad0fe51660defe553263f6930d1 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -1219,11 +1219,14 @@ TEST_F(CookieMonsterTest, TestCookieDeleteAllCreatedBetweenTimestamps) {
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) {
scoped_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()));
@@ -1236,8 +1239,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",
@@ -1289,7 +1291,7 @@ TEST_F(CookieMonsterTest, SetCookieableSchemes) {
TEST_F(CookieMonsterTest, GetAllCookiesForURL) {
scoped_ptr<CookieMonster> cm(
- new CookieMonster(nullptr, nullptr, kLastAccessThresholdMilliseconds));
+ new CookieMonster(nullptr, nullptr, kLastAccessThreshold));
// Create an httponly cookie.
CookieOptions options;
@@ -1306,8 +1308,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