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

Side by Side Diff: talk/session/media/channel_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/session/media/channel.cc ('k') | no next file » | 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 2009 Google Inc. 3 * Copyright 2009 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 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 } 2105 }
2106 2106
2107 TEST_F(VoiceChannelTest, SendWithWritabilityLoss) { 2107 TEST_F(VoiceChannelTest, SendWithWritabilityLoss) {
2108 Base::SendWithWritabilityLoss(); 2108 Base::SendWithWritabilityLoss();
2109 } 2109 }
2110 2110
2111 TEST_F(VoiceChannelTest, TestMediaMonitor) { 2111 TEST_F(VoiceChannelTest, TestMediaMonitor) {
2112 Base::TestMediaMonitor(); 2112 Base::TestMediaMonitor();
2113 } 2113 }
2114 2114
2115 // Test that PressDTMF properly forwards to the media channel.
2116 TEST_F(VoiceChannelTest, TestDtmf) {
2117 CreateChannels(0, 0);
2118 EXPECT_TRUE(SendInitiate());
2119 EXPECT_TRUE(SendAccept());
2120 EXPECT_EQ(0U, media_channel1_->dtmf_info_queue().size());
2121
2122 EXPECT_TRUE(channel1_->PressDTMF(1, true));
2123 EXPECT_TRUE(channel1_->PressDTMF(8, false));
2124
2125 ASSERT_EQ(2U, media_channel1_->dtmf_info_queue().size());
2126 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[0],
2127 0, 1, 160, cricket::DF_PLAY | cricket::DF_SEND));
2128 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[1],
2129 0, 8, 160, cricket::DF_SEND));
2130 }
2131
2132 // Test that InsertDtmf properly forwards to the media channel. 2115 // Test that InsertDtmf properly forwards to the media channel.
2133 TEST_F(VoiceChannelTest, TestInsertDtmf) { 2116 TEST_F(VoiceChannelTest, TestInsertDtmf) {
2134 CreateChannels(0, 0); 2117 CreateChannels(0, 0);
2135 EXPECT_TRUE(SendInitiate()); 2118 EXPECT_TRUE(SendInitiate());
2136 EXPECT_TRUE(SendAccept()); 2119 EXPECT_TRUE(SendAccept());
2137 EXPECT_EQ(0U, media_channel1_->dtmf_info_queue().size()); 2120 EXPECT_EQ(0U, media_channel1_->dtmf_info_queue().size());
2138 2121
2139 EXPECT_TRUE(channel1_->InsertDtmf(1, 3, 100, cricket::DF_SEND)); 2122 EXPECT_TRUE(channel1_->InsertDtmf(1, 3, 100));
2140 EXPECT_TRUE(channel1_->InsertDtmf(2, 5, 110, cricket::DF_PLAY)); 2123 EXPECT_TRUE(channel1_->InsertDtmf(2, 5, 110));
2141 EXPECT_TRUE(channel1_->InsertDtmf(3, 7, 120, 2124 EXPECT_TRUE(channel1_->InsertDtmf(3, 7, 120));
2142 cricket::DF_PLAY | cricket::DF_SEND));
2143 2125
2144 ASSERT_EQ(3U, media_channel1_->dtmf_info_queue().size()); 2126 ASSERT_EQ(3U, media_channel1_->dtmf_info_queue().size());
2145 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[0], 2127 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[0],
2146 1, 3, 100, cricket::DF_SEND)); 2128 1, 3, 100));
2147 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[1], 2129 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[1],
2148 2, 5, 110, cricket::DF_PLAY)); 2130 2, 5, 110));
2149 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[2], 2131 EXPECT_TRUE(CompareDtmfInfo(media_channel1_->dtmf_info_queue()[2],
2150 3, 7, 120, cricket::DF_PLAY | cricket::DF_SEND)); 2132 3, 7, 120));
2151 } 2133 }
2152 2134
2153 TEST_F(VoiceChannelTest, TestSetContentFailure) { 2135 TEST_F(VoiceChannelTest, TestSetContentFailure) {
2154 Base::TestSetContentFailure(); 2136 Base::TestSetContentFailure();
2155 } 2137 }
2156 2138
2157 TEST_F(VoiceChannelTest, TestSendTwoOffers) { 2139 TEST_F(VoiceChannelTest, TestSendTwoOffers) {
2158 Base::TestSendTwoOffers(); 2140 Base::TestSendTwoOffers();
2159 } 2141 }
2160 2142
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 }; 2770 };
2789 rtc::Buffer payload(data, 3); 2771 rtc::Buffer payload(data, 3);
2790 cricket::SendDataResult result; 2772 cricket::SendDataResult result;
2791 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2773 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2792 EXPECT_EQ(params.ssrc, 2774 EXPECT_EQ(params.ssrc,
2793 media_channel1_->last_sent_data_params().ssrc); 2775 media_channel1_->last_sent_data_params().ssrc);
2794 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2776 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2795 } 2777 }
2796 2778
2797 // TODO(pthatcher): TestSetReceiver? 2779 // TODO(pthatcher): TestSetReceiver?
OLDNEW
« no previous file with comments | « talk/session/media/channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698