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

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

Issue 1352233002: Returning scoped_ptr<> instead of raw pointer in DnsQuery::CloneWithNewId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « net/dns/dns_query_unittest.cc ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_response.h" 5 #include "net/dns/dns_response.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "net/base/address_list.h" 8 #include "net/base/address_list.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 }; 205 };
206 206
207 DnsResponse resp; 207 DnsResponse resp;
208 memcpy(resp.io_buffer()->data(), response_data, sizeof(response_data)); 208 memcpy(resp.io_buffer()->data(), response_data, sizeof(response_data));
209 209
210 // Reject too short. 210 // Reject too short.
211 EXPECT_FALSE(resp.InitParse(query->io_buffer()->size() - 1, *query)); 211 EXPECT_FALSE(resp.InitParse(query->io_buffer()->size() - 1, *query));
212 EXPECT_FALSE(resp.IsValid()); 212 EXPECT_FALSE(resp.IsValid());
213 213
214 // Reject wrong id. 214 // Reject wrong id.
215 scoped_ptr<DnsQuery> other_query(query->CloneWithNewId(0xbeef)); 215 scoped_ptr<DnsQuery> other_query = query->CloneWithNewId(0xbeef);
216 EXPECT_FALSE(resp.InitParse(sizeof(response_data), *other_query)); 216 EXPECT_FALSE(resp.InitParse(sizeof(response_data), *other_query));
217 EXPECT_FALSE(resp.IsValid()); 217 EXPECT_FALSE(resp.IsValid());
218 218
219 // Reject wrong question. 219 // Reject wrong question.
220 scoped_ptr<DnsQuery> wrong_query( 220 scoped_ptr<DnsQuery> wrong_query(
221 new DnsQuery(0xcafe, qname, dns_protocol::kTypeCNAME)); 221 new DnsQuery(0xcafe, qname, dns_protocol::kTypeCNAME));
222 EXPECT_FALSE(resp.InitParse(sizeof(response_data), *wrong_query)); 222 EXPECT_FALSE(resp.InitParse(sizeof(response_data), *wrong_query));
223 EXPECT_FALSE(resp.IsValid()); 223 EXPECT_FALSE(resp.IsValid());
224 224
225 // Accept matching question. 225 // Accept matching question.
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 AddressList addr_list; 572 AddressList addr_list;
573 base::TimeDelta ttl; 573 base::TimeDelta ttl;
574 EXPECT_EQ(t.expected_result, 574 EXPECT_EQ(t.expected_result,
575 response.ParseToAddressList(&addr_list, &ttl)); 575 response.ParseToAddressList(&addr_list, &ttl));
576 } 576 }
577 } 577 }
578 578
579 } // namespace 579 } // namespace
580 580
581 } // namespace net 581 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_query_unittest.cc ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698