diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-28 20:44:58 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-28 20:44:58 +0000 |
commit | 799c8ef9901a90908432f2d82daafa79a7fecc1f (patch) | |
tree | afe7b70a5bcc23ab8226ea7644f4657b82e79f8d /net/base | |
parent | 43697beaf68c2da90b7ea24838035c88e757af75 (diff) | |
download | chromium_src-799c8ef9901a90908432f2d82daafa79a7fecc1f.zip chromium_src-799c8ef9901a90908432f2d82daafa79a7fecc1f.tar.gz chromium_src-799c8ef9901a90908432f2d82daafa79a7fecc1f.tar.bz2 |
Change update threshold in CookieMonster for testing from 1s to 20ms to speedup test.
BUG=24687
TEST=unit tests still pass
Review URL: http://codereview.chromium.org/345012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/cookie_monster.h | 6 | ||||
-rw-r--r-- | net/base/cookie_monster_unittest.cc | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 12c8f31..f388fef 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -60,11 +60,11 @@ class CookieMonster : public CookieStore { CookieMonster(PersistentCookieStore* store); #ifdef UNIT_TEST - CookieMonster(int last_access_threshold_seconds) + CookieMonster(int last_access_threshold_milliseconds) : initialized_(false), store_(NULL), - last_access_threshold_( - base::TimeDelta::FromSeconds(last_access_threshold_seconds)) { + last_access_threshold_(base::TimeDelta::FromMilliseconds( + last_access_threshold_milliseconds)) { SetDefaultCookieableSchemes(); } #endif diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc index e8080f5..2befaae 100644 --- a/net/base/cookie_monster_unittest.cc +++ b/net/base/cookie_monster_unittest.cc @@ -817,12 +817,12 @@ static Time GetFirstCookieAccessDate(net::CookieMonster* cm) { 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 @@ TEST(CookieMonsterTest, TestLastAccess) { EXPECT_TRUE(last_access_date == GetFirstCookieAccessDate(cm)); // Reading after a short wait should update the access date. - PlatformThread::Sleep(1500); + PlatformThread::Sleep(kLastAccessThresholdMilliseconds + 10); EXPECT_EQ("A=B", cm->GetCookies(url_google)); EXPECT_FALSE(last_access_date == GetFirstCookieAccessDate(cm)); } @@ -865,7 +865,7 @@ TEST(CookieMonsterTest, TestHostGarbageCollection) { 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 @@ TEST(CookieMonsterTest, TestTotalGarbageCollection) { // 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)); } } |