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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/call/call.cc ('k') | webrtc/webrtc_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/call_unittest.cc
diff --git a/webrtc/call/call_unittest.cc b/webrtc/call/call_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dc4d9098fce449c1907b80e9fa409ecc4afbb9d8
--- /dev/null
+++ b/webrtc/call/call_unittest.cc
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <list>
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+#include "webrtc/call.h"
+
+namespace {
+
+struct CallHelper {
+ CallHelper() {
+ webrtc::Call::Config config;
+ // TODO(solenberg): Fill in with VoiceEngine* etc.
+ call_.reset(webrtc::Call::Create(config));
+ }
+
+ 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
+
+ private:
+ rtc::scoped_ptr<webrtc::Call> call_;
+};
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
+} // namespace
+
+namespace webrtc {
+
+TEST(CallTest, ConstructDestruct) {
+ CallHelper call;
+}
+
+TEST(CallTest, CreateDestroy_AudioSendStream) {
+ CallHelper call;
+ AudioSendStream::Config config(nullptr);
+ config.rtp.ssrc = 42;
+ config.voe_channel_id = 123;
+ AudioSendStream* stream = call()->CreateAudioSendStream(config);
+ EXPECT_NE(stream, nullptr);
+ call()->DestroyAudioSendStream(stream);
+}
+
+TEST(CallTest, CreateDestroy_AudioReceiveStream) {
+ CallHelper call;
+ AudioReceiveStream::Config config;
+ config.rtp.remote_ssrc = 42;
+ config.voe_channel_id = 123;
+ AudioReceiveStream* stream = call()->CreateAudioReceiveStream(config);
+ EXPECT_NE(stream, nullptr);
+ call()->DestroyAudioReceiveStream(stream);
+}
+
+TEST(CallTest, CreateDestroy_AudioSendStreams) {
+ CallHelper call;
+ AudioSendStream::Config config(nullptr);
+ config.voe_channel_id = 123;
+ std::list<AudioSendStream*> streams;
+ 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
+ config.rtp.ssrc = ssrc;
+ AudioSendStream* stream = call()->CreateAudioSendStream(config);
+ EXPECT_NE(stream, nullptr);
+ if (ssrc & 1) {
+ streams.push_back(stream);
+ } else {
+ streams.push_front(stream);
+ }
+ }
+ 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.
+ call()->DestroyAudioSendStream(streams.front());
+ streams.pop_front();
+ }
+}
+
+TEST(CallTest, CreateDestroy_AudioReceiveStreams) {
+ CallHelper call;
+ AudioReceiveStream::Config config;
+ config.voe_channel_id = 123;
+ std::list<AudioReceiveStream*> streams;
+ for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) {
+ config.rtp.remote_ssrc = ssrc;
+ AudioReceiveStream* stream = call()->CreateAudioReceiveStream(config);
+ EXPECT_NE(stream, nullptr);
+ if (ssrc & 1) {
+ streams.push_back(stream);
+ } else {
+ streams.push_front(stream);
+ }
+ }
+ while (!streams.empty()) {
pbos-webrtc 2015/10/16 10:48:29 same
The Sun (google.com) 2015/10/16 11:01:57 Done.
+ call()->DestroyAudioReceiveStream(streams.front());
+ streams.pop_front();
+ }
+}
+} // namespace webrtc
« 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