Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: webrtc/call/call_unittest.cc

Issue 1397123003: Add AudioSendStream to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: merge+comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/call/call.cc ('k') | webrtc/webrtc_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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(); }
tommi 2015/10/16 11:08:43 what about overloading operator -> instead? looks
the sun 2015/10/16 11:30:01 correct; silly moi
27
28 private:
29 rtc::scoped_ptr<webrtc::Call> call_;
30 };
stefan-webrtc 2015/10/16 09:25:41 I haven't seen this pattern used in many other uni
The Sun (google.com) 2015/10/16 09:41:46 gtest supports tests with/without fixtures. Gener
stefan-webrtc 2015/10/16 09:46:14 Ok, I'm not going to block the CL on this, I was m
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) {
pbos-webrtc 2015/10/16 10:48:29 Is there any point to this pattern? Also, can you
The Sun (google.com) 2015/10/16 11:01:57 1. No. The intent is to add a bunch of streams and
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()) {
pbos-webrtc 2015/10/16 10:48:29 for (AudioSendStream* stream : streams), clear aft
The Sun (google.com) 2015/10/16 11:01:57 Done.
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()) {
pbos-webrtc 2015/10/16 10:48:29 same
The Sun (google.com) 2015/10/16 11:01:57 Done.
96 call()->DestroyAudioReceiveStream(streams.front());
97 streams.pop_front();
98 }
99 }
100 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/call.cc ('k') | webrtc/webrtc_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698