Chromium Code Reviews| Index: net/dns/dns_transaction_unittest.cc |
| diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc |
| index f6fb8e5d795e97366097615a7ff281d8980a1d5a..262e06cde07476321ed0e42505b15bed921c46be 100644 |
| --- a/net/dns/dns_transaction_unittest.cc |
| +++ b/net/dns/dns_transaction_unittest.cc |
| @@ -185,8 +185,10 @@ class TestSocketFactory : public MockClientSocketFactory { |
| const RandIntCallback& rand_int_cb, |
| net::NetLog* net_log, |
| const net::NetLog::Source& source) OVERRIDE { |
| - if (create_failing_sockets_) |
| + if (create_failing_sockets_) { |
|
szym
2013/05/29 17:09:42
Suggest renaming this field to |fail_next_socket_|
mef
2013/05/29 17:24:04
Done.
|
| + create_failing_sockets_ = false; |
| return new FailingUDPClientSocket(&empty_data_, net_log); |
| + } |
| SocketDataProvider* data_provider = mock_data().GetNext(); |
| TestUDPClientSocket* socket = new TestUDPClientSocket(this, |
| data_provider, |
| @@ -865,6 +867,21 @@ TEST_F(DnsTransactionTest, ConnectFailure) { |
| EXPECT_TRUE(helper0.Run(transaction_factory_.get())); |
| } |
| +TEST_F(DnsTransactionTest, ConnectFailureDoesntCrashInRecordLostPacketsIfAny) { |
|
szym
2013/05/29 17:09:42
suggest just calling the test "ConnectFailureFollo
mef
2013/05/29 17:24:04
Done.
|
| + // Fallback on server failure. |
|
szym
2013/05/29 17:09:42
suggest: "// Retry after failure."
mef
2013/05/29 17:24:04
Done.
|
| + config_.attempts = 2; |
| + ConfigureFactory(); |
| + // First server connection attempt fails. |
| + transaction_ids_.push_back(0); // Needed to make a DnsUDPAttempt. |
| + socket_factory_->create_failing_sockets_ = true; |
| + // Second DNS query succeeds. |
| + AddAsyncQueryAndResponse(0 /* id */, kT0HostName, kT0Qtype, |
| + kT0ResponseDatagram, arraysize(kT0ResponseDatagram)); |
| + TransactionHelper helper0(kT0HostName, kT0Qtype, kT0RecordCount); |
| + // Expect no crash here! |
|
szym
2013/05/29 17:09:42
unnecessary comment
mef
2013/05/29 17:24:04
Done.
|
| + EXPECT_TRUE(helper0.Run(transaction_factory_.get())); |
| +} |
| + |
| TEST_F(DnsTransactionTest, TCPLookup) { |
| AddAsyncQueryAndRcode(kT0HostName, kT0Qtype, |
| dns_protocol::kRcodeNOERROR | dns_protocol::kFlagTC); |