OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 5 #ifndef MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
6 #define MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 6 #define MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <memory> |
| 12 |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
15 #include "media/renderers/gpu_video_accelerator_factories.h" | 16 #include "media/renderers/gpu_video_accelerator_factories.h" |
16 #include "media/video/video_decode_accelerator.h" | 17 #include "media/video/video_decode_accelerator.h" |
17 #include "media/video/video_encode_accelerator.h" | 18 #include "media/video/video_encode_accelerator.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class SharedMemory; | 22 class SharedMemory; |
22 } | 23 } |
23 | 24 |
(...skipping 17 matching lines...) Expand all Loading... |
41 std::vector<gpu::Mailbox>* texture_mailboxes, | 42 std::vector<gpu::Mailbox>* texture_mailboxes, |
42 uint32_t texture_target)); | 43 uint32_t texture_target)); |
43 MOCK_METHOD1(DeleteTexture, void(uint32_t texture_id)); | 44 MOCK_METHOD1(DeleteTexture, void(uint32_t texture_id)); |
44 MOCK_METHOD1(WaitSyncToken, void(const gpu::SyncToken& sync_token)); | 45 MOCK_METHOD1(WaitSyncToken, void(const gpu::SyncToken& sync_token)); |
45 MOCK_METHOD0(GetTaskRunner, scoped_refptr<base::SingleThreadTaskRunner>()); | 46 MOCK_METHOD0(GetTaskRunner, scoped_refptr<base::SingleThreadTaskRunner>()); |
46 MOCK_METHOD0(GetVideoDecodeAcceleratorCapabilities, | 47 MOCK_METHOD0(GetVideoDecodeAcceleratorCapabilities, |
47 VideoDecodeAccelerator::Capabilities()); | 48 VideoDecodeAccelerator::Capabilities()); |
48 MOCK_METHOD0(GetVideoEncodeAcceleratorSupportedProfiles, | 49 MOCK_METHOD0(GetVideoEncodeAcceleratorSupportedProfiles, |
49 VideoEncodeAccelerator::SupportedProfiles()); | 50 VideoEncodeAccelerator::SupportedProfiles()); |
50 | 51 |
51 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 52 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
52 const gfx::Size& size, | 53 const gfx::Size& size, |
53 gfx::BufferFormat format, | 54 gfx::BufferFormat format, |
54 gfx::BufferUsage usage) override; | 55 gfx::BufferUsage usage) override; |
55 | 56 |
56 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override; | 57 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override; |
57 unsigned ImageTextureTarget(gfx::BufferFormat format) override; | 58 unsigned ImageTextureTarget(gfx::BufferFormat format) override; |
58 VideoPixelFormat VideoFrameOutputFormat() override { | 59 VideoPixelFormat VideoFrameOutputFormat() override { |
59 return video_frame_output_format_; | 60 return video_frame_output_format_; |
60 }; | 61 }; |
61 | 62 |
62 scoped_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> | 63 std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> |
63 GetGLContextLock() override; | 64 GetGLContextLock() override; |
64 | 65 |
65 void SetVideoFrameOutputFormat( | 66 void SetVideoFrameOutputFormat( |
66 const VideoPixelFormat video_frame_output_format) { | 67 const VideoPixelFormat video_frame_output_format) { |
67 video_frame_output_format_ = video_frame_output_format; | 68 video_frame_output_format_ = video_frame_output_format; |
68 }; | 69 }; |
69 | 70 |
70 void SetFailToAllocateGpuMemoryBufferForTesting(bool fail) { | 71 void SetFailToAllocateGpuMemoryBufferForTesting(bool fail) { |
71 fail_to_allocate_gpu_memory_buffer_ = fail; | 72 fail_to_allocate_gpu_memory_buffer_ = fail; |
72 } | 73 } |
73 | 74 |
74 void SetGpuMemoryBuffersInUseByMacOSWindowServer(bool in_use); | 75 void SetGpuMemoryBuffersInUseByMacOSWindowServer(bool in_use); |
75 | 76 |
76 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; | 77 std::unique_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; |
77 | 78 |
78 scoped_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() override; | 79 std::unique_ptr<VideoDecodeAccelerator> CreateVideoDecodeAccelerator() |
| 80 override; |
79 | 81 |
80 scoped_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() override; | 82 std::unique_ptr<VideoEncodeAccelerator> CreateVideoEncodeAccelerator() |
| 83 override; |
81 | 84 |
82 gpu::gles2::GLES2Interface* GetGLES2Interface() { return gles2_; } | 85 gpu::gles2::GLES2Interface* GetGLES2Interface() { return gles2_; } |
83 | 86 |
84 private: | 87 private: |
85 DISALLOW_COPY_AND_ASSIGN(MockGpuVideoAcceleratorFactories); | 88 DISALLOW_COPY_AND_ASSIGN(MockGpuVideoAcceleratorFactories); |
86 | 89 |
87 base::Lock lock_; | 90 base::Lock lock_; |
88 VideoPixelFormat video_frame_output_format_ = PIXEL_FORMAT_I420; | 91 VideoPixelFormat video_frame_output_format_ = PIXEL_FORMAT_I420; |
89 | 92 |
90 bool fail_to_allocate_gpu_memory_buffer_ = false; | 93 bool fail_to_allocate_gpu_memory_buffer_ = false; |
91 | 94 |
92 gpu::gles2::GLES2Interface* gles2_; | 95 gpu::gles2::GLES2Interface* gles2_; |
93 }; | 96 }; |
94 | 97 |
95 } // namespace media | 98 } // namespace media |
96 | 99 |
97 #endif // MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ | 100 #endif // MEDIA_RENDERERS_MOCK_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ |
OLD | NEW |