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

Side by Side Diff: webrtc/p2p/stunprober/stunprober_unittest.cc

Issue 2828223002: Delete method MessageQueue::set_socketserver (Closed)
Patch Set: Rebase. Created 3 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/client/basicportallocator_unittest.cc ('k') | webrtc/pc/webrtcsession_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 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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
(...skipping 23 matching lines...) Expand all
34 const rtc::SocketAddress kStunAddr1("1.1.1.1", 3478); 34 const rtc::SocketAddress kStunAddr1("1.1.1.1", 3478);
35 const rtc::SocketAddress kStunAddr2("1.1.1.2", 3478); 35 const rtc::SocketAddress kStunAddr2("1.1.1.2", 3478);
36 const rtc::SocketAddress kFailedStunAddr("1.1.1.3", 3478); 36 const rtc::SocketAddress kFailedStunAddr("1.1.1.3", 3478);
37 const rtc::SocketAddress kStunMappedAddr("77.77.77.77", 0); 37 const rtc::SocketAddress kStunMappedAddr("77.77.77.77", 0);
38 38
39 } // namespace 39 } // namespace
40 40
41 class StunProberTest : public testing::Test { 41 class StunProberTest : public testing::Test {
42 public: 42 public:
43 StunProberTest() 43 StunProberTest()
44 : main_(rtc::Thread::Current()), 44 : pss_(new rtc::PhysicalSocketServer),
45 pss_(new rtc::PhysicalSocketServer),
46 ss_(new rtc::VirtualSocketServer(pss_.get())), 45 ss_(new rtc::VirtualSocketServer(pss_.get())),
47 ss_scope_(ss_.get()), 46 main_(ss_.get()),
48 result_(StunProber::SUCCESS), 47 result_(StunProber::SUCCESS),
49 stun_server_1_(cricket::TestStunServer::Create(rtc::Thread::Current(), 48 stun_server_1_(cricket::TestStunServer::Create(rtc::Thread::Current(),
50 kStunAddr1)), 49 kStunAddr1)),
51 stun_server_2_(cricket::TestStunServer::Create(rtc::Thread::Current(), 50 stun_server_2_(cricket::TestStunServer::Create(rtc::Thread::Current(),
52 kStunAddr2)) { 51 kStunAddr2)) {
53 stun_server_1_->set_fake_stun_addr(kStunMappedAddr); 52 stun_server_1_->set_fake_stun_addr(kStunMappedAddr);
54 stun_server_2_->set_fake_stun_addr(kStunMappedAddr); 53 stun_server_2_->set_fake_stun_addr(kStunMappedAddr);
55 rtc::InitializeSSL(); 54 rtc::InitializeSSL();
56 } 55 }
57 56
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 EXPECT_EQ(static_cast<uint32_t>(stats.num_response_received), 112 EXPECT_EQ(static_cast<uint32_t>(stats.num_response_received),
114 total_pings_reported); 113 total_pings_reported);
115 } 114 }
116 115
117 private: 116 private:
118 void StopCallback(StunProber* prober, int result) { 117 void StopCallback(StunProber* prober, int result) {
119 EXPECT_EQ(result, result_); 118 EXPECT_EQ(result, result_);
120 stopped_ = true; 119 stopped_ = true;
121 } 120 }
122 121
123 rtc::Thread* main_;
124 std::unique_ptr<rtc::PhysicalSocketServer> pss_; 122 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
125 std::unique_ptr<rtc::VirtualSocketServer> ss_; 123 std::unique_ptr<rtc::VirtualSocketServer> ss_;
126 rtc::SocketServerScope ss_scope_; 124 rtc::AutoSocketServerThread main_;
127 std::unique_ptr<StunProber> prober; 125 std::unique_ptr<StunProber> prober;
128 int result_ = 0; 126 int result_ = 0;
129 bool stopped_ = false; 127 bool stopped_ = false;
130 std::unique_ptr<cricket::TestStunServer> stun_server_1_; 128 std::unique_ptr<cricket::TestStunServer> stun_server_1_;
131 std::unique_ptr<cricket::TestStunServer> stun_server_2_; 129 std::unique_ptr<cricket::TestStunServer> stun_server_2_;
132 }; 130 };
133 131
134 TEST_F(StunProberTest, NonSharedMode) { 132 TEST_F(StunProberTest, NonSharedMode) {
135 RunProber(false); 133 RunProber(false);
136 } 134 }
137 135
138 TEST_F(StunProberTest, SharedMode) { 136 TEST_F(StunProberTest, SharedMode) {
139 RunProber(true); 137 RunProber(true);
140 } 138 }
141 139
142 } // namespace stunprober 140 } // namespace stunprober
OLDNEW
« no previous file with comments | « webrtc/p2p/client/basicportallocator_unittest.cc ('k') | webrtc/pc/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698