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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 // Checks if the sockets were connected in the order matching the indices in | 434 // Checks if the sockets were connected in the order matching the indices in |
435 // |servers|. | 435 // |servers|. |
436 void CheckServerOrder(const unsigned* servers, size_t num_attempts) { | 436 void CheckServerOrder(const unsigned* servers, size_t num_attempts) { |
437 ASSERT_EQ(num_attempts, socket_factory_->remote_endpoints_.size()); | 437 ASSERT_EQ(num_attempts, socket_factory_->remote_endpoints_.size()); |
438 for (size_t i = 0; i < num_attempts; ++i) { | 438 for (size_t i = 0; i < num_attempts; ++i) { |
439 EXPECT_EQ(socket_factory_->remote_endpoints_[i], | 439 EXPECT_EQ(socket_factory_->remote_endpoints_[i], |
440 session_->config().nameservers[servers[i]]); | 440 session_->config().nameservers[servers[i]]); |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 virtual void SetUp() override { | 444 void SetUp() override { |
445 // By default set one server, | 445 // By default set one server, |
446 ConfigureNumServers(1); | 446 ConfigureNumServers(1); |
447 // and no retransmissions, | 447 // and no retransmissions, |
448 config_.attempts = 1; | 448 config_.attempts = 1; |
449 // but long enough timeout for memory tests. | 449 // but long enough timeout for memory tests. |
450 config_.timeout = TestTimeouts::action_timeout(); | 450 config_.timeout = TestTimeouts::action_timeout(); |
451 ConfigureFactory(); | 451 ConfigureFactory(); |
452 } | 452 } |
453 | 453 |
454 virtual void TearDown() override { | 454 void TearDown() override { |
455 // Check that all socket data was at least written to. | 455 // Check that all socket data was at least written to. |
456 for (size_t i = 0; i < socket_data_.size(); ++i) { | 456 for (size_t i = 0; i < socket_data_.size(); ++i) { |
457 EXPECT_TRUE(socket_data_[i]->was_written()) << i; | 457 EXPECT_TRUE(socket_data_[i]->was_written()) << i; |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 protected: | 461 protected: |
462 int GetNextId(int min, int max) { | 462 int GetNextId(int min, int max) { |
463 EXPECT_FALSE(transaction_ids_.empty()); | 463 EXPECT_FALSE(transaction_ids_.empty()); |
464 int id = transaction_ids_.front(); | 464 int id = transaction_ids_.front(); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 config_.timeout = TestTimeouts::tiny_timeout(); | 1002 config_.timeout = TestTimeouts::tiny_timeout(); |
1003 ConfigureFactory(); | 1003 ConfigureFactory(); |
1004 | 1004 |
1005 TransactionHelper helper0(".", dns_protocol::kTypeA, ERR_INVALID_ARGUMENT); | 1005 TransactionHelper helper0(".", dns_protocol::kTypeA, ERR_INVALID_ARGUMENT); |
1006 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); | 1006 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); |
1007 } | 1007 } |
1008 | 1008 |
1009 } // namespace | 1009 } // namespace |
1010 | 1010 |
1011 } // namespace net | 1011 } // namespace net |
OLD | NEW |