Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/dns/dns_session.h" | 5 #include "net/dns/dns_session.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 | 213 |
| 214 lease1.reset(); | 214 lease1.reset(); |
| 215 EXPECT_TRUE(DidFree(0)); | 215 EXPECT_TRUE(DidFree(0)); |
| 216 EXPECT_TRUE(NoMoreEvents()); | 216 EXPECT_TRUE(NoMoreEvents()); |
| 217 | 217 |
| 218 lease2.reset(); | 218 lease2.reset(); |
| 219 EXPECT_TRUE(DidFree(1)); | 219 EXPECT_TRUE(DidFree(1)); |
| 220 EXPECT_TRUE(NoMoreEvents()); | 220 EXPECT_TRUE(NoMoreEvents()); |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace | 223 TEST_F(DnsSessionTest, HistogramTimeoutNormal) { |
| 224 Initialize(2); | |
| 225 // Calculated timeout must be within 10ms of config timeout. | |
|
szym
2013/07/25 22:47:24
Put comments on expectations just before TEST_F.
mef
2013/07/26 11:27:07
Done.
| |
| 226 base::TimeDelta timeoutDelta = session_->NextTimeout(0, 0) - config_.timeout; | |
| 227 EXPECT_LT(timeoutDelta.InMilliseconds(), 10); | |
| 228 } | |
| 229 | |
| 230 TEST_F(DnsSessionTest, HistogramTimeoutShort) { | |
| 231 config_.timeout = base::TimeDelta::FromMilliseconds(15); | |
| 232 Initialize(2); | |
| 233 // Calculated timeout must be within 10ms of config timeout. | |
| 234 base::TimeDelta timeoutDelta = session_->NextTimeout(0, 0) - config_.timeout; | |
| 235 EXPECT_LT(timeoutDelta.InMilliseconds(), 10); | |
| 236 } | |
| 237 | |
| 238 TEST_F(DnsSessionTest, HistogramTimeoutLong) { | |
| 239 config_.timeout = base::TimeDelta::FromSeconds(15); | |
| 240 Initialize(2); | |
| 241 // Long timeout must be honored exactly. | |
| 242 base::TimeDelta timeout = session_->NextTimeout(0, 0); | |
| 243 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); | |
| 244 } | |
| 245 | |
| 246 } // namespace | |
| 224 | 247 |
| 225 } // namespace net | 248 } // namespace net |
| OLD | NEW |