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 // Expect default calculated timeout to be within 10ms of in DnsConfig. |
| 224 TEST_F(DnsSessionTest, HistogramTimeoutNormal) { |
| 225 Initialize(2); |
| 226 base::TimeDelta timeoutDelta = session_->NextTimeout(0, 0) - config_.timeout; |
| 227 EXPECT_LT(timeoutDelta.InMilliseconds(), 10); |
| 228 } |
| 229 |
| 230 // Expect short calculated timeout to be within 10ms of in DnsConfig. |
| 231 TEST_F(DnsSessionTest, HistogramTimeoutShort) { |
| 232 config_.timeout = base::TimeDelta::FromMilliseconds(15); |
| 233 Initialize(2); |
| 234 base::TimeDelta timeoutDelta = session_->NextTimeout(0, 0) - config_.timeout; |
| 235 EXPECT_LT(timeoutDelta.InMilliseconds(), 10); |
| 236 } |
| 237 |
| 238 // Expect long calculated timeout to be equal to one in DnsConfig. |
| 239 TEST_F(DnsSessionTest, HistogramTimeoutLong) { |
| 240 config_.timeout = base::TimeDelta::FromSeconds(15); |
| 241 Initialize(2); |
| 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 |