Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / media / mock_media_stream_video_sink.h
blob2f7376173a18df9d50ac1d8385494e00eef6209f
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"
15 namespace content {
17 class MockMediaStreamVideoSink : public MediaStreamVideoSink {
18 public:
19 MockMediaStreamVideoSink();
20 virtual ~MockMediaStreamVideoSink();
22 virtual void OnReadyStateChanged(
23 blink::WebMediaStreamSource::ReadyState state) OVERRIDE;
24 virtual void OnEnabledChanged(bool enabled) OVERRIDE;
26 // Triggered when OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame)
27 // is called.
28 MOCK_METHOD0(OnVideoFrame, void());
30 VideoCaptureDeliverFrameCB GetDeliverFrameCB();
32 int number_of_frames() const { return number_of_frames_; }
33 media::VideoFrame::Format 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_; }
40 private:
41 void DeliverVideoFrame(
42 const scoped_refptr<media::VideoFrame>& frame,
43 const media::VideoCaptureFormat& format,
44 const base::TimeTicks& estimated_capture_time);
46 int number_of_frames_;
47 bool enabled_;
48 media::VideoFrame::Format format_;
49 blink::WebMediaStreamSource::ReadyState state_;
50 gfx::Size frame_size_;
51 scoped_refptr<media::VideoFrame> last_frame_;
52 base::WeakPtrFactory<MockMediaStreamVideoSink> weak_factory_;
55 } // namespace content
57 #endif