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/dns/dns_response.h" | 5 #include "net/dns/dns_response.h" |
6 | 6 |
7 #include "net/base/io_buffer.h" | 7 #include "net/base/io_buffer.h" |
8 #include "net/dns/dns_protocol.h" | 8 #include "net/dns/dns_protocol.h" |
9 #include "net/dns/dns_query.h" | 9 #include "net/dns/dns_query.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 | 212 |
213 // Reject wrong question. | 213 // Reject wrong question. |
214 scoped_ptr<DnsQuery> wrong_query( | 214 scoped_ptr<DnsQuery> wrong_query( |
215 new DnsQuery(0xcafe, qname, dns_protocol::kTypeCNAME)); | 215 new DnsQuery(0xcafe, qname, dns_protocol::kTypeCNAME)); |
216 EXPECT_FALSE(resp.InitParse(sizeof(response_data), *wrong_query)); | 216 EXPECT_FALSE(resp.InitParse(sizeof(response_data), *wrong_query)); |
217 | 217 |
218 // Accept matching question. | 218 // Accept matching question. |
219 EXPECT_TRUE(resp.InitParse(sizeof(response_data), *query)); | 219 EXPECT_TRUE(resp.InitParse(sizeof(response_data), *query)); |
220 | 220 |
221 // Check header access. | 221 // Check header access. |
222 EXPECT_EQ(0x81, resp.flags0()); | 222 EXPECT_EQ(0x8180, resp.flags()); |
mmenke
2012/01/13 16:44:37
I assume you planned to do so already, but just in
| |
223 EXPECT_EQ(0x80, resp.flags1()); | |
224 EXPECT_EQ(0x0, resp.rcode()); | 223 EXPECT_EQ(0x0, resp.rcode()); |
225 EXPECT_EQ(2, resp.answer_count()); | 224 EXPECT_EQ(2, resp.answer_count()); |
226 | 225 |
227 DnsResourceRecord record; | 226 DnsResourceRecord record; |
228 DnsRecordParser parser = resp.Parser(); | 227 DnsRecordParser parser = resp.Parser(); |
229 EXPECT_TRUE(parser.ParseRecord(&record)); | 228 EXPECT_TRUE(parser.ParseRecord(&record)); |
230 EXPECT_TRUE(parser.ParseRecord(&record)); | 229 EXPECT_TRUE(parser.ParseRecord(&record)); |
231 EXPECT_FALSE(parser.ParseRecord(&record)); | 230 EXPECT_FALSE(parser.ParseRecord(&record)); |
232 } | 231 } |
233 | 232 |
234 } // namespace | 233 } // namespace |
235 | 234 |
236 } // namespace net | 235 } // namespace net |
OLD | NEW |