OLD | NEW |
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_source_extra_data.h" | 8 #include "content/renderer/media/media_stream_source_extra_data.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_web_rtc_peer_connection_handler_client.h" | 10 #include "content/renderer/media/mock_web_rtc_peer_connection_handler_client.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 new MediaStreamSourceExtraData(info)); | 81 new MediaStreamSourceExtraData(info)); |
82 } | 82 } |
83 WebKit::WebMediaStreamDescriptor stream_desc; | 83 WebKit::WebMediaStreamDescriptor stream_desc; |
84 stream_desc.initialize("media stream", audio_sources, video_sources); | 84 stream_desc.initialize("media stream", audio_sources, video_sources); |
85 | 85 |
86 return stream_desc; | 86 return stream_desc; |
87 } | 87 } |
88 | 88 |
89 void CreateNativeSources(WebKit::WebMediaStreamDescriptor* descriptor) { | 89 void CreateNativeSources(WebKit::WebMediaStreamDescriptor* descriptor) { |
90 MediaSourceCreatedObserver observer; | 90 MediaSourceCreatedObserver observer; |
| 91 WebKit::WebMediaConstraints audio_constraints; |
91 dependency_factory_->CreateNativeMediaSources( | 92 dependency_factory_->CreateNativeMediaSources( |
92 WebKit::WebMediaConstraints(), | 93 WebKit::WebMediaConstraints(), |
93 WebKit::WebMediaConstraints(), | 94 WebKit::WebMediaConstraints(), |
94 descriptor, | 95 descriptor, |
95 base::Bind( | 96 base::Bind( |
96 &MediaSourceCreatedObserver::OnCreateNativeSourcesComplete, | 97 &MediaSourceCreatedObserver::OnCreateNativeSourcesComplete, |
97 base::Unretained(&observer))); | 98 base::Unretained(&observer))); |
98 | 99 |
99 EXPECT_FALSE(observer.result()); | 100 EXPECT_FALSE(observer.result()); |
100 // Change the state of the created source to live. This should trigger | 101 // Change the state of the created source to live. This should trigger |
101 // MediaSourceCreatedObserver::OnCreateNativeSourcesComplete | 102 // MediaSourceCreatedObserver::OnCreateNativeSourcesComplete |
102 if (dependency_factory_->last_video_source()) { | 103 if (dependency_factory_->last_video_source()) { |
| 104 dependency_factory_->last_audio_source()->SetLive(); |
103 dependency_factory_->last_video_source()->SetLive(); | 105 dependency_factory_->last_video_source()->SetLive(); |
104 } | 106 } |
105 EXPECT_TRUE(observer.result()); | 107 EXPECT_TRUE(observer.result()); |
106 EXPECT_TRUE(observer.description() == descriptor); | 108 EXPECT_TRUE(observer.description() == descriptor); |
107 } | 109 } |
108 | 110 |
109 protected: | 111 protected: |
110 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_; | 112 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_; |
111 }; | 113 }; |
112 | 114 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 EXPECT_TRUE(dependency_factory_->EnsurePeerConnectionFactory()); | 154 EXPECT_TRUE(dependency_factory_->EnsurePeerConnectionFactory()); |
153 dependency_factory_->CreateNativeLocalMediaStream(&stream_desc); | 155 dependency_factory_->CreateNativeLocalMediaStream(&stream_desc); |
154 MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( | 156 MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( |
155 stream_desc.extraData()); | 157 stream_desc.extraData()); |
156 ASSERT_TRUE(extra_data && extra_data->local_stream()); | 158 ASSERT_TRUE(extra_data && extra_data->local_stream()); |
157 EXPECT_EQ(0u, extra_data->local_stream()->video_tracks()->count()); | 159 EXPECT_EQ(0u, extra_data->local_stream()->video_tracks()->count()); |
158 EXPECT_EQ(0u, extra_data->local_stream()->audio_tracks()->count()); | 160 EXPECT_EQ(0u, extra_data->local_stream()->audio_tracks()->count()); |
159 } | 161 } |
160 | 162 |
161 } // namespace content | 163 } // namespace content |
OLD | NEW |