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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 1757683002: Make the audio channel communicate network state changes to the call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added handling for the case where the enum class value is outside of the valid range Created 4 years, 9 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/media/engine/webrtcvoiceengine.cc ('k') | webrtc/video/end_to_end_tests.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 (c) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 // Try setting the default sink while the default stream exists. 3186 // Try setting the default sink while the default stream exists.
3187 channel_->SetRawAudioSink(0, std::move(fake_sink_2)); 3187 channel_->SetRawAudioSink(0, std::move(fake_sink_2));
3188 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); 3188 EXPECT_NE(nullptr, GetRecvStream(0x01).sink());
3189 3189
3190 // If we remove and add a default stream, it should get the same sink. 3190 // If we remove and add a default stream, it should get the same sink.
3191 EXPECT_TRUE(channel_->RemoveRecvStream(0x01)); 3191 EXPECT_TRUE(channel_->RemoveRecvStream(0x01));
3192 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 3192 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
3193 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); 3193 EXPECT_NE(nullptr, GetRecvStream(0x01).sink());
3194 } 3194 }
3195 3195
3196 // Test that, just like the video channel, the voice channel communicates the
3197 // network state to the call.
3198 TEST_F(WebRtcVoiceEngineTestFake, OnReadyToSendSignalsNetworkState) {
3199 EXPECT_TRUE(SetupEngine());
3200
3201 EXPECT_EQ(webrtc::kNetworkUp,
3202 call_.GetNetworkState(webrtc::MediaType::AUDIO));
3203 EXPECT_EQ(webrtc::kNetworkUp,
3204 call_.GetNetworkState(webrtc::MediaType::VIDEO));
3205
3206 channel_->OnReadyToSend(false);
3207 EXPECT_EQ(webrtc::kNetworkDown,
3208 call_.GetNetworkState(webrtc::MediaType::AUDIO));
3209 EXPECT_EQ(webrtc::kNetworkUp,
3210 call_.GetNetworkState(webrtc::MediaType::VIDEO));
3211
3212 channel_->OnReadyToSend(true);
3213 EXPECT_EQ(webrtc::kNetworkUp,
3214 call_.GetNetworkState(webrtc::MediaType::AUDIO));
3215 EXPECT_EQ(webrtc::kNetworkUp,
3216 call_.GetNetworkState(webrtc::MediaType::VIDEO));
3217 }
3218
3196 // Tests that the library initializes and shuts down properly. 3219 // Tests that the library initializes and shuts down properly.
3197 TEST(WebRtcVoiceEngineTest, StartupShutdown) { 3220 TEST(WebRtcVoiceEngineTest, StartupShutdown) {
3198 cricket::WebRtcVoiceEngine engine; 3221 cricket::WebRtcVoiceEngine engine;
3199 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3222 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3200 std::unique_ptr<webrtc::Call> call( 3223 std::unique_ptr<webrtc::Call> call(
3201 webrtc::Call::Create(webrtc::Call::Config())); 3224 webrtc::Call::Create(webrtc::Call::Config()));
3202 cricket::VoiceMediaChannel* channel = engine.CreateChannel( 3225 cricket::VoiceMediaChannel* channel = engine.CreateChannel(
3203 call.get(), cricket::MediaConfig(), cricket::AudioOptions()); 3226 call.get(), cricket::MediaConfig(), cricket::AudioOptions());
3204 EXPECT_TRUE(channel != nullptr); 3227 EXPECT_TRUE(channel != nullptr);
3205 delete channel; 3228 delete channel;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3326 cricket::WebRtcVoiceEngine engine; 3349 cricket::WebRtcVoiceEngine engine;
3327 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); 3350 EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
3328 std::unique_ptr<webrtc::Call> call( 3351 std::unique_ptr<webrtc::Call> call(
3329 webrtc::Call::Create(webrtc::Call::Config())); 3352 webrtc::Call::Create(webrtc::Call::Config()));
3330 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3353 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3331 cricket::AudioOptions(), call.get()); 3354 cricket::AudioOptions(), call.get());
3332 cricket::AudioRecvParameters parameters; 3355 cricket::AudioRecvParameters parameters;
3333 parameters.codecs = engine.codecs(); 3356 parameters.codecs = engine.codecs();
3334 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3357 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3335 } 3358 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698