| OLD | NEW |
| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "webrtc/base/array_view.h" | 13 #include "webrtc/base/array_view.h" |
| 14 #include "webrtc/base/buffer.h" | 14 #include "webrtc/base/buffer.h" |
| 15 #include "webrtc/base/fakeclock.h" | 15 #include "webrtc/base/fakeclock.h" |
| 16 #include "webrtc/base/gunit.h" | 16 #include "webrtc/base/gunit.h" |
| 17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
| 18 #include "webrtc/base/sslstreamadapter.h" | 18 #include "webrtc/base/sslstreamadapter.h" |
| 19 #include "webrtc/media/base/fakemediaengine.h" | 19 #include "webrtc/media/base/fakemediaengine.h" |
| 20 #include "webrtc/media/base/fakertp.h" | 20 #include "webrtc/media/base/fakertp.h" |
| 21 #include "webrtc/media/base/mediachannel.h" | 21 #include "webrtc/media/base/mediachannel.h" |
| 22 #include "webrtc/media/base/testutils.h" | 22 #include "webrtc/media/base/testutils.h" |
| 23 #include "webrtc/p2p/base/faketransportcontroller.h" | 23 #include "webrtc/p2p/base/faketransportcontroller.h" |
| 24 #include "webrtc/p2p/base/transportchannelimpl.h" | 24 #include "webrtc/p2p/base/transportchannelimpl.h" |
| 25 #include "webrtc/pc/channel.h" | 25 #include "webrtc/pc/channel.h" |
| 26 | 26 |
| 27 #define MAYBE_SKIP_TEST(feature) \ | |
| 28 if (!(rtc::SSLStreamAdapter::feature())) { \ | |
| 29 LOG(LS_INFO) << "Feature disabled... skipping"; \ | |
| 30 return; \ | |
| 31 } | |
| 32 | |
| 33 using cricket::CA_OFFER; | 27 using cricket::CA_OFFER; |
| 34 using cricket::CA_PRANSWER; | 28 using cricket::CA_PRANSWER; |
| 35 using cricket::CA_ANSWER; | 29 using cricket::CA_ANSWER; |
| 36 using cricket::CA_UPDATE; | 30 using cricket::CA_UPDATE; |
| 37 using cricket::FakeVoiceMediaChannel; | 31 using cricket::FakeVoiceMediaChannel; |
| 38 using cricket::StreamParams; | 32 using cricket::StreamParams; |
| 39 using cricket::TransportChannel; | 33 using cricket::TransportChannel; |
| 40 | 34 |
| 41 namespace { | 35 namespace { |
| 42 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 64000, 8000, 1); | 36 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 64000, 8000, 1); |
| (...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2231 | 2225 |
| 2232 TEST_F(VoiceChannelSingleThreadTest, SendSrtpToRtp) { | 2226 TEST_F(VoiceChannelSingleThreadTest, SendSrtpToRtp) { |
| 2233 Base::SendSrtpToSrtp(); | 2227 Base::SendSrtpToSrtp(); |
| 2234 } | 2228 } |
| 2235 | 2229 |
| 2236 TEST_F(VoiceChannelSingleThreadTest, SendSrtcpMux) { | 2230 TEST_F(VoiceChannelSingleThreadTest, SendSrtcpMux) { |
| 2237 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2231 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 2238 } | 2232 } |
| 2239 | 2233 |
| 2240 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToSrtp) { | 2234 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToSrtp) { |
| 2241 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2242 Base::SendSrtpToSrtp(DTLS, 0); | 2235 Base::SendSrtpToSrtp(DTLS, 0); |
| 2243 } | 2236 } |
| 2244 | 2237 |
| 2245 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2238 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 2246 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2247 Base::SendSrtpToSrtp(DTLS, DTLS); | 2239 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 2248 } | 2240 } |
| 2249 | 2241 |
| 2250 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | 2242 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2251 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2252 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | 2243 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2253 } | 2244 } |
| 2254 | 2245 |
| 2255 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | 2246 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2256 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2257 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | 2247 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2258 } | 2248 } |
| 2259 | 2249 |
| 2260 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 2250 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2261 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2262 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 2251 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2263 } | 2252 } |
| 2264 | 2253 |
| 2265 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2254 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2266 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2267 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2255 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2268 } | 2256 } |
| 2269 | 2257 |
| 2270 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2258 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2271 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2259 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2272 } | 2260 } |
| 2273 | 2261 |
| 2274 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { | 2262 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { |
| 2275 Base::SendRtpToRtpOnThread(); | 2263 Base::SendRtpToRtpOnThread(); |
| 2276 } | 2264 } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 | 2552 |
| 2565 TEST_F(VoiceChannelDoubleThreadTest, SendSrtpToRtp) { | 2553 TEST_F(VoiceChannelDoubleThreadTest, SendSrtpToRtp) { |
| 2566 Base::SendSrtpToSrtp(); | 2554 Base::SendSrtpToSrtp(); |
| 2567 } | 2555 } |
| 2568 | 2556 |
| 2569 TEST_F(VoiceChannelDoubleThreadTest, SendSrtcpMux) { | 2557 TEST_F(VoiceChannelDoubleThreadTest, SendSrtcpMux) { |
| 2570 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2558 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 2571 } | 2559 } |
| 2572 | 2560 |
| 2573 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { | 2561 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { |
| 2574 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2575 Base::SendSrtpToSrtp(DTLS, 0); | 2562 Base::SendSrtpToSrtp(DTLS, 0); |
| 2576 } | 2563 } |
| 2577 | 2564 |
| 2578 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2565 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 2579 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2580 Base::SendSrtpToSrtp(DTLS, DTLS); | 2566 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 2581 } | 2567 } |
| 2582 | 2568 |
| 2583 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | 2569 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2584 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2585 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | 2570 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2586 } | 2571 } |
| 2587 | 2572 |
| 2588 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | 2573 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2589 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2590 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | 2574 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2591 } | 2575 } |
| 2592 | 2576 |
| 2593 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 2577 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2594 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2595 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 2578 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2596 } | 2579 } |
| 2597 | 2580 |
| 2598 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2581 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2599 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2600 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2582 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2601 } | 2583 } |
| 2602 | 2584 |
| 2603 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2585 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2604 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2586 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2605 } | 2587 } |
| 2606 | 2588 |
| 2607 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { | 2589 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { |
| 2608 Base::SendRtpToRtpOnThread(); | 2590 Base::SendRtpToRtpOnThread(); |
| 2609 } | 2591 } |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2889 | 2871 |
| 2890 TEST_F(VideoChannelSingleThreadTest, SendSrtpToSrtp) { | 2872 TEST_F(VideoChannelSingleThreadTest, SendSrtpToSrtp) { |
| 2891 Base::SendSrtpToSrtp(); | 2873 Base::SendSrtpToSrtp(); |
| 2892 } | 2874 } |
| 2893 | 2875 |
| 2894 TEST_F(VideoChannelSingleThreadTest, SendSrtpToRtp) { | 2876 TEST_F(VideoChannelSingleThreadTest, SendSrtpToRtp) { |
| 2895 Base::SendSrtpToSrtp(); | 2877 Base::SendSrtpToSrtp(); |
| 2896 } | 2878 } |
| 2897 | 2879 |
| 2898 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToSrtp) { | 2880 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToSrtp) { |
| 2899 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2900 Base::SendSrtpToSrtp(DTLS, 0); | 2881 Base::SendSrtpToSrtp(DTLS, 0); |
| 2901 } | 2882 } |
| 2902 | 2883 |
| 2903 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2884 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 2904 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2905 Base::SendSrtpToSrtp(DTLS, DTLS); | 2885 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 2906 } | 2886 } |
| 2907 | 2887 |
| 2908 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2888 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2909 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2910 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2889 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2911 } | 2890 } |
| 2912 | 2891 |
| 2913 TEST_F(VideoChannelSingleThreadTest, SendSrtcpMux) { | 2892 TEST_F(VideoChannelSingleThreadTest, SendSrtcpMux) { |
| 2914 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2893 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 2915 } | 2894 } |
| 2916 | 2895 |
| 2917 TEST_F(VideoChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2896 TEST_F(VideoChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2918 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2897 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2919 } | 2898 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3121 | 3100 |
| 3122 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToSrtp) { | 3101 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToSrtp) { |
| 3123 Base::SendSrtpToSrtp(); | 3102 Base::SendSrtpToSrtp(); |
| 3124 } | 3103 } |
| 3125 | 3104 |
| 3126 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToRtp) { | 3105 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToRtp) { |
| 3127 Base::SendSrtpToSrtp(); | 3106 Base::SendSrtpToSrtp(); |
| 3128 } | 3107 } |
| 3129 | 3108 |
| 3130 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { | 3109 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { |
| 3131 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 3132 Base::SendSrtpToSrtp(DTLS, 0); | 3110 Base::SendSrtpToSrtp(DTLS, 0); |
| 3133 } | 3111 } |
| 3134 | 3112 |
| 3135 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 3113 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 3136 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 3137 Base::SendSrtpToSrtp(DTLS, DTLS); | 3114 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 3138 } | 3115 } |
| 3139 | 3116 |
| 3140 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 3117 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 3141 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 3142 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 3118 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 3143 } | 3119 } |
| 3144 | 3120 |
| 3145 TEST_F(VideoChannelDoubleThreadTest, SendSrtcpMux) { | 3121 TEST_F(VideoChannelDoubleThreadTest, SendSrtcpMux) { |
| 3146 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 3122 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 3147 } | 3123 } |
| 3148 | 3124 |
| 3149 TEST_F(VideoChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 3125 TEST_F(VideoChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 3150 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 3126 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 3151 } | 3127 } |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3571 }; | 3547 }; |
| 3572 rtc::CopyOnWriteBuffer payload(data, 3); | 3548 rtc::CopyOnWriteBuffer payload(data, 3); |
| 3573 cricket::SendDataResult result; | 3549 cricket::SendDataResult result; |
| 3574 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3550 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
| 3575 EXPECT_EQ(params.ssrc, | 3551 EXPECT_EQ(params.ssrc, |
| 3576 media_channel1_->last_sent_data_params().ssrc); | 3552 media_channel1_->last_sent_data_params().ssrc); |
| 3577 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3553 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
| 3578 } | 3554 } |
| 3579 | 3555 |
| 3580 // TODO(pthatcher): TestSetReceiver? | 3556 // TODO(pthatcher): TestSetReceiver? |
| OLD | NEW |