| 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/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/base/fakeclock.h" | 16 #include "webrtc/base/fakeclock.h" |
| 17 #include "webrtc/base/gunit.h" | 17 #include "webrtc/base/gunit.h" |
| 18 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" |
| 19 #include "webrtc/base/sslstreamadapter.h" | 19 #include "webrtc/base/sslstreamadapter.h" |
| 20 #include "webrtc/media/base/fakemediaengine.h" | 20 #include "webrtc/media/base/fakemediaengine.h" |
| 21 #include "webrtc/media/base/fakertp.h" | 21 #include "webrtc/media/base/fakertp.h" |
| 22 #include "webrtc/media/base/mediachannel.h" | 22 #include "webrtc/media/base/mediachannel.h" |
| 23 #include "webrtc/media/base/testutils.h" | 23 #include "webrtc/media/base/testutils.h" |
| 24 #include "webrtc/p2p/base/dtlstransportinternal.h" | 24 #include "webrtc/p2p/base/dtlstransportinternal.h" |
| 25 #include "webrtc/p2p/base/faketransportcontroller.h" | 25 #include "webrtc/p2p/base/faketransportcontroller.h" |
| 26 #include "webrtc/pc/channel.h" | 26 #include "webrtc/pc/channel.h" |
| 27 | 27 |
| 28 #define MAYBE_SKIP_TEST(feature) \ | |
| 29 if (!(rtc::SSLStreamAdapter::feature())) { \ | |
| 30 LOG(LS_INFO) << "Feature disabled... skipping"; \ | |
| 31 return; \ | |
| 32 } | |
| 33 | |
| 34 using cricket::CA_OFFER; | 28 using cricket::CA_OFFER; |
| 35 using cricket::CA_PRANSWER; | 29 using cricket::CA_PRANSWER; |
| 36 using cricket::CA_ANSWER; | 30 using cricket::CA_ANSWER; |
| 37 using cricket::CA_UPDATE; | 31 using cricket::CA_UPDATE; |
| 38 using cricket::DtlsTransportInternal; | 32 using cricket::DtlsTransportInternal; |
| 39 using cricket::FakeVoiceMediaChannel; | 33 using cricket::FakeVoiceMediaChannel; |
| 40 using cricket::StreamParams; | 34 using cricket::StreamParams; |
| 41 | 35 |
| 42 namespace { | 36 namespace { |
| 43 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 64000, 8000, 1); | 37 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 64000, 8000, 1); |
| (...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2236 | 2230 |
| 2237 TEST_F(VoiceChannelSingleThreadTest, SendSrtpToRtp) { | 2231 TEST_F(VoiceChannelSingleThreadTest, SendSrtpToRtp) { |
| 2238 Base::SendSrtpToSrtp(); | 2232 Base::SendSrtpToSrtp(); |
| 2239 } | 2233 } |
| 2240 | 2234 |
| 2241 TEST_F(VoiceChannelSingleThreadTest, SendSrtcpMux) { | 2235 TEST_F(VoiceChannelSingleThreadTest, SendSrtcpMux) { |
| 2242 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2236 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 2243 } | 2237 } |
| 2244 | 2238 |
| 2245 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToSrtp) { | 2239 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToSrtp) { |
| 2246 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2247 Base::SendSrtpToSrtp(DTLS, 0); | 2240 Base::SendSrtpToSrtp(DTLS, 0); |
| 2248 } | 2241 } |
| 2249 | 2242 |
| 2250 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2243 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 2251 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2252 Base::SendSrtpToSrtp(DTLS, DTLS); | 2244 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 2253 } | 2245 } |
| 2254 | 2246 |
| 2255 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | 2247 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2256 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2257 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | 2248 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2258 } | 2249 } |
| 2259 | 2250 |
| 2260 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | 2251 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2261 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2262 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | 2252 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2263 } | 2253 } |
| 2264 | 2254 |
| 2265 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 2255 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2266 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2267 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 2256 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2268 } | 2257 } |
| 2269 | 2258 |
| 2270 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2259 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2271 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2272 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2260 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2273 } | 2261 } |
| 2274 | 2262 |
| 2275 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2263 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2276 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2264 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2277 } | 2265 } |
| 2278 | 2266 |
| 2279 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { | 2267 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { |
| 2280 Base::SendRtpToRtpOnThread(); | 2268 Base::SendRtpToRtpOnThread(); |
| 2281 } | 2269 } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 | 2557 |
| 2570 TEST_F(VoiceChannelDoubleThreadTest, SendSrtpToRtp) { | 2558 TEST_F(VoiceChannelDoubleThreadTest, SendSrtpToRtp) { |
| 2571 Base::SendSrtpToSrtp(); | 2559 Base::SendSrtpToSrtp(); |
| 2572 } | 2560 } |
| 2573 | 2561 |
| 2574 TEST_F(VoiceChannelDoubleThreadTest, SendSrtcpMux) { | 2562 TEST_F(VoiceChannelDoubleThreadTest, SendSrtcpMux) { |
| 2575 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2563 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 2576 } | 2564 } |
| 2577 | 2565 |
| 2578 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { | 2566 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { |
| 2579 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2580 Base::SendSrtpToSrtp(DTLS, 0); | 2567 Base::SendSrtpToSrtp(DTLS, 0); |
| 2581 } | 2568 } |
| 2582 | 2569 |
| 2583 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2570 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 2584 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2585 Base::SendSrtpToSrtp(DTLS, DTLS); | 2571 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 2586 } | 2572 } |
| 2587 | 2573 |
| 2588 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { | 2574 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmBoth) { |
| 2589 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2590 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); | 2575 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS | GCM_CIPHER); |
| 2591 } | 2576 } |
| 2592 | 2577 |
| 2593 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { | 2578 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmOne) { |
| 2594 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2595 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); | 2579 Base::SendSrtpToSrtp(DTLS | GCM_CIPHER, DTLS); |
| 2596 } | 2580 } |
| 2597 | 2581 |
| 2598 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 2582 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2599 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2600 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 2583 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2601 } | 2584 } |
| 2602 | 2585 |
| 2603 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2586 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2604 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2605 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2587 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2606 } | 2588 } |
| 2607 | 2589 |
| 2608 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2590 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2609 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2591 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2610 } | 2592 } |
| 2611 | 2593 |
| 2612 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { | 2594 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { |
| 2613 Base::SendRtpToRtpOnThread(); | 2595 Base::SendRtpToRtpOnThread(); |
| 2614 } | 2596 } |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2894 | 2876 |
| 2895 TEST_F(VideoChannelSingleThreadTest, SendSrtpToSrtp) { | 2877 TEST_F(VideoChannelSingleThreadTest, SendSrtpToSrtp) { |
| 2896 Base::SendSrtpToSrtp(); | 2878 Base::SendSrtpToSrtp(); |
| 2897 } | 2879 } |
| 2898 | 2880 |
| 2899 TEST_F(VideoChannelSingleThreadTest, SendSrtpToRtp) { | 2881 TEST_F(VideoChannelSingleThreadTest, SendSrtpToRtp) { |
| 2900 Base::SendSrtpToSrtp(); | 2882 Base::SendSrtpToSrtp(); |
| 2901 } | 2883 } |
| 2902 | 2884 |
| 2903 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToSrtp) { | 2885 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToSrtp) { |
| 2904 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2905 Base::SendSrtpToSrtp(DTLS, 0); | 2886 Base::SendSrtpToSrtp(DTLS, 0); |
| 2906 } | 2887 } |
| 2907 | 2888 |
| 2908 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2889 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 2909 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2910 Base::SendSrtpToSrtp(DTLS, DTLS); | 2890 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 2911 } | 2891 } |
| 2912 | 2892 |
| 2913 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2893 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2914 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 2915 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2894 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2916 } | 2895 } |
| 2917 | 2896 |
| 2918 TEST_F(VideoChannelSingleThreadTest, SendSrtcpMux) { | 2897 TEST_F(VideoChannelSingleThreadTest, SendSrtcpMux) { |
| 2919 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 2898 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 2920 } | 2899 } |
| 2921 | 2900 |
| 2922 TEST_F(VideoChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2901 TEST_F(VideoChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2923 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2902 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2924 } | 2903 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3126 | 3105 |
| 3127 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToSrtp) { | 3106 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToSrtp) { |
| 3128 Base::SendSrtpToSrtp(); | 3107 Base::SendSrtpToSrtp(); |
| 3129 } | 3108 } |
| 3130 | 3109 |
| 3131 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToRtp) { | 3110 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToRtp) { |
| 3132 Base::SendSrtpToSrtp(); | 3111 Base::SendSrtpToSrtp(); |
| 3133 } | 3112 } |
| 3134 | 3113 |
| 3135 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { | 3114 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToSrtp) { |
| 3136 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 3137 Base::SendSrtpToSrtp(DTLS, 0); | 3115 Base::SendSrtpToSrtp(DTLS, 0); |
| 3138 } | 3116 } |
| 3139 | 3117 |
| 3140 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 3118 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 3141 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 3142 Base::SendSrtpToSrtp(DTLS, DTLS); | 3119 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 3143 } | 3120 } |
| 3144 | 3121 |
| 3145 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 3122 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 3146 MAYBE_SKIP_TEST(HaveDtlsSrtp); | |
| 3147 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 3123 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 3148 } | 3124 } |
| 3149 | 3125 |
| 3150 TEST_F(VideoChannelDoubleThreadTest, SendSrtcpMux) { | 3126 TEST_F(VideoChannelDoubleThreadTest, SendSrtcpMux) { |
| 3151 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 3127 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 3152 } | 3128 } |
| 3153 | 3129 |
| 3154 TEST_F(VideoChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 3130 TEST_F(VideoChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 3155 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 3131 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 3156 } | 3132 } |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3657 cricket::DtlsTransportInternal* new_rtcp_transport = | 3633 cricket::DtlsTransportInternal* new_rtcp_transport = |
| 3658 fake_transport_controller_.CreateDtlsTransport( | 3634 fake_transport_controller_.CreateDtlsTransport( |
| 3659 "baz", cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 3635 "baz", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3660 EXPECT_DEATH( | 3636 EXPECT_DEATH( |
| 3661 voice_channel_.SetTransports(new_rtp_transport, new_rtcp_transport), ""); | 3637 voice_channel_.SetTransports(new_rtp_transport, new_rtcp_transport), ""); |
| 3662 } | 3638 } |
| 3663 | 3639 |
| 3664 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 3640 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 3665 | 3641 |
| 3666 // TODO(pthatcher): TestSetReceiver? | 3642 // TODO(pthatcher): TestSetReceiver? |
| OLD | NEW |