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

Side by Side Diff: webrtc/base/proxy_unittest.cc

Issue 1920043002: Replace scoped_ptr with unique_ptr in webrtc/base/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased 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/base/platform_thread_unittest.cc ('k') | webrtc/base/proxydetect.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 /* 1 /*
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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 #include "webrtc/base/autodetectproxy.h" 13 #include "webrtc/base/autodetectproxy.h"
13 #include "webrtc/base/gunit.h" 14 #include "webrtc/base/gunit.h"
14 #include "webrtc/base/httpserver.h" 15 #include "webrtc/base/httpserver.h"
15 #include "webrtc/base/proxyserver.h" 16 #include "webrtc/base/proxyserver.h"
16 #include "webrtc/base/socketadapters.h" 17 #include "webrtc/base/socketadapters.h"
17 #include "webrtc/base/testclient.h" 18 #include "webrtc/base/testclient.h"
18 #include "webrtc/base/testechoserver.h" 19 #include "webrtc/base/testechoserver.h"
19 #include "webrtc/base/virtualsocketserver.h" 20 #include "webrtc/base/virtualsocketserver.h"
20 21
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 rtc::ProxyType type; 61 rtc::ProxyType type;
61 AutoDetectProxyRunner* detect = new AutoDetectProxyRunner("unittest/1.0"); 62 AutoDetectProxyRunner* detect = new AutoDetectProxyRunner("unittest/1.0");
62 detect->set_proxy(address); 63 detect->set_proxy(address);
63 detect->Run(); // blocks until done 64 detect->Run(); // blocks until done
64 type = detect->proxy().type; 65 type = detect->proxy().type;
65 detect->Destroy(false); 66 detect->Destroy(false);
66 return type; 67 return type;
67 } 68 }
68 69
69 private: 70 private:
70 rtc::scoped_ptr<rtc::SocketServer> ss_; 71 std::unique_ptr<rtc::SocketServer> ss_;
71 rtc::scoped_ptr<rtc::SocksProxyServer> socks_; 72 std::unique_ptr<rtc::SocksProxyServer> socks_;
72 // TODO: Make this a real HTTPS proxy server. 73 // TODO: Make this a real HTTPS proxy server.
73 rtc::scoped_ptr<rtc::HttpListenServer> https_; 74 std::unique_ptr<rtc::HttpListenServer> https_;
74 }; 75 };
75 76
76 // Tests whether we can use a SOCKS5 proxy to connect to a server. 77 // Tests whether we can use a SOCKS5 proxy to connect to a server.
77 TEST_F(ProxyTest, TestSocks5Connect) { 78 TEST_F(ProxyTest, TestSocks5Connect) {
78 rtc::AsyncSocket* socket = 79 rtc::AsyncSocket* socket =
79 ss()->CreateAsyncSocket(kSocksProxyIntAddr.family(), SOCK_STREAM); 80 ss()->CreateAsyncSocket(kSocksProxyIntAddr.family(), SOCK_STREAM);
80 rtc::AsyncSocksProxySocket* proxy_socket = 81 rtc::AsyncSocksProxySocket* proxy_socket =
81 new rtc::AsyncSocksProxySocket(socket, kSocksProxyIntAddr, 82 new rtc::AsyncSocksProxySocket(socket, kSocksProxyIntAddr,
82 "", rtc::CryptString()); 83 "", rtc::CryptString());
83 // TODO: IPv6-ize these tests when proxy supports IPv6. 84 // TODO: IPv6-ize these tests when proxy supports IPv6.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Tests whether we can autodetect a HTTPS proxy. 127 // Tests whether we can autodetect a HTTPS proxy.
127 TEST_F(ProxyTest, TestAutoDetectHttps) { 128 TEST_F(ProxyTest, TestAutoDetectHttps) {
128 EXPECT_EQ(rtc::PROXY_HTTPS, DetectProxyType(kHttpsProxyIntAddr)); 129 EXPECT_EQ(rtc::PROXY_HTTPS, DetectProxyType(kHttpsProxyIntAddr));
129 } 130 }
130 */ 131 */
131 132
132 // Tests whether we fail properly for no proxy. 133 // Tests whether we fail properly for no proxy.
133 TEST_F(ProxyTest, TestAutoDetectBogus) { 134 TEST_F(ProxyTest, TestAutoDetectBogus) {
134 EXPECT_EQ(rtc::PROXY_UNKNOWN, DetectProxyType(kBogusProxyIntAddr)); 135 EXPECT_EQ(rtc::PROXY_UNKNOWN, DetectProxyType(kBogusProxyIntAddr));
135 } 136 }
OLDNEW
« no previous file with comments | « webrtc/base/platform_thread_unittest.cc ('k') | webrtc/base/proxydetect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698