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 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
7 | 7 |
| 8 #include <list> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "content/renderer/media/media_stream_dependency_factory.h" | 13 #include "content/renderer/media/media_stream_dependency_factory.h" |
13 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 14 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class MockVideoSource : public webrtc::VideoSourceInterface { | 18 class MockVideoSource : public webrtc::VideoSourceInterface { |
18 public: | 19 public: |
19 MockVideoSource(); | 20 MockVideoSource(); |
20 | 21 |
21 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 22 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
22 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 23 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
23 virtual MediaSourceInterface::SourceState state() const OVERRIDE; | 24 virtual MediaSourceInterface::SourceState state() const OVERRIDE; |
24 virtual cricket::VideoCapturer* GetVideoCapturer() OVERRIDE; | 25 virtual cricket::VideoCapturer* GetVideoCapturer() OVERRIDE; |
25 virtual void AddSink(cricket::VideoRenderer* output) OVERRIDE; | 26 virtual void AddSink(cricket::VideoRenderer* output) OVERRIDE; |
26 virtual void RemoveSink(cricket::VideoRenderer* output) OVERRIDE; | 27 virtual void RemoveSink(cricket::VideoRenderer* output) OVERRIDE; |
27 virtual const cricket::VideoOptions* options() const OVERRIDE; | 28 virtual const cricket::VideoOptions* options() const OVERRIDE; |
28 | 29 |
29 // Changes the state of the source to live and notifies the observer. | 30 // Changes the state of the source to live and notifies the observer. |
30 void SetLive(); | 31 void SetLive(); |
31 // Changes the state of the source to ended and notifies the observer. | 32 // Changes the state of the source to ended and notifies the observer. |
32 void SetEnded(); | 33 void SetEnded(); |
33 | 34 |
34 protected: | 35 protected: |
35 virtual ~MockVideoSource(); | 36 virtual ~MockVideoSource(); |
| 37 void FireOnChanged(); |
36 | 38 |
37 private: | 39 private: |
38 webrtc::ObserverInterface* observer_; | 40 std::list<webrtc::ObserverInterface*> observers_; |
39 MediaSourceInterface::SourceState state_; | 41 MediaSourceInterface::SourceState state_; |
40 }; | 42 }; |
41 | 43 |
42 class MockAudioSource : public webrtc::AudioSourceInterface { | 44 class MockAudioSource : public webrtc::AudioSourceInterface { |
43 public: | 45 public: |
44 MockAudioSource(const webrtc::MediaConstraintsInterface* constraints); | 46 MockAudioSource(const webrtc::MediaConstraintsInterface* constraints); |
45 | 47 |
46 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 48 virtual void RegisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
47 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; | 49 virtual void UnregisterObserver(webrtc::ObserverInterface* observer) OVERRIDE; |
48 virtual MediaSourceInterface::SourceState state() const OVERRIDE; | 50 virtual MediaSourceInterface::SourceState state() const OVERRIDE; |
49 | 51 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 bool mock_pc_factory_created_; | 175 bool mock_pc_factory_created_; |
174 scoped_refptr <MockAudioSource> last_audio_source_; | 176 scoped_refptr <MockAudioSource> last_audio_source_; |
175 scoped_refptr <MockVideoSource> last_video_source_; | 177 scoped_refptr <MockVideoSource> last_video_source_; |
176 | 178 |
177 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); | 179 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDependencyFactory); |
178 }; | 180 }; |
179 | 181 |
180 } // namespace content | 182 } // namespace content |
181 | 183 |
182 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 184 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
OLD | NEW |