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

Side by Side Diff: talk/app/webrtc/webrtcsession_unittest.cc

Issue 1432553007: Rename Maybe to Optional (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month 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 | « talk/app/webrtc/webrtcsession.cc ('k') | talk/media/base/mediachannel.h » ('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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3290 Init(); 3290 Init();
3291 SendAudioVideoStream1(); 3291 SendAudioVideoStream1();
3292 CreateAndSetRemoteOfferAndLocalAnswer(); 3292 CreateAndSetRemoteOfferAndLocalAnswer();
3293 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); 3293 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
3294 ASSERT_TRUE(channel != NULL); 3294 ASSERT_TRUE(channel != NULL);
3295 ASSERT_EQ(1u, channel->send_streams().size()); 3295 ASSERT_EQ(1u, channel->send_streams().size());
3296 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); 3296 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
3297 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); 3297 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
3298 3298
3299 cricket::AudioOptions options; 3299 cricket::AudioOptions options;
3300 options.echo_cancellation = rtc::Maybe<bool>(true); 3300 options.echo_cancellation = rtc::Optional<bool>(true);
3301 3301
3302 rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer()); 3302 rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer());
3303 session_->SetAudioSend(send_ssrc, false, options, renderer.get()); 3303 session_->SetAudioSend(send_ssrc, false, options, renderer.get());
3304 EXPECT_TRUE(channel->IsStreamMuted(send_ssrc)); 3304 EXPECT_TRUE(channel->IsStreamMuted(send_ssrc));
3305 EXPECT_EQ(rtc::Maybe<bool>(), channel->options().echo_cancellation); 3305 EXPECT_EQ(rtc::Optional<bool>(), channel->options().echo_cancellation);
3306 EXPECT_TRUE(renderer->sink() != NULL); 3306 EXPECT_TRUE(renderer->sink() != NULL);
3307 3307
3308 // This will trigger SetSink(NULL) to the |renderer|. 3308 // This will trigger SetSink(NULL) to the |renderer|.
3309 session_->SetAudioSend(send_ssrc, true, options, NULL); 3309 session_->SetAudioSend(send_ssrc, true, options, NULL);
3310 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); 3310 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
3311 EXPECT_EQ(rtc::Maybe<bool>(true), channel->options().echo_cancellation); 3311 EXPECT_EQ(rtc::Optional<bool>(true), channel->options().echo_cancellation);
3312 EXPECT_TRUE(renderer->sink() == NULL); 3312 EXPECT_TRUE(renderer->sink() == NULL);
3313 } 3313 }
3314 3314
3315 TEST_F(WebRtcSessionTest, AudioRendererForLocalStream) { 3315 TEST_F(WebRtcSessionTest, AudioRendererForLocalStream) {
3316 Init(); 3316 Init();
3317 SendAudioVideoStream1(); 3317 SendAudioVideoStream1();
3318 CreateAndSetRemoteOfferAndLocalAnswer(); 3318 CreateAndSetRemoteOfferAndLocalAnswer();
3319 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); 3319 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
3320 ASSERT_TRUE(channel != NULL); 3320 ASSERT_TRUE(channel != NULL);
3321 ASSERT_EQ(1u, channel->send_streams().size()); 3321 ASSERT_EQ(1u, channel->send_streams().size());
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3984 3984
3985 SetLocalDescriptionWithoutError(offer); 3985 SetLocalDescriptionWithoutError(offer);
3986 3986
3987 video_channel_ = media_engine_->GetVideoChannel(0); 3987 video_channel_ = media_engine_->GetVideoChannel(0);
3988 voice_channel_ = media_engine_->GetVoiceChannel(0); 3988 voice_channel_ = media_engine_->GetVoiceChannel(0);
3989 3989
3990 ASSERT_TRUE(video_channel_ != NULL); 3990 ASSERT_TRUE(video_channel_ != NULL);
3991 ASSERT_TRUE(voice_channel_ != NULL); 3991 ASSERT_TRUE(voice_channel_ != NULL);
3992 const cricket::AudioOptions& audio_options = voice_channel_->options(); 3992 const cricket::AudioOptions& audio_options = voice_channel_->options();
3993 const cricket::VideoOptions& video_options = video_channel_->options(); 3993 const cricket::VideoOptions& video_options = video_channel_->options();
3994 EXPECT_EQ(rtc::Maybe<bool>(true), audio_options.dscp); 3994 EXPECT_EQ(rtc::Optional<bool>(true), audio_options.dscp);
3995 EXPECT_EQ(rtc::Maybe<bool>(true), video_options.dscp); 3995 EXPECT_EQ(rtc::Optional<bool>(true), video_options.dscp);
3996 } 3996 }
3997 3997
3998 TEST_F(WebRtcSessionTest, TestSuspendBelowMinBitrateConstraint) { 3998 TEST_F(WebRtcSessionTest, TestSuspendBelowMinBitrateConstraint) {
3999 constraints_.reset(new FakeConstraints()); 3999 constraints_.reset(new FakeConstraints());
4000 constraints_->AddOptional( 4000 constraints_->AddOptional(
4001 webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, 4001 webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate,
4002 true); 4002 true);
4003 Init(); 4003 Init();
4004 SendAudioVideoStream1(); 4004 SendAudioVideoStream1();
4005 SessionDescriptionInterface* offer = CreateOffer(); 4005 SessionDescriptionInterface* offer = CreateOffer();
4006 4006
4007 SetLocalDescriptionWithoutError(offer); 4007 SetLocalDescriptionWithoutError(offer);
4008 4008
4009 video_channel_ = media_engine_->GetVideoChannel(0); 4009 video_channel_ = media_engine_->GetVideoChannel(0);
4010 4010
4011 ASSERT_TRUE(video_channel_ != NULL); 4011 ASSERT_TRUE(video_channel_ != NULL);
4012 const cricket::VideoOptions& video_options = video_channel_->options(); 4012 const cricket::VideoOptions& video_options = video_channel_->options();
4013 EXPECT_EQ(rtc::Maybe<bool>(true), video_options.suspend_below_min_bitrate); 4013 EXPECT_EQ(rtc::Optional<bool>(true), video_options.suspend_below_min_bitrate);
4014 } 4014 }
4015 4015
4016 TEST_F(WebRtcSessionTest, TestNumUnsignalledRecvStreamsConstraint) { 4016 TEST_F(WebRtcSessionTest, TestNumUnsignalledRecvStreamsConstraint) {
4017 // Number of unsignalled receiving streams should be between 0 and 4017 // Number of unsignalled receiving streams should be between 0 and
4018 // kMaxUnsignalledRecvStreams. 4018 // kMaxUnsignalledRecvStreams.
4019 SetAndVerifyNumUnsignalledRecvStreams(10, 10); 4019 SetAndVerifyNumUnsignalledRecvStreams(10, 10);
4020 SetAndVerifyNumUnsignalledRecvStreams(kMaxUnsignalledRecvStreams + 1, 4020 SetAndVerifyNumUnsignalledRecvStreams(kMaxUnsignalledRecvStreams + 1,
4021 kMaxUnsignalledRecvStreams); 4021 kMaxUnsignalledRecvStreams);
4022 SetAndVerifyNumUnsignalledRecvStreams(-1, 0); 4022 SetAndVerifyNumUnsignalledRecvStreams(-1, 0);
4023 } 4023 }
4024 4024
4025 TEST_F(WebRtcSessionTest, TestCombinedAudioVideoBweConstraint) { 4025 TEST_F(WebRtcSessionTest, TestCombinedAudioVideoBweConstraint) {
4026 constraints_.reset(new FakeConstraints()); 4026 constraints_.reset(new FakeConstraints());
4027 constraints_->AddOptional( 4027 constraints_->AddOptional(
4028 webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe, 4028 webrtc::MediaConstraintsInterface::kCombinedAudioVideoBwe,
4029 true); 4029 true);
4030 Init(); 4030 Init();
4031 SendAudioVideoStream1(); 4031 SendAudioVideoStream1();
4032 SessionDescriptionInterface* offer = CreateOffer(); 4032 SessionDescriptionInterface* offer = CreateOffer();
4033 4033
4034 SetLocalDescriptionWithoutError(offer); 4034 SetLocalDescriptionWithoutError(offer);
4035 4035
4036 voice_channel_ = media_engine_->GetVoiceChannel(0); 4036 voice_channel_ = media_engine_->GetVoiceChannel(0);
4037 4037
4038 ASSERT_TRUE(voice_channel_ != NULL); 4038 ASSERT_TRUE(voice_channel_ != NULL);
4039 const cricket::AudioOptions& audio_options = voice_channel_->options(); 4039 const cricket::AudioOptions& audio_options = voice_channel_->options();
4040 EXPECT_EQ(rtc::Maybe<bool>(true), audio_options.combined_audio_video_bwe); 4040 EXPECT_EQ(rtc::Optional<bool>(true), audio_options.combined_audio_video_bwe);
4041 } 4041 }
4042 4042
4043 // Tests that we can renegotiate new media content with ICE candidates in the 4043 // Tests that we can renegotiate new media content with ICE candidates in the
4044 // new remote SDP. 4044 // new remote SDP.
4045 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { 4045 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) {
4046 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); 4046 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4047 InitWithDtls(GetParam()); 4047 InitWithDtls(GetParam());
4048 SetFactoryDtlsSrtp(); 4048 SetFactoryDtlsSrtp();
4049 4049
4050 SendAudioOnlyStream2(); 4050 SendAudioOnlyStream2();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 } 4204 }
4205 4205
4206 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4206 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4207 // currently fails because upon disconnection and reconnection OnIceComplete is 4207 // currently fails because upon disconnection and reconnection OnIceComplete is
4208 // called more than once without returning to IceGatheringGathering. 4208 // called more than once without returning to IceGatheringGathering.
4209 4209
4210 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4210 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4211 WebRtcSessionTest, 4211 WebRtcSessionTest,
4212 testing::Values(ALREADY_GENERATED, 4212 testing::Values(ALREADY_GENERATED,
4213 DTLS_IDENTITY_STORE)); 4213 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession.cc ('k') | talk/media/base/mediachannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698