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

Side by Side Diff: net/dns/dns_session_unittest.cc

Issue 1778933002: DNS: Per-network-type and Finch-variable timeouts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix dumb mistakes Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/dns/dns_session.cc ('k') | net/dns/dns_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 lease1.reset(); 213 lease1.reset();
214 EXPECT_TRUE(DidFree(0)); 214 EXPECT_TRUE(DidFree(0));
215 EXPECT_TRUE(NoMoreEvents()); 215 EXPECT_TRUE(NoMoreEvents());
216 216
217 lease2.reset(); 217 lease2.reset();
218 EXPECT_TRUE(DidFree(1)); 218 EXPECT_TRUE(DidFree(1));
219 EXPECT_TRUE(NoMoreEvents()); 219 EXPECT_TRUE(NoMoreEvents());
220 } 220 }
221 221
222 // Expect default calculated timeout to be within 10ms of in DnsConfig. 222 // Expect default calculated timeout to be within 10ms of one in DnsConfig.
223 TEST_F(DnsSessionTest, HistogramTimeoutNormal) { 223 TEST_F(DnsSessionTest, HistogramTimeoutNormal) {
224 Initialize(2); 224 Initialize(2);
225 base::TimeDelta timeoutDelta = session_->NextTimeout(0, 0) - config_.timeout; 225 base::TimeDelta delta = session_->NextTimeout(0, 0) - config_.timeout;
226 EXPECT_LT(timeoutDelta.InMilliseconds(), 10); 226 EXPECT_LE(delta.InMilliseconds(), 10);
Randy Smith (Not in Mondays) 2016/03/17 21:58:16 I have no objections, but what happened to drive c
227 } 227 }
228 228
229 // Expect short calculated timeout to be within 10ms of in DnsConfig. 229 // Expect short calculated timeout to be within 10ms of one in DnsConfig.
230 TEST_F(DnsSessionTest, HistogramTimeoutShort) { 230 TEST_F(DnsSessionTest, HistogramTimeoutShort) {
231 config_.timeout = base::TimeDelta::FromMilliseconds(15); 231 config_.timeout = base::TimeDelta::FromMilliseconds(15);
232 Initialize(2); 232 Initialize(2);
233 base::TimeDelta timeoutDelta = session_->NextTimeout(0, 0) - config_.timeout; 233 base::TimeDelta delta = session_->NextTimeout(0, 0) - config_.timeout;
234 EXPECT_LT(timeoutDelta.InMilliseconds(), 10); 234 EXPECT_LE(delta.InMilliseconds(), 10);
235 } 235 }
236 236
237 // Expect long calculated timeout to be equal to one in DnsConfig. 237 // Expect long calculated timeout to be equal to one in DnsConfig.
238 // (Default max timeout is 5 seconds, so NextTimeout should return exactly
239 // the config timeout.)
238 TEST_F(DnsSessionTest, HistogramTimeoutLong) { 240 TEST_F(DnsSessionTest, HistogramTimeoutLong) {
239 config_.timeout = base::TimeDelta::FromSeconds(15); 241 config_.timeout = base::TimeDelta::FromSeconds(15);
240 Initialize(2); 242 Initialize(2);
241 base::TimeDelta timeout = session_->NextTimeout(0, 0); 243 base::TimeDelta timeout = session_->NextTimeout(0, 0);
242 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); 244 EXPECT_EQ(timeout.InMilliseconds(), config_.timeout.InMilliseconds());
243 } 245 }
244 246
245 } // namespace 247 } // namespace
246 248
247 } // namespace net 249 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_session.cc ('k') | net/dns/dns_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698