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/host_resolver_impl.h" | 5 #include "net/dns/host_resolver_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 Request* req1 = CreateRequest("er_ipv4", 80); | 1368 Request* req1 = CreateRequest("er_ipv4", 80); |
1369 EXPECT_EQ(OK, req1->Resolve()); | 1369 EXPECT_EQ(OK, req1->Resolve()); |
1370 EXPECT_TRUE(req1->HasOneAddress("127.0.0.1", 80)); | 1370 EXPECT_TRUE(req1->HasOneAddress("127.0.0.1", 80)); |
1371 | 1371 |
1372 Request* req2 = CreateRequest("er_ipv6", 80); | 1372 Request* req2 = CreateRequest("er_ipv6", 80); |
1373 EXPECT_EQ(OK, req2->Resolve()); | 1373 EXPECT_EQ(OK, req2->Resolve()); |
1374 EXPECT_TRUE(req2->HasOneAddress("::1", 80)); | 1374 EXPECT_TRUE(req2->HasOneAddress("::1", 80)); |
1375 | 1375 |
1376 Request* req3 = CreateRequest("er_both", 80); | 1376 Request* req3 = CreateRequest("er_both", 80); |
1377 EXPECT_EQ(OK, req3->Resolve()); | 1377 EXPECT_EQ(OK, req3->Resolve()); |
1378 EXPECT_TRUE(req3->HasOneAddress("127.0.0.1", 80) || | 1378 EXPECT_TRUE(req3->HasAddress("127.0.0.1", 80) && |
1379 req3->HasOneAddress("::1", 80)); | 1379 req3->HasAddress("::1", 80)); |
1380 | 1380 |
1381 // Requests with specified AddressFamily. | 1381 // Requests with specified AddressFamily. |
1382 Request* req4 = CreateRequest("er_ipv4", 80, MEDIUM, ADDRESS_FAMILY_IPV4); | 1382 Request* req4 = CreateRequest("er_ipv4", 80, MEDIUM, ADDRESS_FAMILY_IPV4); |
1383 EXPECT_EQ(OK, req4->Resolve()); | 1383 EXPECT_EQ(OK, req4->Resolve()); |
1384 EXPECT_TRUE(req4->HasOneAddress("127.0.0.1", 80)); | 1384 EXPECT_TRUE(req4->HasOneAddress("127.0.0.1", 80)); |
1385 | 1385 |
1386 Request* req5 = CreateRequest("er_ipv6", 80, MEDIUM, ADDRESS_FAMILY_IPV6); | 1386 Request* req5 = CreateRequest("er_ipv6", 80, MEDIUM, ADDRESS_FAMILY_IPV6); |
1387 EXPECT_EQ(OK, req5->Resolve()); | 1387 EXPECT_EQ(OK, req5->Resolve()); |
1388 EXPECT_TRUE(req5->HasOneAddress("::1", 80)); | 1388 EXPECT_TRUE(req5->HasOneAddress("::1", 80)); |
1389 | 1389 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 // Make |proc_| default to failures. | 1472 // Make |proc_| default to failures. |
1473 proc_->AddRuleForAllFamilies("", ""); | 1473 proc_->AddRuleForAllFamilies("", ""); |
1474 | 1474 |
1475 // DnsTask should still be enabled. | 1475 // DnsTask should still be enabled. |
1476 Request* req = CreateRequest("ok_last", 80); | 1476 Request* req = CreateRequest("ok_last", 80); |
1477 EXPECT_EQ(ERR_IO_PENDING, req->Resolve()); | 1477 EXPECT_EQ(ERR_IO_PENDING, req->Resolve()); |
1478 EXPECT_EQ(OK, req->WaitForResult()); | 1478 EXPECT_EQ(OK, req->WaitForResult()); |
1479 } | 1479 } |
1480 | 1480 |
1481 } // namespace net | 1481 } // namespace net |
OLD | NEW |