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

Side by Side Diff: net/dns/dns_query_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.cc ('k') | net/dns/dns_response_unittest.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) 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_query.h" 5 #include "net/dns/dns_query.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 "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 EXPECT_EQ(question, q1.question()); 48 EXPECT_EQ(question, q1.question());
49 } 49 }
50 50
51 TEST(DnsQueryTest, Clone) { 51 TEST(DnsQueryTest, Clone) {
52 // This includes \0 at the end. 52 // This includes \0 at the end.
53 const char qname_data[] = "\x03""www""\x07""example""\x03""com"; 53 const char qname_data[] = "\x03""www""\x07""example""\x03""com";
54 base::StringPiece qname(qname_data, sizeof(qname_data)); 54 base::StringPiece qname(qname_data, sizeof(qname_data));
55 55
56 DnsQuery q1(0, qname, dns_protocol::kTypeA); 56 DnsQuery q1(0, qname, dns_protocol::kTypeA);
57 EXPECT_EQ(0, q1.id()); 57 EXPECT_EQ(0, q1.id());
58 scoped_ptr<DnsQuery> q2(q1.CloneWithNewId(42)); 58 scoped_ptr<DnsQuery> q2 = q1.CloneWithNewId(42);
59 EXPECT_EQ(42, q2->id()); 59 EXPECT_EQ(42, q2->id());
60 EXPECT_EQ(q1.io_buffer()->size(), q2->io_buffer()->size()); 60 EXPECT_EQ(q1.io_buffer()->size(), q2->io_buffer()->size());
61 EXPECT_EQ(q1.qtype(), q2->qtype()); 61 EXPECT_EQ(q1.qtype(), q2->qtype());
62 EXPECT_EQ(q1.question(), q2->question()); 62 EXPECT_EQ(q1.question(), q2->question());
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 } // namespace net 67 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_query.cc ('k') | net/dns/dns_response_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698