summaryrefslogtreecommitdiffstats
path: root/content/renderer/media/media_stream_impl_unittest.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-28 21:24:07 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-28 21:24:07 +0000
commitd12b265876b50a9fb00c47e3e529e4b556064336 (patch)
treec0964afda07661c61969eb0da115f6818b17e000 /content/renderer/media/media_stream_impl_unittest.cc
parent98878750f21211687db18e27056ffc4ae3d8c2ab (diff)
downloadchromium_src-d12b265876b50a9fb00c47e3e529e4b556064336.zip
chromium_src-d12b265876b50a9fb00c47e3e529e4b556064336.tar.gz
chromium_src-d12b265876b50a9fb00c47e3e529e4b556064336.tar.bz2
Land change for grunell@: "Adding support for MediaStream and PeerConnection functionality. "
Original review: http://codereview.chromium.org/8060055/ TBR=darin, scherkus Review URL: http://codereview.chromium.org/8691003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media/media_stream_impl_unittest.cc')
-rw-r--r--content/renderer/media/media_stream_impl_unittest.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/content/renderer/media/media_stream_impl_unittest.cc b/content/renderer/media/media_stream_impl_unittest.cc
new file mode 100644
index 0000000..1c0a27d
--- /dev/null
+++ b/content/renderer/media/media_stream_impl_unittest.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop.h"
+#include "content/renderer/media/media_stream_impl.h"
+#include "content/renderer/media/mock_media_stream_dependency_factory.h"
+#include "content/renderer/media/mock_media_stream_dispatcher.h"
+#include "content/renderer/media/mock_web_peer_connection_handler_client.h"
+#include "content/renderer/media/video_capture_impl_manager.h"
+#include "content/renderer/p2p/socket_dispatcher.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+// TODO(grunell): Fix issue 105556.
+TEST(MediaStreamImplTest, DISABLED_Basic) {
+ MessageLoop loop;
+
+ // Create our test object.
+ scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher(
+ new MockMediaStreamDispatcher());
+ scoped_ptr<content::P2PSocketDispatcher> p2p_socket_dispatcher(
+ new content::P2PSocketDispatcher(NULL));
+ scoped_refptr<VideoCaptureImplManager> vc_manager(
+ new VideoCaptureImplManager());
+ MockMediaStreamDependencyFactory* dependency_factory =
+ new MockMediaStreamDependencyFactory();
+ scoped_refptr<MediaStreamImpl> ms_impl(new MediaStreamImpl(
+ ms_dispatcher.get(),
+ p2p_socket_dispatcher.get(),
+ vc_manager.get(),
+ dependency_factory));
+
+ // TODO(grunell): Add tests for WebKit::WebUserMediaClient and
+ // MediaStreamDispatcherEventHandler implementations.
+
+ WebKit::MockWebPeerConnectionHandlerClient client;
+ ms_impl->CreatePeerConnectionHandler(&client);
+ EXPECT_TRUE(ms_impl->peer_connection_handler_);
+
+ ms_impl->stream_labels_.push_back("label1");
+ ms_impl->stream_labels_.push_back("label2");
+ EXPECT_EQ(2, ms_dispatcher->stop_stream_counter());
+ EXPECT_TRUE(ms_impl->stream_labels_.empty());
+
+ ms_impl->ClosePeerConnection();
+ EXPECT_FALSE(ms_impl->peer_connection_handler_);
+}