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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 // Use short timeout to speed up the test. | 614 // Use short timeout to speed up the test. |
615 config_.timeout = TestTimeouts::tiny_timeout(); | 615 config_.timeout = TestTimeouts::tiny_timeout(); |
616 ConfigureFactory(); | 616 ConfigureFactory(); |
617 | 617 |
618 AddQueryAndTimeout(kT0HostName, kT0Qtype); | 618 AddQueryAndTimeout(kT0HostName, kT0Qtype); |
619 AddQueryAndTimeout(kT0HostName, kT0Qtype); | 619 AddQueryAndTimeout(kT0HostName, kT0Qtype); |
620 AddQueryAndTimeout(kT0HostName, kT0Qtype); | 620 AddQueryAndTimeout(kT0HostName, kT0Qtype); |
621 | 621 |
622 TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_TIMED_OUT); | 622 TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_TIMED_OUT); |
623 EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); | 623 EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); |
624 base::MessageLoop::current()->AssertIdle(); | 624 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
625 } | 625 } |
626 | 626 |
627 TEST_F(DnsTransactionTest, ServerFallbackAndRotate) { | 627 TEST_F(DnsTransactionTest, ServerFallbackAndRotate) { |
628 // Test that we fallback on both server failure and timeout. | 628 // Test that we fallback on both server failure and timeout. |
629 config_.attempts = 2; | 629 config_.attempts = 2; |
630 // The next request should start from the next server. | 630 // The next request should start from the next server. |
631 config_.rotate = true; | 631 config_.rotate = true; |
632 ConfigureNumServers(3); | 632 ConfigureNumServers(3); |
633 // Use short timeout to speed up the test. | 633 // Use short timeout to speed up the test. |
634 config_.timeout = TestTimeouts::tiny_timeout(); | 634 config_.timeout = TestTimeouts::tiny_timeout(); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 config_.timeout = TestTimeouts::tiny_timeout(); | 931 config_.timeout = TestTimeouts::tiny_timeout(); |
932 ConfigureFactory(); | 932 ConfigureFactory(); |
933 | 933 |
934 TransactionHelper helper0(".", dns_protocol::kTypeA, ERR_INVALID_ARGUMENT); | 934 TransactionHelper helper0(".", dns_protocol::kTypeA, ERR_INVALID_ARGUMENT); |
935 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); | 935 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); |
936 } | 936 } |
937 | 937 |
938 } // namespace | 938 } // namespace |
939 | 939 |
940 } // namespace net | 940 } // namespace net |
OLD | NEW |