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

Side by Side Diff: content/renderer/media/media_stream_impl_unittest.cc

Issue 10038009: Revert 131949 (multiple memory leaks) - Adding JSEP PeerConnection glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "content/renderer/media/media_stream_impl.h" 7 #include "content/renderer/media/media_stream_impl.h"
8 #include "content/renderer/media/mock_media_stream_dependency_factory.h" 8 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
9 #include "content/renderer/media/mock_media_stream_dispatcher.h" 9 #include "content/renderer/media/mock_media_stream_dispatcher.h"
10 #include "content/renderer/media/mock_web_peer_connection_00_handler_client.h"
11 #include "content/renderer/media/mock_web_peer_connection_handler_client.h" 10 #include "content/renderer/media/mock_web_peer_connection_handler_client.h"
12 #include "content/renderer/media/peer_connection_handler.h"
13 #include "content/renderer/media/peer_connection_handler_jsep.h"
14 #include "content/renderer/media/video_capture_impl_manager.h" 11 #include "content/renderer/media/video_capture_impl_manager.h"
15 #include "content/renderer/p2p/socket_dispatcher.h" 12 #include "content/renderer/p2p/socket_dispatcher.h"
16 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00Handler.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandler.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandler.h"
19 15
20 // Disabled due to http://crbug.com/112408 . 16 // Disabled due to http://crbug.com/112408 .
21 TEST(MediaStreamImplTest, DISABLED_Basic) { 17 TEST(MediaStreamImplTest, DISABLED_Basic) {
22 MessageLoop loop; 18 MessageLoop loop;
23 19
24 // Create our test object. 20 // Create our test object.
25 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher( 21 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher(
26 new MockMediaStreamDispatcher()); 22 new MockMediaStreamDispatcher());
27 scoped_ptr<content::P2PSocketDispatcher> p2p_socket_dispatcher( 23 scoped_ptr<content::P2PSocketDispatcher> p2p_socket_dispatcher(
28 new content::P2PSocketDispatcher(NULL)); 24 new content::P2PSocketDispatcher(NULL));
29 scoped_refptr<VideoCaptureImplManager> vc_manager( 25 scoped_refptr<VideoCaptureImplManager> vc_manager(
30 new VideoCaptureImplManager()); 26 new VideoCaptureImplManager());
31 MockMediaStreamDependencyFactory* dependency_factory = 27 MockMediaStreamDependencyFactory* dependency_factory =
32 new MockMediaStreamDependencyFactory(); 28 new MockMediaStreamDependencyFactory();
33 scoped_refptr<MediaStreamImpl> ms_impl(new MediaStreamImpl( 29 scoped_refptr<MediaStreamImpl> ms_impl(new MediaStreamImpl(
34 ms_dispatcher.get(), 30 ms_dispatcher.get(),
35 p2p_socket_dispatcher.get(), 31 p2p_socket_dispatcher.get(),
36 vc_manager.get(), 32 vc_manager.get(),
37 dependency_factory)); 33 dependency_factory));
38 34
39 // TODO(grunell): Add tests for WebKit::WebUserMediaClient and 35 // TODO(grunell): Add tests for WebKit::WebUserMediaClient and
40 // MediaStreamDispatcherEventHandler implementations. 36 // MediaStreamDispatcherEventHandler implementations.
41 37
42 WebKit::MockWebPeerConnectionHandlerClient client; 38 WebKit::MockWebPeerConnectionHandlerClient client;
43 WebKit::WebPeerConnectionHandler* pc_handler = 39 WebKit::WebPeerConnectionHandler* pc_handler =
44 ms_impl->CreatePeerConnectionHandler(&client); 40 ms_impl->CreatePeerConnectionHandler(&client);
45 EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size()); 41 EXPECT_TRUE(ms_impl->peer_connection_handler_);
46 42
47 // Delete PC handler explicitly after closing to mimic WebKit behavior. 43 ms_impl->ClosePeerConnection();
48 ms_impl->ClosePeerConnection( 44 EXPECT_FALSE(ms_impl->peer_connection_handler_);
49 static_cast<PeerConnectionHandler*>(pc_handler));
50 EXPECT_TRUE(ms_impl->peer_connection_handlers_.empty());
51 delete pc_handler; 45 delete pc_handler;
52
53 WebKit::MockWebPeerConnection00HandlerClient client_jsep;
54 WebKit::WebPeerConnection00Handler* pc_handler_jsep =
55 ms_impl->CreatePeerConnectionHandlerJsep(&client_jsep);
56 EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size());
57
58 // Delete PC handler explicitly after closing to mimic WebKit behavior.
59 ms_impl->ClosePeerConnection(
60 static_cast<PeerConnectionHandlerJsep*>(pc_handler_jsep));
61 EXPECT_TRUE(ms_impl->peer_connection_handlers_.empty());
62 delete pc_handler_jsep;
63 } 46 }
64
65 // Disabled due to http://crbug.com/112408 .
66 TEST(MediaStreamImplTest, DISABLED_MultiplePeerConnections) {
67 MessageLoop loop;
68
69 // Create our test object.
70 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher(
71 new MockMediaStreamDispatcher());
72 scoped_ptr<content::P2PSocketDispatcher> p2p_socket_dispatcher(
73 new content::P2PSocketDispatcher(NULL));
74 scoped_refptr<VideoCaptureImplManager> vc_manager(
75 new VideoCaptureImplManager());
76 MockMediaStreamDependencyFactory* dependency_factory =
77 new MockMediaStreamDependencyFactory();
78 scoped_refptr<MediaStreamImpl> ms_impl(new MediaStreamImpl(
79 ms_dispatcher.get(),
80 p2p_socket_dispatcher.get(),
81 vc_manager.get(),
82 dependency_factory));
83
84 // TODO(grunell): Add tests for WebKit::WebUserMediaClient and
85 // MediaStreamDispatcherEventHandler implementations.
86
87 WebKit::MockWebPeerConnectionHandlerClient client;
88 WebKit::WebPeerConnectionHandler* pc_handler =
89 ms_impl->CreatePeerConnectionHandler(&client);
90 EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size());
91
92 WebKit::MockWebPeerConnection00HandlerClient client_jsep;
93 WebKit::WebPeerConnection00Handler* pc_handler_jsep =
94 ms_impl->CreatePeerConnectionHandlerJsep(&client_jsep);
95 EXPECT_EQ(2u, ms_impl->peer_connection_handlers_.size());
96
97 // Delete PC handler explicitly after closing to mimic WebKit behavior.
98 ms_impl->ClosePeerConnection(
99 static_cast<PeerConnectionHandler*>(pc_handler));
100 EXPECT_EQ(1u, ms_impl->peer_connection_handlers_.size());
101 delete pc_handler;
102
103 // Delete PC handler explicitly after closing to mimic WebKit behavior.
104 ms_impl->ClosePeerConnection(
105 static_cast<PeerConnectionHandlerJsep*>(pc_handler_jsep));
106 EXPECT_TRUE(ms_impl->peer_connection_handlers_.empty());
107 delete pc_handler_jsep;
108 }
OLDNEW
« 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