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

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

Issue 1946793002: net: Add fuzzer for HostResolverImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge, fix build Created 4 years, 7 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
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 <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 NetLog::Source source_; 82 NetLog::Source source_;
83 83
84 private: 84 private:
85 bool ExpectEvent(const PoolEvent& event); 85 bool ExpectEvent(const PoolEvent& event);
86 std::list<PoolEvent> events_; 86 std::list<PoolEvent> events_;
87 }; 87 };
88 88
89 class MockDnsSocketPool : public DnsSocketPool { 89 class MockDnsSocketPool : public DnsSocketPool {
90 public: 90 public:
91 MockDnsSocketPool(ClientSocketFactory* factory, DnsSessionTest* test) 91 MockDnsSocketPool(ClientSocketFactory* factory, DnsSessionTest* test)
92 : DnsSocketPool(factory), test_(test) { } 92 : DnsSocketPool(factory, base::Bind(&base::RandInt)), test_(test) {}
93 93
94 ~MockDnsSocketPool() override {} 94 ~MockDnsSocketPool() override {}
95 95
96 void Initialize(const std::vector<IPEndPoint>* nameservers, 96 void Initialize(const std::vector<IPEndPoint>* nameservers,
97 NetLog* net_log) override { 97 NetLog* net_log) override {
98 InitializeInternal(nameservers, net_log); 98 InitializeInternal(nameservers, net_log);
99 } 99 }
100 100
101 std::unique_ptr<DatagramClientSocket> AllocateSocket( 101 std::unique_ptr<DatagramClientSocket> AllocateSocket(
102 unsigned server_index) override { 102 unsigned server_index) override {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 TEST_F(DnsSessionTest, HistogramTimeoutLong) { 241 TEST_F(DnsSessionTest, HistogramTimeoutLong) {
242 config_.timeout = base::TimeDelta::FromSeconds(15); 242 config_.timeout = base::TimeDelta::FromSeconds(15);
243 Initialize(2); 243 Initialize(2);
244 base::TimeDelta timeout = session_->NextTimeout(0, 0); 244 base::TimeDelta timeout = session_->NextTimeout(0, 0);
245 EXPECT_EQ(timeout.InMilliseconds(), config_.timeout.InMilliseconds()); 245 EXPECT_EQ(timeout.InMilliseconds(), config_.timeout.InMilliseconds());
246 } 246 }
247 247
248 } // namespace 248 } // namespace
249 249
250 } // namespace net 250 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698