OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/dnsrr_resolver.h" | 5 #include "net/base/dnsrr_resolver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "net/base/dns_util.h" | 10 #include "net/base/dns_util.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 handle2 = resolver.Resolve("nx.testing.notatld", kDNS_TESTING, 0, | 112 handle2 = resolver.Resolve("nx.testing.notatld", kDNS_TESTING, 0, |
113 callback2.callback(), &response, 0, BoundNetLog()); | 113 callback2.callback(), &response, 0, BoundNetLog()); |
114 ASSERT_TRUE(handle2 != DnsRRResolver::kInvalidHandle); | 114 ASSERT_TRUE(handle2 != DnsRRResolver::kInvalidHandle); |
115 ASSERT_EQ(ERR_NAME_NOT_RESOLVED, callback.WaitForResult()); | 115 ASSERT_EQ(ERR_NAME_NOT_RESOLVED, callback.WaitForResult()); |
116 ASSERT_EQ(ERR_NAME_NOT_RESOLVED, callback2.WaitForResult()); | 116 ASSERT_EQ(ERR_NAME_NOT_RESOLVED, callback2.WaitForResult()); |
117 ASSERT_EQ(6u, resolver.requests()); | 117 ASSERT_EQ(6u, resolver.requests()); |
118 ASSERT_EQ(2u, resolver.cache_hits()); | 118 ASSERT_EQ(2u, resolver.cache_hits()); |
119 ASSERT_EQ(1u, resolver.inflight_joins()); | 119 ASSERT_EQ(1u, resolver.inflight_joins()); |
120 } | 120 } |
121 | 121 |
122 #if defined(OS_POSIX) | 122 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
123 // This is a DNS packet resulting from querying a recursive resolver for a TXT | 123 // This is a DNS packet resulting from querying a recursive resolver for a TXT |
124 // record for agl._pka.imperialviolet.org. You should be able to get a | 124 // record for agl._pka.imperialviolet.org. You should be able to get a |
125 // replacement from a packet capture should it ever be needed. | 125 // replacement from a packet capture should it ever be needed. |
126 static const uint8 kExamplePacket[] = { | 126 static const uint8 kExamplePacket[] = { |
127 0xce, 0xfe, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x06, 0x00, 0x01, 0x03, | 127 0xce, 0xfe, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x06, 0x00, 0x01, 0x03, |
128 0x61, 0x67, 0x6c, 0x04, 0x5f, 0x70, 0x6b, 0x61, 0x0e, 0x69, 0x6d, 0x70, 0x65, | 128 0x61, 0x67, 0x6c, 0x04, 0x5f, 0x70, 0x6b, 0x61, 0x0e, 0x69, 0x6d, 0x70, 0x65, |
129 0x72, 0x69, 0x61, 0x6c, 0x76, 0x69, 0x6f, 0x6c, 0x65, 0x74, 0x03, 0x6f, 0x72, | 129 0x72, 0x69, 0x61, 0x6c, 0x76, 0x69, 0x6f, 0x6c, 0x65, 0x74, 0x03, 0x6f, 0x72, |
130 0x67, 0x00, 0x00, 0x10, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x10, 0x00, 0x01, 0x00, | 130 0x67, 0x00, 0x00, 0x10, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x10, 0x00, 0x01, 0x00, |
131 0x00, 0x01, 0x2c, 0x00, 0x5e, 0x5d, 0x76, 0x3d, 0x70, 0x6b, 0x61, 0x31, 0x3b, | 131 0x00, 0x01, 0x2c, 0x00, 0x5e, 0x5d, 0x76, 0x3d, 0x70, 0x6b, 0x61, 0x31, 0x3b, |
132 0x66, 0x70, 0x72, 0x3d, 0x32, 0x41, 0x46, 0x30, 0x30, 0x33, 0x32, 0x42, 0x34, | 132 0x66, 0x70, 0x72, 0x3d, 0x32, 0x41, 0x46, 0x30, 0x30, 0x33, 0x32, 0x42, 0x34, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 copy[byte] ^= (1 << bit); | 202 copy[byte] ^= (1 << bit); |
203 | 203 |
204 response.ParseFromResponse(copy, sizeof(copy), kDNS_TXT); | 204 response.ParseFromResponse(copy, sizeof(copy), kDNS_TXT); |
205 } | 205 } |
206 } | 206 } |
207 #endif | 207 #endif |
208 | 208 |
209 } // namespace | 209 } // namespace |
210 | 210 |
211 } // namespace net | 211 } // namespace net |
OLD | NEW |