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