OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // Unit test for VideoCaptureBufferPool. | 5 // Unit test for VideoCaptureBufferPool. |
6 | 6 |
7 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" | 7 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 #include <string.h> | 11 #include <string.h> |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 #include <utility> | 14 #include <utility> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "cc/test/test_context_provider.h" | 23 #include "cc/test/test_context_provider.h" |
24 #include "cc/test/test_web_graphics_context_3d.h" | 24 #include "cc/test/test_web_graphics_context_3d.h" |
25 #include "components/display_compositor/buffer_queue.h" | 25 #include "content/browser/compositor/buffer_queue.h" |
26 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 26 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
27 #include "content/browser/renderer_host/media/video_capture_controller.h" | 27 #include "content/browser/renderer_host/media/video_capture_controller.h" |
28 #include "media/base/video_frame.h" | 28 #include "media/base/video_frame.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 | 33 |
34 struct PixelFormatAndStorage { | 34 struct PixelFormatAndStorage { |
35 media::VideoPixelFormat pixel_format; | 35 media::VideoPixelFormat pixel_format; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 StubBrowserGpuMemoryBufferManager() : BrowserGpuMemoryBufferManager(1, 1) {} | 106 StubBrowserGpuMemoryBufferManager() : BrowserGpuMemoryBufferManager(1, 1) {} |
107 | 107 |
108 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 108 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
109 const gfx::Size& size, | 109 const gfx::Size& size, |
110 gfx::BufferFormat format, | 110 gfx::BufferFormat format, |
111 gfx::BufferUsage usage, | 111 gfx::BufferUsage usage, |
112 int32_t surface_id) override { | 112 int32_t surface_id) override { |
113 return base::WrapUnique(new MockGpuMemoryBuffer(size)); | 113 return base::WrapUnique(new MockGpuMemoryBuffer(size)); |
114 } | 114 } |
115 }; | 115 }; |
116 class MockBufferQueue : public display_compositor::BufferQueue { | 116 class MockBufferQueue : public BufferQueue { |
117 public: | 117 public: |
118 MockBufferQueue(scoped_refptr<cc::ContextProvider> context_provider, | 118 MockBufferQueue(scoped_refptr<cc::ContextProvider> context_provider, |
119 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager, | 119 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager, |
120 unsigned int target, | 120 unsigned int target, |
121 unsigned int internalformat) | 121 unsigned int internalformat) |
122 : BufferQueue(context_provider, | 122 : BufferQueue(context_provider, |
123 target, | 123 target, |
124 internalformat, | 124 internalformat, |
125 nullptr, | 125 nullptr, |
126 gpu_memory_buffer_manager, | 126 gpu_memory_buffer_manager, |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 ASSERT_NE(nullptr, held_buffers.back().get()); | 518 ASSERT_NE(nullptr, held_buffers.back().get()); |
519 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam()); | 519 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam()); |
520 ASSERT_EQ(nullptr, resurrected.get()); | 520 ASSERT_EQ(nullptr, resurrected.get()); |
521 } | 521 } |
522 | 522 |
523 INSTANTIATE_TEST_CASE_P(, | 523 INSTANTIATE_TEST_CASE_P(, |
524 VideoCaptureBufferPoolTest, | 524 VideoCaptureBufferPoolTest, |
525 testing::ValuesIn(kCapturePixelFormatAndStorages)); | 525 testing::ValuesIn(kCapturePixelFormatAndStorages)); |
526 | 526 |
527 } // namespace content | 527 } // namespace content |
OLD | NEW |