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/big_endian.h" | 9 #include "base/big_endian.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 if ((rules[i].qtype == qtype) && | 53 if ((rules[i].qtype == qtype) && |
54 (hostname.size() >= prefix.size()) && | 54 (hostname.size() >= prefix.size()) && |
55 (hostname.compare(0, prefix.size(), prefix) == 0)) { | 55 (hostname.compare(0, prefix.size(), prefix) == 0)) { |
56 result_ = rules[i].result; | 56 result_ = rules[i].result; |
57 delayed_ = rules[i].delay; | 57 delayed_ = rules[i].delay; |
58 break; | 58 break; |
59 } | 59 } |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 virtual const std::string& GetHostname() const override { | 63 const std::string& GetHostname() const override { return hostname_; } |
64 return hostname_; | |
65 } | |
66 | 64 |
67 virtual uint16 GetType() const override { | 65 uint16 GetType() const override { return qtype_; } |
68 return qtype_; | |
69 } | |
70 | 66 |
71 virtual void Start() override { | 67 void Start() override { |
72 EXPECT_FALSE(started_); | 68 EXPECT_FALSE(started_); |
73 started_ = true; | 69 started_ = true; |
74 if (delayed_) | 70 if (delayed_) |
75 return; | 71 return; |
76 // Using WeakPtr to cleanly cancel when transaction is destroyed. | 72 // Using WeakPtr to cleanly cancel when transaction is destroyed. |
77 base::MessageLoop::current()->PostTask( | 73 base::MessageLoop::current()->PostTask( |
78 FROM_HERE, base::Bind(&MockTransaction::Finish, AsWeakPtr())); | 74 FROM_HERE, base::Bind(&MockTransaction::Finish, AsWeakPtr())); |
79 } | 75 } |
80 | 76 |
81 void FinishDelayedTransaction() { | 77 void FinishDelayedTransaction() { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 216 |
221 AddressSorter* MockDnsClient::GetAddressSorter() { | 217 AddressSorter* MockDnsClient::GetAddressSorter() { |
222 return address_sorter_.get(); | 218 return address_sorter_.get(); |
223 } | 219 } |
224 | 220 |
225 void MockDnsClient::CompleteDelayedTransactions() { | 221 void MockDnsClient::CompleteDelayedTransactions() { |
226 factory_->CompleteDelayedTransactions(); | 222 factory_->CompleteDelayedTransactions(); |
227 } | 223 } |
228 | 224 |
229 } // namespace net | 225 } // namespace net |
OLD | NEW |