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

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

Issue 14346002: Connect webrtc MediaSourceInterface ready states with webkit WebMediaStreamSource (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
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 "content/common/media/media_stream_options.h" 6 #include "content/common/media/media_stream_options.h"
7 #include "content/renderer/media/media_stream_extra_data.h" 7 #include "content/renderer/media/media_stream_extra_data.h"
8 #include "content/renderer/media/media_stream_impl.h"
8 #include "content/renderer/media/media_stream_source_extra_data.h" 9 #include "content/renderer/media/media_stream_source_extra_data.h"
9 #include "content/renderer/media/mock_media_stream_dependency_factory.h" 10 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
10 #include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h" 11 #include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectio nHandler.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectio nHandler.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 dependency_factory_->CreateRTCPeerConnectionHandler(&client_jsep)); 129 dependency_factory_->CreateRTCPeerConnectionHandler(&client_jsep));
129 EXPECT_TRUE(pc_handler.get() != NULL); 130 EXPECT_TRUE(pc_handler.get() != NULL);
130 } 131 }
131 132
132 TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStream) { 133 TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStream) {
133 WebKit::WebMediaStream stream_desc = CreateWebKitMediaStream(true, true); 134 WebKit::WebMediaStream stream_desc = CreateWebKitMediaStream(true, true);
134 CreateNativeSources(&stream_desc); 135 CreateNativeSources(&stream_desc);
135 136
136 dependency_factory_->CreateNativeLocalMediaStream(&stream_desc); 137 dependency_factory_->CreateNativeLocalMediaStream(&stream_desc);
137 VerifyMediaStream(stream_desc, 1, 1); 138 VerifyMediaStream(stream_desc, 1, 1);
139 MediaStreamImpl::ReleaseSourceObservers(stream_desc);
138 } 140 }
139 141
140 // Test that we don't crash if a MediaStream is created in WebKit with unknown 142 // Test that we don't crash if a MediaStream is created in WebKit with unknown
141 // sources. This can for example happen if a MediaStream is created with 143 // sources. This can for example happen if a MediaStream is created with
142 // remote tracks. 144 // remote tracks.
143 TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStreamWithoutSource) { 145 TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStreamWithoutSource) {
144 // Create a WebKit MediaStream description. 146 // Create a WebKit MediaStream description.
145 WebKit::WebMediaStream stream_desc; 147 WebKit::WebMediaStream stream_desc;
146 WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources( 148 WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources(
147 static_cast<size_t>(1)); 149 static_cast<size_t>(1));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 181
180 WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks; 182 WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks;
181 stream_desc.videoTracks(video_tracks); 183 stream_desc.videoTracks(video_tracks);
182 EXPECT_TRUE(dependency_factory_->RemoveNativeMediaStreamTrack( 184 EXPECT_TRUE(dependency_factory_->RemoveNativeMediaStreamTrack(
183 stream_desc, video_tracks[0])); 185 stream_desc, video_tracks[0]));
184 VerifyMediaStream(stream_desc, 1, 0); 186 VerifyMediaStream(stream_desc, 1, 0);
185 187
186 EXPECT_TRUE(dependency_factory_->AddNativeMediaStreamTrack( 188 EXPECT_TRUE(dependency_factory_->AddNativeMediaStreamTrack(
187 stream_desc, video_tracks[0])); 189 stream_desc, video_tracks[0]));
188 VerifyMediaStream(stream_desc, 1, 1); 190 VerifyMediaStream(stream_desc, 1, 1);
191 MediaStreamImpl::ReleaseSourceObservers(stream_desc);
189 } 192 }
190 193
191 } // namespace content 194 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698