Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include <list> | |
| 12 | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | |
| 14 | |
| 15 #include "webrtc/call.h" | |
| 16 | |
| 17 namespace { | |
| 18 | |
| 19 struct CallHelper { | |
| 20 CallHelper() { | |
| 21 webrtc::Call::Config config; | |
| 22 // TODO(solenberg): Fill in with VoiceEngine* etc. | |
| 23 call_.reset(webrtc::Call::Create(config)); | |
| 24 } | |
| 25 | |
| 26 webrtc::Call* operator()() { return call_.get(); } | |
| 27 | |
| 28 private: | |
| 29 rtc::scoped_ptr<webrtc::Call> call_; | |
| 30 }; | |
| 31 } // namespace | |
| 32 | |
| 33 namespace webrtc { | |
| 34 | |
| 35 TEST(CallTest, ConstructDestruct) { | |
| 36 CallHelper call; | |
| 37 } | |
| 38 | |
| 39 TEST(CallTest, CreateDestroy_AudioSendStream) { | |
| 40 CallHelper call; | |
| 41 AudioSendStream::Config config(nullptr); | |
| 42 config.rtp.ssrc = 42; | |
| 43 config.voe_channel_id = 123; | |
| 44 AudioSendStream* stream = call()->CreateAudioSendStream(config); | |
| 45 EXPECT_NE(stream, nullptr); | |
| 46 call()->DestroyAudioSendStream(stream); | |
| 47 } | |
| 48 | |
| 49 TEST(CallTest, CreateDestroy_AudioReceiveStream) { | |
| 50 CallHelper call; | |
| 51 AudioReceiveStream::Config config; | |
| 52 config.rtp.remote_ssrc = 42; | |
| 53 config.voe_channel_id = 123; | |
| 54 AudioReceiveStream* stream = call()->CreateAudioReceiveStream(config); | |
| 55 EXPECT_NE(stream, nullptr); | |
| 56 call()->DestroyAudioReceiveStream(stream); | |
| 57 } | |
| 58 | |
| 59 TEST(CallTest, CreateDestroy_AudioSendStreams) { | |
| 60 CallHelper call; | |
| 61 AudioSendStream::Config config(nullptr); | |
| 62 config.voe_channel_id = 123; | |
| 63 std::list<AudioSendStream*> streams; | |
| 64 for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) { | |
| 65 config.rtp.ssrc = ssrc; | |
| 66 AudioSendStream* stream = call()->CreateAudioSendStream(config); | |
| 67 EXPECT_NE(stream, nullptr); | |
| 68 if (ssrc & 1) { | |
| 69 streams.push_back(stream); | |
| 70 } else { | |
| 71 streams.push_front(stream); | |
| 72 } | |
| 73 } | |
| 74 while (!streams.empty()) { | |
| 75 call()->DestroyAudioSendStream(streams.front()); | |
| 76 streams.pop_front(); | |
| 77 } | |
| 78 } | |
| 79 | |
| 80 TEST(CallTest, CreateDestroy_AudioReceiveStreams) { | |
| 81 CallHelper call; | |
| 82 AudioReceiveStream::Config config; | |
| 83 config.voe_channel_id = 123; | |
| 84 std::list<AudioReceiveStream*> streams; | |
| 85 for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) { | |
| 86 config.rtp.remote_ssrc = ssrc; | |
| 87 AudioReceiveStream* stream = call()->CreateAudioReceiveStream(config); | |
| 88 EXPECT_NE(stream, nullptr); | |
| 89 if (ssrc & 1) { | |
| 90 streams.push_back(stream); | |
| 91 } else { | |
| 92 streams.push_front(stream); | |
| 93 } | |
| 94 } | |
| 95 while (!streams.empty()) { | |
| 96 call()->DestroyAudioReceiveStream(streams.front()); | |
| 97 streams.pop_front(); | |
| 98 } | |
| 99 } | |
| 100 } // namespace webrtc | |
|
pbos-webrtc
2015/10/15 15:32:12
Do you want to add some of these for Video equival
the sun
2015/10/16 08:47:05
Makes more sense if you do that.
| |
| OLD | NEW |