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

Unified Diff: content/renderer/media/media_stream_impl_unittest.cc

Issue 10008077: Adding JSEP PeerConnection glue - attempt 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 8 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
Index: content/renderer/media/media_stream_impl_unittest.cc
diff --git a/content/renderer/media/media_stream_impl_unittest.cc b/content/renderer/media/media_stream_impl_unittest.cc
index 110c69d2a478cd5e4826b587b026084cd01e1a39..f00aa04092b4ea6e4d56a2bda1c07e7e4cef98ec 100644
--- a/content/renderer/media/media_stream_impl_unittest.cc
+++ b/content/renderer/media/media_stream_impl_unittest.cc
@@ -7,10 +7,14 @@
#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_00_handler_client.h"
#include "content/renderer/media/mock_web_peer_connection_handler_client.h"
+#include "content/renderer/media/peer_connection_handler.h"
+#include "content/renderer/media/peer_connection_handler_jsep.h"
#include "content/renderer/media/video_capture_impl_manager.h"
#include "content/renderer/p2p/socket_dispatcher.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnection00Handler.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h"
// Disabled due to http://crbug.com/112408 .
@@ -38,9 +42,67 @@ TEST(MediaStreamImplTest, DISABLED_Basic) {
WebKit::MockWebPeerConnectionHandlerClient client;
WebKit::WebPeerConnectionHandler* pc_handler =
ms_impl->CreatePeerConnectionHandler(&client);
- EXPECT_TRUE(ms_impl->peer_connection_handler_);
+ EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size());
- ms_impl->ClosePeerConnection();
- EXPECT_FALSE(ms_impl->peer_connection_handler_);
+ // Delete PC handler explicitly after closing to mimic WebKit behavior.
+ ms_impl->ClosePeerConnection(
+ static_cast<PeerConnectionHandler*>(pc_handler));
+ EXPECT_TRUE(ms_impl->peer_connection_handlers_.empty());
delete pc_handler;
+
+ WebKit::MockWebPeerConnection00HandlerClient client_jsep;
+ WebKit::WebPeerConnection00Handler* pc_handler_jsep =
+ ms_impl->CreatePeerConnectionHandlerJsep(&client_jsep);
+ EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size());
+
+ // Delete PC handler explicitly after closing to mimic WebKit behavior.
+ ms_impl->ClosePeerConnection(
+ static_cast<PeerConnectionHandlerJsep*>(pc_handler_jsep));
+ EXPECT_TRUE(ms_impl->peer_connection_handlers_.empty());
+ delete pc_handler_jsep;
+}
+
+// Disabled due to http://crbug.com/112408 .
+TEST(MediaStreamImplTest, DISABLED_MultiplePeerConnections) {
+ 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;
+ WebKit::WebPeerConnectionHandler* pc_handler =
+ ms_impl->CreatePeerConnectionHandler(&client);
+ EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size());
+
+ WebKit::MockWebPeerConnection00HandlerClient client_jsep;
+ WebKit::WebPeerConnection00Handler* pc_handler_jsep =
+ ms_impl->CreatePeerConnectionHandlerJsep(&client_jsep);
+ EXPECT_EQ(2u, ms_impl->peer_connection_handlers_.size());
+
+ // Delete PC handler explicitly after closing to mimic WebKit behavior.
+ ms_impl->ClosePeerConnection(
+ static_cast<PeerConnectionHandler*>(pc_handler));
+ EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size());
+ delete pc_handler;
+
+ // Delete PC handler explicitly after closing to mimic WebKit behavior.
+ ms_impl->ClosePeerConnection(
+ static_cast<PeerConnectionHandlerJsep*>(pc_handler_jsep));
+ EXPECT_TRUE(ms_impl->peer_connection_handlers_.empty());
+ delete pc_handler_jsep;
}
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/media/mock_media_stream_dependency_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698