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

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

Issue 1487393002: Refactor WVoE DTMF handling #1 (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years 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/fakemediaengine.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "webrtc/base/stringutils.h" 64 #include "webrtc/base/stringutils.h"
65 #include "webrtc/base/thread.h" 65 #include "webrtc/base/thread.h"
66 #include "webrtc/base/virtualsocketserver.h" 66 #include "webrtc/base/virtualsocketserver.h"
67 67
68 #define MAYBE_SKIP_TEST(feature) \ 68 #define MAYBE_SKIP_TEST(feature) \
69 if (!(feature())) { \ 69 if (!(feature())) { \
70 LOG(LS_INFO) << "Feature disabled... skipping"; \ 70 LOG(LS_INFO) << "Feature disabled... skipping"; \
71 return; \ 71 return; \
72 } 72 }
73 73
74 using cricket::DF_PLAY;
75 using cricket::DF_SEND;
76 using cricket::FakeVoiceMediaChannel; 74 using cricket::FakeVoiceMediaChannel;
77 using cricket::TransportInfo; 75 using cricket::TransportInfo;
78 using rtc::SocketAddress; 76 using rtc::SocketAddress;
79 using rtc::scoped_ptr; 77 using rtc::scoped_ptr;
80 using rtc::Thread; 78 using rtc::Thread;
81 using webrtc::CreateSessionDescription; 79 using webrtc::CreateSessionDescription;
82 using webrtc::CreateSessionDescriptionObserver; 80 using webrtc::CreateSessionDescriptionObserver;
83 using webrtc::CreateSessionDescriptionRequest; 81 using webrtc::CreateSessionDescriptionRequest;
84 using webrtc::DataChannel; 82 using webrtc::DataChannel;
85 using webrtc::DtlsIdentityStoreInterface; 83 using webrtc::DtlsIdentityStoreInterface;
(...skipping 3291 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 3375
3378 TEST_F(WebRtcSessionTest, InsertDtmf) { 3376 TEST_F(WebRtcSessionTest, InsertDtmf) {
3379 // Setup 3377 // Setup
3380 Init(); 3378 Init();
3381 SendAudioVideoStream1(); 3379 SendAudioVideoStream1();
3382 CreateAndSetRemoteOfferAndLocalAnswer(); 3380 CreateAndSetRemoteOfferAndLocalAnswer();
3383 FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); 3381 FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
3384 EXPECT_EQ(0U, channel->dtmf_info_queue().size()); 3382 EXPECT_EQ(0U, channel->dtmf_info_queue().size());
3385 3383
3386 // Insert DTMF 3384 // Insert DTMF
3387 const int expected_flags = DF_SEND;
3388 const int expected_duration = 90; 3385 const int expected_duration = 90;
3389 session_->InsertDtmf(kAudioTrack1, 0, expected_duration); 3386 session_->InsertDtmf(kAudioTrack1, 0, expected_duration);
3390 session_->InsertDtmf(kAudioTrack1, 1, expected_duration); 3387 session_->InsertDtmf(kAudioTrack1, 1, expected_duration);
3391 session_->InsertDtmf(kAudioTrack1, 2, expected_duration); 3388 session_->InsertDtmf(kAudioTrack1, 2, expected_duration);
3392 3389
3393 // Verify 3390 // Verify
3394 ASSERT_EQ(3U, channel->dtmf_info_queue().size()); 3391 ASSERT_EQ(3U, channel->dtmf_info_queue().size());
3395 const uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); 3392 const uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
3396 EXPECT_TRUE(CompareDtmfInfo(channel->dtmf_info_queue()[0], send_ssrc, 0, 3393 EXPECT_TRUE(CompareDtmfInfo(channel->dtmf_info_queue()[0], send_ssrc, 0,
3397 expected_duration, expected_flags)); 3394 expected_duration));
3398 EXPECT_TRUE(CompareDtmfInfo(channel->dtmf_info_queue()[1], send_ssrc, 1, 3395 EXPECT_TRUE(CompareDtmfInfo(channel->dtmf_info_queue()[1], send_ssrc, 1,
3399 expected_duration, expected_flags)); 3396 expected_duration));
3400 EXPECT_TRUE(CompareDtmfInfo(channel->dtmf_info_queue()[2], send_ssrc, 2, 3397 EXPECT_TRUE(CompareDtmfInfo(channel->dtmf_info_queue()[2], send_ssrc, 2,
3401 expected_duration, expected_flags)); 3398 expected_duration));
3402 } 3399 }
3403 3400
3404 // This test verifies the |initial_offerer| flag when session initiates the 3401 // This test verifies the |initial_offerer| flag when session initiates the
3405 // call. 3402 // call.
3406 TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) { 3403 TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) {
3407 Init(); 3404 Init();
3408 EXPECT_FALSE(session_->initial_offerer()); 3405 EXPECT_FALSE(session_->initial_offerer());
3409 SessionDescriptionInterface* offer = CreateOffer(); 3406 SessionDescriptionInterface* offer = CreateOffer();
3410 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); 3407 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
3411 SetLocalDescriptionWithoutError(offer); 3408 SetLocalDescriptionWithoutError(offer);
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
4203 } 4200 }
4204 4201
4205 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4202 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4206 // currently fails because upon disconnection and reconnection OnIceComplete is 4203 // currently fails because upon disconnection and reconnection OnIceComplete is
4207 // called more than once without returning to IceGatheringGathering. 4204 // called more than once without returning to IceGatheringGathering.
4208 4205
4209 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4206 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4210 WebRtcSessionTest, 4207 WebRtcSessionTest,
4211 testing::Values(ALREADY_GENERATED, 4208 testing::Values(ALREADY_GENERATED,
4212 DTLS_IDENTITY_STORE)); 4209 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession.cc ('k') | talk/media/base/fakemediaengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698