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

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

Issue 3003723002: Fix places that trigger no-unused-lambda-capture - change to using static-constexpr (Closed)
Patch Set: Rebased Created 3 years, 4 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 // These would have been declared as constexpr, but then some compilers 1208 static constexpr uint16_t kLocalNetId = 1;
1209 // require them to be captured in the lambda, and other compilers complain 1209 static constexpr uint16_t kRemoteNetId = 2;
1210 // about no-ununused-lambda-capture. Keeping them as normal variables was 1210 static constexpr int kLastPacketId = 100;
1211 // the easiest work-around.
1212 uint16_t kLocalNetId = 1;
1213 uint16_t kRemoteNetId = 2;
1214 int kLastPacketId = 100;
1215 1211
1216 CreateChannels(0, 0); 1212 CreateChannels(0, 0);
1217 1213
1218 typename T::MediaChannel* media_channel1 = 1214 typename T::MediaChannel* media_channel1 =
1219 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); 1215 static_cast<typename T::MediaChannel*>(channel1_->media_channel());
1220 ASSERT_TRUE(media_channel1); 1216 ASSERT_TRUE(media_channel1);
1221 1217
1222 media_channel1->set_num_network_route_changes(0); 1218 media_channel1->set_num_network_route_changes(0);
1223 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { 1219 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] {
1224 // The transport channel becomes disconnected. 1220 // The transport channel becomes disconnected.
1225 fake_rtp_dtls_transport1_->ice_transport() 1221 fake_rtp_dtls_transport1_->ice_transport()
1226 ->SignalSelectedCandidatePairChanged( 1222 ->SignalSelectedCandidatePairChanged(
1227 fake_rtp_dtls_transport1_->ice_transport(), nullptr, -1, false); 1223 fake_rtp_dtls_transport1_->ice_transport(), nullptr, -1, false);
1228 }); 1224 });
1229 WaitForThreads(); 1225 WaitForThreads();
1230 EXPECT_EQ(1, media_channel1->num_network_route_changes()); 1226 EXPECT_EQ(1, media_channel1->num_network_route_changes());
1231 EXPECT_FALSE(media_channel1->last_network_route().connected); 1227 EXPECT_FALSE(media_channel1->last_network_route().connected);
1232 media_channel1->set_num_network_route_changes(0); 1228 media_channel1->set_num_network_route_changes(0);
1233 1229
1234 network_thread_->Invoke<void>(RTC_FROM_HERE, [this, 1230 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] {
1235 kLocalNetId, kRemoteNetId,
1236 kLastPacketId] {
1237 // The transport channel becomes connected. 1231 // The transport channel becomes connected.
1238 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */); 1232 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */);
1239 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */); 1233 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */);
1240 auto candidate_pair = cricket::FakeCandidatePair::Create( 1234 auto candidate_pair = cricket::FakeCandidatePair::Create(
1241 local_address, kLocalNetId, remote_address, kRemoteNetId); 1235 local_address, kLocalNetId, remote_address, kRemoteNetId);
1242 fake_rtp_dtls_transport1_->ice_transport() 1236 fake_rtp_dtls_transport1_->ice_transport()
1243 ->SignalSelectedCandidatePairChanged( 1237 ->SignalSelectedCandidatePairChanged(
1244 fake_rtp_dtls_transport1_->ice_transport(), candidate_pair.get(), 1238 fake_rtp_dtls_transport1_->ice_transport(), candidate_pair.get(),
1245 kLastPacketId, true); 1239 kLastPacketId, true);
1246 }); 1240 });
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3903 ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_, 3897 ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_,
3904 &fake_rtcp_dtls_transport_)); 3898 &fake_rtcp_dtls_transport_));
3905 EXPECT_DEATH(voice_channel_.SetTransports(&fake_rtp_dtls_transport_, 3899 EXPECT_DEATH(voice_channel_.SetTransports(&fake_rtp_dtls_transport_,
3906 &fake_rtp_dtls_transport_), 3900 &fake_rtp_dtls_transport_),
3907 ""); 3901 "");
3908 } 3902 }
3909 3903
3910 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) 3904 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
3911 3905
3912 // TODO(pthatcher): TestSetReceiver? 3906 // TODO(pthatcher): TestSetReceiver?
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec3/residual_echo_estimator.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698