Chromium Code Reviews| 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/fakeclock.h" | 16 #include "webrtc/base/fakeclock.h" |
| 16 #include "webrtc/base/gunit.h" | 17 #include "webrtc/base/gunit.h" |
| 17 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" |
| 18 #include "webrtc/base/sslstreamadapter.h" | 19 #include "webrtc/base/sslstreamadapter.h" |
| 19 #include "webrtc/media/base/fakemediaengine.h" | 20 #include "webrtc/media/base/fakemediaengine.h" |
| 20 #include "webrtc/media/base/fakertp.h" | 21 #include "webrtc/media/base/fakertp.h" |
| 21 #include "webrtc/media/base/mediachannel.h" | 22 #include "webrtc/media/base/mediachannel.h" |
| 22 #include "webrtc/media/base/testutils.h" | 23 #include "webrtc/media/base/testutils.h" |
| 23 #include "webrtc/p2p/base/faketransportcontroller.h" | 24 #include "webrtc/p2p/base/faketransportcontroller.h" |
| 24 #include "webrtc/p2p/base/transportchannelimpl.h" | 25 #include "webrtc/p2p/base/transportchannelimpl.h" |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1261 SendRtcp1(); | 1262 SendRtcp1(); |
| 1262 SendRtcp2(); | 1263 SendRtcp2(); |
| 1263 WaitForThreads(); | 1264 WaitForThreads(); |
| 1264 EXPECT_TRUE(CheckRtcp2()); | 1265 EXPECT_TRUE(CheckRtcp2()); |
| 1265 EXPECT_TRUE(CheckRtcp1()); | 1266 EXPECT_TRUE(CheckRtcp1()); |
| 1266 } | 1267 } |
| 1267 | 1268 |
| 1268 // Test that we properly send SRTP with RTCP in both directions. | 1269 // Test that we properly send SRTP with RTCP in both directions. |
| 1269 // You can pass in DTLS and/or RTCP_MUX as flags. | 1270 // You can pass in DTLS and/or RTCP_MUX as flags. |
| 1270 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 1271 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { |
| 1271 ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); | 1272 RTC_CHECK((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
| 1272 ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); | 1273 RTC_CHECK((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); |
|
kwiberg-webrtc
2017/01/17 09:39:25
EXPECT_* ?
nisse-webrtc
2017/01/17 12:19:21
I'll do that if you prefer. But these checks are a
kwiberg-webrtc
2017/01/17 13:52:47
OK, use CHECK then.
| |
| 1273 | 1274 |
| 1274 int flags1 = SECURE | flags1_in; | 1275 int flags1 = SECURE | flags1_in; |
| 1275 int flags2 = SECURE | flags2_in; | 1276 int flags2 = SECURE | flags2_in; |
| 1276 bool dtls1 = !!(flags1_in & DTLS); | 1277 bool dtls1 = !!(flags1_in & DTLS); |
| 1277 bool dtls2 = !!(flags2_in & DTLS); | 1278 bool dtls2 = !!(flags2_in & DTLS); |
| 1278 CreateChannels(flags1, flags2); | 1279 CreateChannels(flags1, flags2); |
| 1279 EXPECT_FALSE(channel1_->secure()); | 1280 EXPECT_FALSE(channel1_->secure()); |
| 1280 EXPECT_FALSE(channel2_->secure()); | 1281 EXPECT_FALSE(channel2_->secure()); |
| 1281 EXPECT_TRUE(SendInitiate()); | 1282 EXPECT_TRUE(SendInitiate()); |
| 1282 WaitForThreads(); | 1283 WaitForThreads(); |
| (...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3571 }; | 3572 }; |
| 3572 rtc::CopyOnWriteBuffer payload(data, 3); | 3573 rtc::CopyOnWriteBuffer payload(data, 3); |
| 3573 cricket::SendDataResult result; | 3574 cricket::SendDataResult result; |
| 3574 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3575 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
| 3575 EXPECT_EQ(params.ssrc, | 3576 EXPECT_EQ(params.ssrc, |
| 3576 media_channel1_->last_sent_data_params().ssrc); | 3577 media_channel1_->last_sent_data_params().ssrc); |
| 3577 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3578 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
| 3578 } | 3579 } |
| 3579 | 3580 |
| 3580 // TODO(pthatcher): TestSetReceiver? | 3581 // TODO(pthatcher): TestSetReceiver? |
| OLD | NEW |