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

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

Issue 9667025: [net/dns] Serve requests from HOSTS file if possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added NumberOfAddresses checks. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « net/dns/dns_test_util.cc ('k') | net/net.gyp » ('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_transaction.h" 5 #include "net/dns/dns_transaction.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 class DnsTransactionTest : public testing::Test { 195 class DnsTransactionTest : public testing::Test {
196 public: 196 public:
197 DnsTransactionTest() : socket_factory_(NULL) {} 197 DnsTransactionTest() : socket_factory_(NULL) {}
198 198
199 // Generates |nameservers| for DnsConfig. 199 // Generates |nameservers| for DnsConfig.
200 void ConfigureNumServers(unsigned num_servers) { 200 void ConfigureNumServers(unsigned num_servers) {
201 CHECK_LE(num_servers, 255u); 201 CHECK_LE(num_servers, 255u);
202 config_.nameservers.clear(); 202 config_.nameservers.clear();
203 IPAddressNumber dns_ip; 203 IPAddressNumber dns_ip;
204 { 204 {
205 bool rv = ParseIPLiteralToNumber("192.128.1.0", &dns_ip); 205 bool rv = ParseIPLiteralToNumber("192.168.1.0", &dns_ip);
206 EXPECT_TRUE(rv); 206 EXPECT_TRUE(rv);
207 } 207 }
208 for (unsigned i = 0; i < num_servers; ++i) { 208 for (unsigned i = 0; i < num_servers; ++i) {
209 dns_ip[3] = i; 209 dns_ip[3] = i;
210 config_.nameservers.push_back(IPEndPoint(dns_ip, 210 config_.nameservers.push_back(IPEndPoint(dns_ip,
211 dns_protocol::kDefaultPort)); 211 dns_protocol::kDefaultPort));
212 } 212 }
213 } 213 }
214 214
215 // Called after fully configuring |config|. 215 // Called after fully configuring |config|.
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 TransactionHelper helper2("x", 675 TransactionHelper helper2("x",
676 dns_protocol::kTypeA, 676 dns_protocol::kTypeA,
677 ERR_NAME_NOT_RESOLVED); 677 ERR_NAME_NOT_RESOLVED);
678 EXPECT_TRUE(helper2.Run(transaction_factory_.get())); 678 EXPECT_TRUE(helper2.Run(transaction_factory_.get()));
679 } 679 }
680 680
681 } // namespace 681 } // namespace
682 682
683 } // namespace net 683 } // namespace net
684 684
OLDNEW
« no previous file with comments | « net/dns/dns_test_util.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698