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

Side by Side Diff: webrtc/p2p/base/stunserver_unittest.cc

Issue 1923163003: Replace scoped_ptr with unique_ptr in webrtc/p2p/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 | « webrtc/p2p/base/stunserver.h ('k') | webrtc/p2p/base/tcpport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <memory>
11 #include <string> 12 #include <string>
12 13
13 #include "webrtc/p2p/base/stunserver.h" 14 #include "webrtc/p2p/base/stunserver.h"
14 #include "webrtc/base/gunit.h" 15 #include "webrtc/base/gunit.h"
15 #include "webrtc/base/logging.h" 16 #include "webrtc/base/logging.h"
16 #include "webrtc/base/physicalsocketserver.h" 17 #include "webrtc/base/physicalsocketserver.h"
17 #include "webrtc/base/testclient.h" 18 #include "webrtc/base/testclient.h"
18 #include "webrtc/base/thread.h" 19 #include "webrtc/base/thread.h"
19 #include "webrtc/base/virtualsocketserver.h" 20 #include "webrtc/base/virtualsocketserver.h"
20 21
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 client_->NextPacket(rtc::TestClient::kTimeoutMs); 56 client_->NextPacket(rtc::TestClient::kTimeoutMs);
56 if (packet) { 57 if (packet) {
57 rtc::ByteBufferReader buf(packet->buf, packet->size); 58 rtc::ByteBufferReader buf(packet->buf, packet->size);
58 msg = new StunMessage(); 59 msg = new StunMessage();
59 msg->Read(&buf); 60 msg->Read(&buf);
60 delete packet; 61 delete packet;
61 } 62 }
62 return msg; 63 return msg;
63 } 64 }
64 private: 65 private:
65 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; 66 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
66 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; 67 std::unique_ptr<rtc::VirtualSocketServer> ss_;
67 rtc::Thread worker_; 68 rtc::Thread worker_;
68 rtc::scoped_ptr<StunServer> server_; 69 std::unique_ptr<StunServer> server_;
69 rtc::scoped_ptr<rtc::TestClient> client_; 70 std::unique_ptr<rtc::TestClient> client_;
70 }; 71 };
71 72
72 // Disable for TSan v2, see 73 // Disable for TSan v2, see
73 // https://code.google.com/p/webrtc/issues/detail?id=2517 for details. 74 // https://code.google.com/p/webrtc/issues/detail?id=2517 for details.
74 #if !defined(THREAD_SANITIZER) 75 #if !defined(THREAD_SANITIZER)
75 76
76 TEST_F(StunServerTest, TestGood) { 77 TEST_F(StunServerTest, TestGood) {
77 StunMessage req; 78 StunMessage req;
78 std::string transaction_id = "0123456789ab"; 79 std::string transaction_id = "0123456789ab";
79 req.SetType(STUN_BINDING_REQUEST); 80 req.SetType(STUN_BINDING_REQUEST);
(...skipping 23 matching lines...) Expand all
103 #endif // if !defined(THREAD_SANITIZER) 104 #endif // if !defined(THREAD_SANITIZER)
104 105
105 TEST_F(StunServerTest, TestBad) { 106 TEST_F(StunServerTest, TestBad) {
106 const char* bad = "this is a completely nonsensical message whose only " 107 const char* bad = "this is a completely nonsensical message whose only "
107 "purpose is to make the parser go 'ack'. it doesn't " 108 "purpose is to make the parser go 'ack'. it doesn't "
108 "look anything like a normal stun message"; 109 "look anything like a normal stun message";
109 Send(bad, static_cast<int>(strlen(bad))); 110 Send(bad, static_cast<int>(strlen(bad)));
110 111
111 ASSERT_TRUE(ReceiveFails()); 112 ASSERT_TRUE(ReceiveFails());
112 } 113 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/stunserver.h ('k') | webrtc/p2p/base/tcpport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698