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

Unified Diff: net/base/cookie_monster_unittest.cc

Issue 345012: Change update threshold in CookieMonster for testing from 1s to 20ms. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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/base/cookie_monster.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cookie_monster_unittest.cc
===================================================================
--- net/base/cookie_monster_unittest.cc (revision 30229)
+++ net/base/cookie_monster_unittest.cc (working copy)
@@ -817,12 +817,12 @@
return all_cookies.front().second.LastAccessDate();
}
-static const int kLastAccessThresholdSeconds = 1;
+static const int kLastAccessThresholdMilliseconds = 20;
TEST(CookieMonsterTest, TestLastAccess) {
GURL url_google(kUrlGoogle);
scoped_refptr<net::CookieMonster> cm(
- new net::CookieMonster(kLastAccessThresholdSeconds));
+ new net::CookieMonster(kLastAccessThresholdMilliseconds));
EXPECT_TRUE(cm->SetCookie(url_google, "A=B"));
const Time last_access_date(GetFirstCookieAccessDate(cm));
@@ -833,7 +833,7 @@
EXPECT_TRUE(last_access_date == GetFirstCookieAccessDate(cm));
// Reading after a short wait should update the access date.
- PlatformThread::Sleep(1500);
+ PlatformThread::Sleep(kLastAccessThresholdMilliseconds + 10);
Peter Kasting 2009/10/28 20:43:42 For safety due to Windows' low timer resolution, I
EXPECT_EQ("A=B", cm->GetCookies(url_google));
EXPECT_FALSE(last_access_date == GetFirstCookieAccessDate(cm));
}
@@ -865,7 +865,7 @@
TEST(CookieMonsterTest, TestTotalGarbageCollection) {
scoped_refptr<net::CookieMonster> cm(
- new net::CookieMonster(kLastAccessThresholdSeconds));
+ new net::CookieMonster(kLastAccessThresholdMilliseconds));
// Add a bunch of cookies on a bunch of host, some should get purged.
const GURL sticky_cookie("http://a0000.izzle");
@@ -877,8 +877,8 @@
// Keep touching the first cookie to ensure it's not purged (since it will
// always have the most recent access time).
if (!(i % 500)) {
- PlatformThread::Sleep(1500); // Ensure the timestamps will be different
- // enough to update.
+ // Ensure the timestamps will be different enough to update.
+ PlatformThread::Sleep(kLastAccessThresholdMilliseconds + 10);
EXPECT_EQ("a=b", cm->GetCookies(sticky_cookie));
}
}
« no previous file with comments | « net/base/cookie_monster.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698