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