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_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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 ConfigureFactory(); | 638 ConfigureFactory(); |
639 | 639 |
640 // Responses for first request. | 640 // Responses for first request. |
641 AddQueryAndTimeout(kT0HostName, kT0Qtype); | 641 AddQueryAndTimeout(kT0HostName, kT0Qtype); |
642 AddAsyncQueryAndRcode(kT0HostName, kT0Qtype, dns_protocol::kRcodeSERVFAIL); | 642 AddAsyncQueryAndRcode(kT0HostName, kT0Qtype, dns_protocol::kRcodeSERVFAIL); |
643 AddQueryAndTimeout(kT0HostName, kT0Qtype); | 643 AddQueryAndTimeout(kT0HostName, kT0Qtype); |
644 AddAsyncQueryAndRcode(kT0HostName, kT0Qtype, dns_protocol::kRcodeSERVFAIL); | 644 AddAsyncQueryAndRcode(kT0HostName, kT0Qtype, dns_protocol::kRcodeSERVFAIL); |
645 AddAsyncQueryAndRcode(kT0HostName, kT0Qtype, dns_protocol::kRcodeNXDOMAIN); | 645 AddAsyncQueryAndRcode(kT0HostName, kT0Qtype, dns_protocol::kRcodeNXDOMAIN); |
646 // Responses for second request. | 646 // Responses for second request. |
647 AddAsyncQueryAndRcode(kT1HostName, kT1Qtype, dns_protocol::kRcodeSERVFAIL); | 647 AddAsyncQueryAndRcode(kT1HostName, kT1Qtype, dns_protocol::kRcodeSERVFAIL); |
| 648 AddAsyncQueryAndRcode(kT1HostName, kT1Qtype, dns_protocol::kRcodeSERVFAIL); |
648 AddAsyncQueryAndRcode(kT1HostName, kT1Qtype, dns_protocol::kRcodeNXDOMAIN); | 649 AddAsyncQueryAndRcode(kT1HostName, kT1Qtype, dns_protocol::kRcodeNXDOMAIN); |
649 | 650 |
650 TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_NAME_NOT_RESOLVED); | 651 TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_NAME_NOT_RESOLVED); |
651 TransactionHelper helper1(kT1HostName, kT1Qtype, ERR_NAME_NOT_RESOLVED); | 652 TransactionHelper helper1(kT1HostName, kT1Qtype, ERR_NAME_NOT_RESOLVED); |
652 | 653 |
653 EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); | 654 EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); |
654 EXPECT_TRUE(helper1.Run(transaction_factory_.get())); | 655 EXPECT_TRUE(helper1.Run(transaction_factory_.get())); |
655 | 656 |
656 unsigned kOrder[] = { | 657 unsigned kOrder[] = { |
657 0, 1, 2, 0, 1, // The first transaction. | 658 0, 1, 2, 0, 1, // The first transaction. |
658 1, 2, // The second transaction starts from the next server. | 659 1, 2, 0, // The second transaction starts from the next server. |
659 }; | 660 }; |
660 CheckServerOrder(kOrder, arraysize(kOrder)); | 661 CheckServerOrder(kOrder, arraysize(kOrder)); |
661 } | 662 } |
662 | 663 |
663 TEST_F(DnsTransactionTest, SuffixSearchAboveNdots) { | 664 TEST_F(DnsTransactionTest, SuffixSearchAboveNdots) { |
664 config_.ndots = 2; | 665 config_.ndots = 2; |
665 config_.search.push_back("a"); | 666 config_.search.push_back("a"); |
666 config_.search.push_back("b"); | 667 config_.search.push_back("b"); |
667 config_.search.push_back("c"); | 668 config_.search.push_back("c"); |
668 config_.rotate = true; | 669 config_.rotate = true; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 AddSocketData(make_scoped_ptr( | 912 AddSocketData(make_scoped_ptr( |
912 new DnsSocketData(1 /* id */, kT0HostName, kT0Qtype, ASYNC, true))); | 913 new DnsSocketData(1 /* id */, kT0HostName, kT0Qtype, ASYNC, true))); |
913 | 914 |
914 TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_TIMED_OUT); | 915 TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_TIMED_OUT); |
915 EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); | 916 EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); |
916 } | 917 } |
917 | 918 |
918 } // namespace | 919 } // namespace |
919 | 920 |
920 } // namespace net | 921 } // namespace net |
OLD | NEW |