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

Unified Diff: chrome/browser/net/url_info_unittest.cc

Issue 9088015: Fix Sleep() calls to use TimeDelta in portions of chrome/browser. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 12 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/net/connect_interceptor_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/url_info_unittest.cc
diff --git a/chrome/browser/net/url_info_unittest.cc b/chrome/browser/net/url_info_unittest.cc
index 870ad7e0ca33628c2847900efa61790e51603de0..192e61e807d6e26312e0cb0567ec894e9158a765 100644
--- a/chrome/browser/net/url_info_unittest.cc
+++ b/chrome/browser/net/url_info_unittest.cc
@@ -57,8 +57,8 @@ TEST(UrlHostInfoTest, StateChangeTest) {
}
// Run similar test with a shortened expiration, so we can trigger it.
- const int kMockExpirationTime(300); // Vastly reduced expiration time.
- info.set_cache_expiration(TimeDelta::FromMilliseconds(kMockExpirationTime));
+ const TimeDelta kMockExpirationTime = TimeDelta::FromMilliseconds(300);
+ info.set_cache_expiration(kMockExpirationTime);
// That was a nice life when the object was found.... but next time it won't
// be found. We'll sleep for a while, and then come back with not-found.
@@ -67,18 +67,19 @@ TEST(UrlHostInfoTest, StateChangeTest) {
info.SetAssignedState();
EXPECT_FALSE(info.NeedsDnsUpdate());
// Greater than minimal expected network latency on DNS lookup.
- base::PlatformThread::Sleep(25);
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(25));
before_resolution_complete = TimeTicks::Now();
info.SetNoSuchNameState();
// "Immediately" check to see if we need an update yet (we shouldn't).
if (info.NeedsDnsUpdate()) {
// The test bot must be really slow, so we can verify that.
- EXPECT_GT((TimeTicks::Now() - before_resolution_complete).InMilliseconds(),
+ EXPECT_GT((TimeTicks::Now() - before_resolution_complete),
kMockExpirationTime);
return;
}
// Wait over 300ms, so it should definately be considered out of cache.
- base::PlatformThread::Sleep(kMockExpirationTime + 20);
+ base::PlatformThread::Sleep(kMockExpirationTime +
+ TimeDelta::FromMilliseconds(20));
EXPECT_TRUE(info.NeedsDnsUpdate()) << "expiration time not honored";
}
« no previous file with comments | « chrome/browser/net/connect_interceptor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698