Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: net/dns/dns_response_unittest.cc

Issue 9190031: DnsClient refactoring + features (timeout, suffix search, server rotation). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments. Fixed tests. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698