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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_
8 #include "content/public/renderer/media_stream_video_sink.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/common/media/video_capture.h"
12 #include "media/base/video_frame.h"
13 #include "testing/gmock/include/gmock/gmock.h"
17 class MockMediaStreamVideoSink
: public MediaStreamVideoSink
{
19 MockMediaStreamVideoSink();
20 ~MockMediaStreamVideoSink() override
;
22 void OnReadyStateChanged(
23 blink::WebMediaStreamSource::ReadyState state
) override
;
24 void OnEnabledChanged(bool enabled
) override
;
26 // Triggered when OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame)
28 MOCK_METHOD0(OnVideoFrame
, void());
30 VideoCaptureDeliverFrameCB
GetDeliverFrameCB();
32 int number_of_frames() const { return number_of_frames_
; }
33 media::VideoPixelFormat
format() const { return format_
; }
34 gfx::Size
frame_size() const { return frame_size_
; }
35 scoped_refptr
<media::VideoFrame
> last_frame() const { return last_frame_
; };
37 bool enabled() const { return enabled_
; }
38 blink::WebMediaStreamSource::ReadyState
state() const { return state_
; }
41 void DeliverVideoFrame(const scoped_refptr
<media::VideoFrame
>& frame
,
42 base::TimeTicks estimated_capture_time
);
44 int number_of_frames_
;
46 media::VideoPixelFormat format_
;
47 blink::WebMediaStreamSource::ReadyState state_
;
48 gfx::Size frame_size_
;
49 scoped_refptr
<media::VideoFrame
> last_frame_
;
50 base::WeakPtrFactory
<MockMediaStreamVideoSink
> weak_factory_
;
53 } // namespace content
55 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_