| 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 "base/message_loop/message_loop.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
| 8 #include "content/renderer/media/media_stream.h" | 9 #include "content/renderer/media/media_stream.h" |
| 9 #include "content/renderer/media/media_stream_impl.h" | 10 #include "content/renderer/media/media_stream_impl.h" |
| 10 #include "content/renderer/media/media_stream_track.h" | 11 #include "content/renderer/media/media_stream_track.h" |
| 11 #include "content/renderer/media/mock_media_stream_dependency_factory.h" | 12 #include "content/renderer/media/mock_media_stream_dependency_factory.h" |
| 12 #include "content/renderer/media/mock_media_stream_dispatcher.h" | 13 #include "content/renderer/media/mock_media_stream_dispatcher.h" |
| 13 #include "content/renderer/media/mock_media_stream_video_source.h" | 14 #include "content/renderer/media/mock_media_stream_video_source.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 16 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 ms_impl_->last_created_video_source(); | 161 ms_impl_->last_created_video_source(); |
| 161 if (video_source->SourceHasAttemptedToStart()) | 162 if (video_source->SourceHasAttemptedToStart()) |
| 162 video_source->FailToStartMockedSource(); | 163 video_source->FailToStartMockedSource(); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void FailToCreateNextAudioCapturer() { | 166 void FailToCreateNextAudioCapturer() { |
| 166 dependency_factory_->FailToCreateNextAudioCapturer(); | 167 dependency_factory_->FailToCreateNextAudioCapturer(); |
| 167 } | 168 } |
| 168 | 169 |
| 169 protected: | 170 protected: |
| 171 base::MessageLoop message_loop_; |
| 170 scoped_ptr<ChildProcess> child_process_; | 172 scoped_ptr<ChildProcess> child_process_; |
| 171 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_; | 173 scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_; |
| 172 scoped_ptr<MediaStreamImplUnderTest> ms_impl_; | 174 scoped_ptr<MediaStreamImplUnderTest> ms_impl_; |
| 173 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_; | 175 scoped_ptr<MockMediaStreamDependencyFactory> dependency_factory_; |
| 174 }; | 176 }; |
| 175 | 177 |
| 176 TEST_F(MediaStreamImplTest, GenerateMediaStream) { | 178 TEST_F(MediaStreamImplTest, GenerateMediaStream) { |
| 177 // Generate a stream with both audio and video. | 179 // Generate a stream with both audio and video. |
| 178 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); | 180 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); |
| 179 } | 181 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 395 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 394 | 396 |
| 395 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; | 397 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; |
| 396 mixed_desc.videoTracks(video_tracks); | 398 mixed_desc.videoTracks(video_tracks); |
| 397 MediaStreamTrack* video_track = MediaStreamTrack::GetTrack(video_tracks[0]); | 399 MediaStreamTrack* video_track = MediaStreamTrack::GetTrack(video_tracks[0]); |
| 398 video_track->Stop(); | 400 video_track->Stop(); |
| 399 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 401 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 400 } | 402 } |
| 401 | 403 |
| 402 } // namespace content | 404 } // namespace content |
| OLD | NEW |