OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2008 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 "webrtc/api/fakemediacontroller.h" | 11 #include "webrtc/api/fakemediacontroller.h" |
12 #include "webrtc/base/gunit.h" | 12 #include "webrtc/base/gunit.h" |
13 #include "webrtc/base/logging.h" | 13 #include "webrtc/base/logging.h" |
14 #include "webrtc/base/thread.h" | 14 #include "webrtc/base/thread.h" |
| 15 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
15 #include "webrtc/media/base/fakemediaengine.h" | 16 #include "webrtc/media/base/fakemediaengine.h" |
16 #include "webrtc/media/base/fakevideocapturer.h" | 17 #include "webrtc/media/base/fakevideocapturer.h" |
17 #include "webrtc/media/base/testutils.h" | 18 #include "webrtc/media/base/testutils.h" |
18 #include "webrtc/media/engine/fakewebrtccall.h" | 19 #include "webrtc/media/engine/fakewebrtccall.h" |
19 #include "webrtc/p2p/base/faketransportcontroller.h" | 20 #include "webrtc/p2p/base/faketransportcontroller.h" |
20 #include "webrtc/pc/channelmanager.h" | 21 #include "webrtc/pc/channelmanager.h" |
21 | 22 |
22 namespace cricket { | 23 namespace cricket { |
23 | 24 |
24 static const AudioCodec kAudioCodecs[] = { | 25 static const AudioCodec kAudioCodecs[] = { |
25 AudioCodec(97, "voice", 1, 2, 3), AudioCodec(111, "OPUS", 48000, 32000, 2), | 26 AudioCodec(97, "voice", 1, 2, 3), AudioCodec(111, "OPUS", 48000, 32000, 2), |
26 }; | 27 }; |
27 | 28 |
28 static const VideoCodec kVideoCodecs[] = { | 29 static const VideoCodec kVideoCodecs[] = { |
29 VideoCodec(99, "H264", 100, 200, 300), | 30 VideoCodec(99, "H264", 100, 200, 300), |
30 VideoCodec(100, "VP8", 100, 200, 300), VideoCodec(96, "rtx", 100, 200, 300), | 31 VideoCodec(100, "VP8", 100, 200, 300), VideoCodec(96, "rtx", 100, 200, 300), |
31 }; | 32 }; |
32 | 33 |
33 class ChannelManagerTest : public testing::Test { | 34 class ChannelManagerTest : public testing::Test { |
34 protected: | 35 protected: |
35 ChannelManagerTest() | 36 ChannelManagerTest() |
36 : fme_(new cricket::FakeMediaEngine()), | 37 : fme_(new cricket::FakeMediaEngine()), |
37 fdme_(new cricket::FakeDataEngine()), | 38 fdme_(new cricket::FakeDataEngine()), |
38 cm_(new cricket::ChannelManager(fme_, | 39 cm_(new cricket::ChannelManager(fme_, fdme_, rtc::Thread::Current())), |
39 fdme_, | 40 fake_call_(webrtc::Call::Config(&event_log_)), |
40 rtc::Thread::Current())), | |
41 fake_call_(webrtc::Call::Config()), | |
42 fake_mc_(cm_, &fake_call_), | 41 fake_mc_(cm_, &fake_call_), |
43 transport_controller_( | 42 transport_controller_( |
44 new cricket::FakeTransportController(ICEROLE_CONTROLLING)) {} | 43 new cricket::FakeTransportController(ICEROLE_CONTROLLING)) {} |
45 | 44 |
46 virtual void SetUp() { | 45 virtual void SetUp() { |
47 fme_->SetAudioCodecs(MAKE_VECTOR(kAudioCodecs)); | 46 fme_->SetAudioCodecs(MAKE_VECTOR(kAudioCodecs)); |
48 fme_->SetVideoCodecs(MAKE_VECTOR(kVideoCodecs)); | 47 fme_->SetVideoCodecs(MAKE_VECTOR(kVideoCodecs)); |
49 } | 48 } |
50 | 49 |
51 virtual void TearDown() { | 50 virtual void TearDown() { |
52 delete transport_controller_; | 51 delete transport_controller_; |
53 delete cm_; | 52 delete cm_; |
54 cm_ = NULL; | 53 cm_ = NULL; |
55 fdme_ = NULL; | 54 fdme_ = NULL; |
56 fme_ = NULL; | 55 fme_ = NULL; |
57 } | 56 } |
58 | 57 |
| 58 webrtc::RtcEventLogNullImpl event_log_; |
59 rtc::Thread network_; | 59 rtc::Thread network_; |
60 rtc::Thread worker_; | 60 rtc::Thread worker_; |
61 cricket::FakeMediaEngine* fme_; | 61 cricket::FakeMediaEngine* fme_; |
62 cricket::FakeDataEngine* fdme_; | 62 cricket::FakeDataEngine* fdme_; |
63 cricket::ChannelManager* cm_; | 63 cricket::ChannelManager* cm_; |
64 cricket::FakeCall fake_call_; | 64 cricket::FakeCall fake_call_; |
65 cricket::FakeMediaController fake_mc_; | 65 cricket::FakeMediaController fake_mc_; |
66 cricket::FakeTransportController* transport_controller_; | 66 cricket::FakeTransportController* transport_controller_; |
67 }; | 67 }; |
68 | 68 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 193 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
194 | 194 |
195 // Can set again after terminate. | 195 // Can set again after terminate. |
196 cm_->Terminate(); | 196 cm_->Terminate(); |
197 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 197 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
198 cm_->GetSupportedVideoCodecs(&codecs); | 198 cm_->GetSupportedVideoCodecs(&codecs); |
199 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 199 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
200 } | 200 } |
201 | 201 |
202 } // namespace cricket | 202 } // namespace cricket |
OLD | NEW |