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

Side by Side Diff: webrtc/pc/channel_unittest.cc

Issue 3005433002: Fix places that trigger no-unused-lambda-capture (Closed)
Patch Set: Created 3 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
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
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 EXPECT_TRUE(media_channel1_->sending()); 1198 EXPECT_TRUE(media_channel1_->sending());
1199 if (verify_playout_) { 1199 if (verify_playout_) {
1200 EXPECT_TRUE(media_channel2_->playout()); 1200 EXPECT_TRUE(media_channel2_->playout());
1201 } 1201 }
1202 EXPECT_TRUE(media_channel2_->sending()); 1202 EXPECT_TRUE(media_channel2_->sending());
1203 } 1203 }
1204 1204
1205 // Tests that when the transport channel signals a candidate pair change 1205 // Tests that when the transport channel signals a candidate pair change
1206 // event, the media channel will receive a call on the network route change. 1206 // event, the media channel will receive a call on the network route change.
1207 void TestNetworkRouteChanges() { 1207 void TestNetworkRouteChanges() {
1208 constexpr uint16_t kLocalNetId = 1; 1208 // These would have been declared as constexpr, but then some compilers
1209 constexpr uint16_t kRemoteNetId = 2; 1209 // require them to be captured in the lambda, and other compilers complain
1210 constexpr int kLastPacketId = 100; 1210 // about no-ununused-lambda-capture. Keeping them as normal variables was
1211 // the easiest work-around.
1212 uint16_t kLocalNetId = 1;
1213 uint16_t kRemoteNetId = 2;
1214 int kLastPacketId = 100;
stefan-webrtc 2017/08/23 09:37:24 Can't we at least make them const?
eladalon 2017/08/23 10:26:26 No. The Mac compiler complains.
1211 1215
1212 CreateChannels(0, 0); 1216 CreateChannels(0, 0);
1213 1217
1214 typename T::MediaChannel* media_channel1 = 1218 typename T::MediaChannel* media_channel1 =
1215 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); 1219 static_cast<typename T::MediaChannel*>(channel1_->media_channel());
1216 ASSERT_TRUE(media_channel1); 1220 ASSERT_TRUE(media_channel1);
1217 1221
1218 media_channel1->set_num_network_route_changes(0); 1222 media_channel1->set_num_network_route_changes(0);
1219 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { 1223 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] {
1220 // The transport channel becomes disconnected. 1224 // The transport channel becomes disconnected.
1221 fake_rtp_dtls_transport1_->ice_transport() 1225 fake_rtp_dtls_transport1_->ice_transport()
1222 ->SignalSelectedCandidatePairChanged( 1226 ->SignalSelectedCandidatePairChanged(
1223 fake_rtp_dtls_transport1_->ice_transport(), nullptr, -1, false); 1227 fake_rtp_dtls_transport1_->ice_transport(), nullptr, -1, false);
1224 }); 1228 });
1225 WaitForThreads(); 1229 WaitForThreads();
1226 EXPECT_EQ(1, media_channel1->num_network_route_changes()); 1230 EXPECT_EQ(1, media_channel1->num_network_route_changes());
1227 EXPECT_FALSE(media_channel1->last_network_route().connected); 1231 EXPECT_FALSE(media_channel1->last_network_route().connected);
1228 media_channel1->set_num_network_route_changes(0); 1232 media_channel1->set_num_network_route_changes(0);
1229 1233
1230 network_thread_->Invoke<void>(RTC_FROM_HERE, [this, media_channel1, 1234 network_thread_->Invoke<void>(RTC_FROM_HERE, [this,
1231 kLocalNetId, kRemoteNetId, 1235 kLocalNetId, kRemoteNetId,
1232 kLastPacketId] { 1236 kLastPacketId] {
1233 // The transport channel becomes connected. 1237 // The transport channel becomes connected.
1234 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */); 1238 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */);
1235 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */); 1239 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */);
1236 auto candidate_pair = cricket::FakeCandidatePair::Create( 1240 auto candidate_pair = cricket::FakeCandidatePair::Create(
1237 local_address, kLocalNetId, remote_address, kRemoteNetId); 1241 local_address, kLocalNetId, remote_address, kRemoteNetId);
1238 fake_rtp_dtls_transport1_->ice_transport() 1242 fake_rtp_dtls_transport1_->ice_transport()
1239 ->SignalSelectedCandidatePairChanged( 1243 ->SignalSelectedCandidatePairChanged(
1240 fake_rtp_dtls_transport1_->ice_transport(), candidate_pair.get(), 1244 fake_rtp_dtls_transport1_->ice_transport(), candidate_pair.get(),
(...skipping 2658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3899 ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_, 3903 ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_,
3900 &fake_rtcp_dtls_transport_)); 3904 &fake_rtcp_dtls_transport_));
3901 EXPECT_DEATH(voice_channel_.SetTransports(&fake_rtp_dtls_transport_, 3905 EXPECT_DEATH(voice_channel_.SetTransports(&fake_rtp_dtls_transport_,
3902 &fake_rtp_dtls_transport_), 3906 &fake_rtp_dtls_transport_),
3903 ""); 3907 "");
3904 } 3908 }
3905 3909
3906 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) 3910 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
3907 3911
3908 // TODO(pthatcher): TestSetReceiver? 3912 // TODO(pthatcher): TestSetReceiver?
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698