Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / shell / renderer / layout_test / test_video_frame_provider.h
blobca09e3e19b137e062c2eabac8f09a2b7fb3b9411
1 // Copyright 2013 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_SHELL_RENDERER_LAYOUT_TEST_TEST_VIDEO_FRAME_PROVIDER_H_
6 #define CONTENT_SHELL_RENDERER_LAYOUT_TEST_TEST_VIDEO_FRAME_PROVIDER_H_
8 #include "base/time/time.h"
9 #include "content/public/renderer/video_frame_provider.h"
10 #include "ui/gfx/geometry/size.h"
12 namespace base {
13 class SingleThreadTaskRunner;
16 namespace content {
18 // A simple implementation of VideoFrameProvider generates raw frames and
19 // passes them to webmediaplayer.
20 // Since non-black pixel values are required in the layout test, e.g.,
21 // media/video-capture-canvas.html, this class should generate frame with
22 // only non-black pixels.
23 class TestVideoFrameProvider : public VideoFrameProvider {
24 public:
25 TestVideoFrameProvider(
26 const gfx::Size& size,
27 const base::TimeDelta& frame_duration,
28 const base::Closure& error_cb,
29 const RepaintCB& repaint_cb);
31 // VideoFrameProvider implementation.
32 void Start() override;
33 void Stop() override;
34 void Play() override;
35 void Pause() override;
37 protected:
38 ~TestVideoFrameProvider() override;
40 private:
41 enum State {
42 kStarted,
43 kPaused,
44 kStopped,
47 void GenerateFrame();
49 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
50 gfx::Size size_;
51 State state_;
53 base::TimeDelta current_time_;
54 base::TimeDelta frame_duration_;
55 base::Closure error_cb_;
56 RepaintCB repaint_cb_;
58 DISALLOW_COPY_AND_ASSIGN(TestVideoFrameProvider);
61 } // namespace content
63 #endif // CONTENT_SHELL_RENDERER_LAYOUT_TEST_TEST_VIDEO_FRAME_PROVIDER_H_