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

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

Issue 10703095: New PeerConnection handler in Chrome to support latest PeerConnection draft (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix code review issues found by Wei. Created 8 years, 4 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 "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/renderer/media/media_stream_impl.h" 8 #include "content/renderer/media/media_stream_impl.h"
9 #include "content/renderer/media/mock_media_stream_dependency_factory.h" 9 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
10 #include "content/renderer/media/mock_media_stream_dispatcher.h" 10 #include "content/renderer/media/mock_media_stream_dispatcher.h"
11 #include "content/renderer/media/mock_web_peer_connection_00_handler_client.h" 11 #include "content/renderer/media/mock_web_peer_connection_00_handler_client.h"
12 #include "content/renderer/media/mock_web_peer_connection_handler_client.h"
13 #include "content/renderer/media/peer_connection_handler_jsep.h" 12 #include "content/renderer/media/peer_connection_handler_jsep.h"
14 #include "content/renderer/media/video_capture_impl_manager.h" 13 #include "content/renderer/media/video_capture_impl_manager.h"
15 #include "content/renderer/p2p/socket_dispatcher.h" 14 #include "content/renderer/p2p/socket_dispatcher.h"
16 #include "media/base/message_loop_factory.h" 15 #include "media/base/message_loop_factory.h"
17 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00Handler.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00Handler.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandler.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandler.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
22 21
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return desc; 104 return desc;
106 } 105 }
107 106
108 protected: 107 protected:
109 MessageLoop loop_; 108 MessageLoop loop_;
110 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_; 109 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_;
111 scoped_ptr<content::P2PSocketDispatcher> p2p_socket_dispatcher_; 110 scoped_ptr<content::P2PSocketDispatcher> p2p_socket_dispatcher_;
112 scoped_ptr<MediaStreamImplUnderTest> ms_impl_; 111 scoped_ptr<MediaStreamImplUnderTest> ms_impl_;
113 }; 112 };
114 113
115 TEST_F(MediaStreamImplTest, CreatePeerConnection) { 114 TEST_F(MediaStreamImplTest, CreatePeerConnection) {
Ronghua Wu (Left Chromium) 2012/08/14 00:59:03 Add test to create the new PeerConnection
perkj_chrome 2012/08/14 09:15:40 Done.
116 // Create JSEP PeerConnection. 115 // Create JSEP PeerConnection.
117 WebKit::MockWebPeerConnection00HandlerClient client_jsep; 116 WebKit::MockWebPeerConnection00HandlerClient client_jsep;
118 scoped_ptr<WebKit::WebPeerConnection00Handler> pc_handler_jsep( 117 scoped_ptr<WebKit::WebPeerConnection00Handler> pc_handler_jsep(
119 ms_impl_->CreatePeerConnectionHandlerJsep(&client_jsep)); 118 ms_impl_->CreatePeerConnectionHandlerJsep(&client_jsep));
120 pc_handler_jsep.reset(); 119 pc_handler_jsep.reset();
121 } 120 }
122 121
123 TEST_F(MediaStreamImplTest, LocalMediaStream) { 122 TEST_F(MediaStreamImplTest, LocalMediaStream) {
124 // Test a stream with both audio and video. 123 // Test a stream with both audio and video.
125 WebKit::WebMediaStreamDescriptor mixed_desc = RequestLocalMediaStream(true, 124 WebKit::WebMediaStreamDescriptor mixed_desc = RequestLocalMediaStream(true,
(...skipping 23 matching lines...) Expand all
149 ms_impl_->StopLocalMediaStream(mixed_desc); 148 ms_impl_->StopLocalMediaStream(mixed_desc);
150 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter()); 149 EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter());
151 ms_impl_->StopLocalMediaStream(audio_desc); 150 ms_impl_->StopLocalMediaStream(audio_desc);
152 EXPECT_EQ(2, ms_dispatcher_->stop_stream_counter()); 151 EXPECT_EQ(2, ms_dispatcher_->stop_stream_counter());
153 152
154 // Test that the MediaStreams are deleted if the owning WebFrame is deleted. 153 // Test that the MediaStreams are deleted if the owning WebFrame is deleted.
155 // In the unit test the owning frame is NULL. 154 // In the unit test the owning frame is NULL.
156 ms_impl_->FrameWillClose(NULL); 155 ms_impl_->FrameWillClose(NULL);
157 EXPECT_EQ(3, ms_dispatcher_->stop_stream_counter()); 156 EXPECT_EQ(3, ms_dispatcher_->stop_stream_counter());
158 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698