OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIDEO_SINK_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_ |
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_ |
7 | 7 |
8 #include "content/public/renderer/media_stream_video_sink.h" | 8 #include "content/public/renderer/media_stream_video_sink.h" |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | |
11 #include "content/common/media/video_capture.h" | |
10 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
12 | 14 |
13 namespace content { | 15 namespace content { |
14 | 16 |
15 class MockMediaStreamVideoSink : public MediaStreamVideoSink { | 17 class MockMediaStreamVideoSink : public MediaStreamVideoSink { |
16 public: | 18 public: |
17 MockMediaStreamVideoSink(); | 19 MockMediaStreamVideoSink(); |
18 virtual ~MockMediaStreamVideoSink(); | 20 virtual ~MockMediaStreamVideoSink(); |
19 | 21 |
20 virtual void OnVideoFrame( | |
21 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE; | |
22 virtual void OnReadyStateChanged( | 22 virtual void OnReadyStateChanged( |
23 blink::WebMediaStreamSource::ReadyState state) OVERRIDE; | 23 blink::WebMediaStreamSource::ReadyState state) OVERRIDE; |
24 virtual void OnEnabledChanged(bool enabled) OVERRIDE; | 24 virtual void OnEnabledChanged(bool enabled) OVERRIDE; |
25 | 25 |
26 // Triggered when OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame) | 26 // Triggered when OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame) |
27 // is called. | 27 // is called. |
28 MOCK_METHOD0(OnVideoFrame, void()); | 28 MOCK_METHOD0(OnVideoFrame, void()); |
29 | |
30 VideoCaptureDeliverFrameCB GetDeliverFrameCB(); | |
29 | 31 |
30 int number_of_frames() const { return number_of_frames_; } | 32 int number_of_frames() const { return number_of_frames_; } |
31 media::VideoFrame::Format format() const { return format_; } | 33 media::VideoFrame::Format format() const { return format_; } |
32 gfx::Size frame_size() const { return frame_size_; } | 34 gfx::Size frame_size() const { return frame_size_; } |
33 | 35 |
34 bool enabled() const { return enabled_; } | 36 bool enabled() const { return enabled_; } |
35 blink::WebMediaStreamSource::ReadyState state() const { return state_; } | 37 blink::WebMediaStreamSource::ReadyState state() const { return state_; } |
36 | 38 |
37 private: | 39 private: |
40 void DeliverVideoFrame( | |
41 const scoped_refptr<media::VideoFrame>& frame, | |
42 const media::VideoCaptureFormat& format); | |
38 int number_of_frames_; | 43 int number_of_frames_; |
perkj_chrome
2014/05/08 08:15:08
nit: empty line before first member.
Alpha Left Google
2014/05/08 18:45:51
Done.
| |
39 bool enabled_; | 44 bool enabled_; |
40 media::VideoFrame::Format format_; | 45 media::VideoFrame::Format format_; |
41 blink::WebMediaStreamSource::ReadyState state_; | 46 blink::WebMediaStreamSource::ReadyState state_; |
42 gfx::Size frame_size_; | 47 gfx::Size frame_size_; |
48 base::WeakPtrFactory<MockMediaStreamVideoSink> weak_factory_; | |
43 }; | 49 }; |
44 | 50 |
45 } // namespace content | 51 } // namespace content |
46 | 52 |
47 #endif | 53 #endif |
OLD | NEW |