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_test_util.h" | 5 #include "net/dns/dns_test_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 writer.WriteBytes(kIPv6Loopback, sizeof(kIPv6Loopback)); | 119 writer.WriteBytes(kIPv6Loopback, sizeof(kIPv6Loopback)); |
120 } | 120 } |
121 nbytes += answer_size; | 121 nbytes += answer_size; |
122 } | 122 } |
123 EXPECT_TRUE(response.InitParse(nbytes, query)); | 123 EXPECT_TRUE(response.InitParse(nbytes, query)); |
124 callback_.Run(this, OK, &response); | 124 callback_.Run(this, OK, &response); |
125 } break; | 125 } break; |
126 case MockDnsClientRule::FAIL_ASYNC: | 126 case MockDnsClientRule::FAIL_ASYNC: |
127 callback_.Run(this, ERR_NAME_NOT_RESOLVED, NULL); | 127 callback_.Run(this, ERR_NAME_NOT_RESOLVED, NULL); |
128 break; | 128 break; |
| 129 case MockDnsClientRule::TIMEOUT: |
| 130 callback_.Run(this, ERR_DNS_TIMED_OUT, NULL); |
| 131 break; |
129 default: | 132 default: |
130 NOTREACHED(); | 133 NOTREACHED(); |
131 break; | 134 break; |
132 } | 135 } |
133 } | 136 } |
134 | 137 |
135 MockDnsClientRule::Result result_; | 138 MockDnsClientRule::Result result_; |
136 const std::string hostname_; | 139 const std::string hostname_; |
137 const uint16 qtype_; | 140 const uint16 qtype_; |
138 DnsTransactionFactory::CallbackType callback_; | 141 DnsTransactionFactory::CallbackType callback_; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 205 |
203 } // namespace | 206 } // namespace |
204 | 207 |
205 // static | 208 // static |
206 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config, | 209 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config, |
207 const MockDnsClientRuleList& rules) { | 210 const MockDnsClientRuleList& rules) { |
208 return scoped_ptr<DnsClient>(new MockDnsClient(config, rules)); | 211 return scoped_ptr<DnsClient>(new MockDnsClient(config, rules)); |
209 } | 212 } |
210 | 213 |
211 } // namespace net | 214 } // namespace net |
OLD | NEW |