| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" |
| 12 #include "cc/test/test_context_provider.h" | 13 #include "cc/test/test_context_provider.h" |
| 13 #include "cc/test/test_web_graphics_context_3d.h" | 14 #include "cc/test/test_web_graphics_context_3d.h" |
| 14 #include "content/browser/compositor/buffer_queue.h" | 15 #include "content/browser/compositor/buffer_queue.h" |
| 15 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 16 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 16 #include "content/browser/renderer_host/media/video_capture_controller.h" | 17 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 17 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
| 18 #include "media/base/video_util.h" | 19 #include "media/base/video_util.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (buffer_id == VideoCaptureBufferPool::kInvalidId) | 150 if (buffer_id == VideoCaptureBufferPool::kInvalidId) |
| 150 return scoped_ptr<Buffer>(); | 151 return scoped_ptr<Buffer>(); |
| 151 EXPECT_EQ(expected_dropped_id_, buffer_id_to_drop); | 152 EXPECT_EQ(expected_dropped_id_, buffer_id_to_drop); |
| 152 | 153 |
| 153 scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle = | 154 scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle = |
| 154 pool_->GetBufferHandle(buffer_id); | 155 pool_->GetBufferHandle(buffer_id); |
| 155 return scoped_ptr<Buffer>( | 156 return scoped_ptr<Buffer>( |
| 156 new Buffer(pool_, buffer_handle.Pass(), buffer_id)); | 157 new Buffer(pool_, buffer_handle.Pass(), buffer_id)); |
| 157 } | 158 } |
| 158 | 159 |
| 160 base::MessageLoop loop_; |
| 159 int expected_dropped_id_; | 161 int expected_dropped_id_; |
| 160 scoped_refptr<VideoCaptureBufferPool> pool_; | 162 scoped_refptr<VideoCaptureBufferPool> pool_; |
| 161 | 163 |
| 162 private: | 164 private: |
| 163 #if !defined(OS_ANDROID) | 165 #if !defined(OS_ANDROID) |
| 164 scoped_ptr<StubBrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 166 scoped_ptr<StubBrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 165 scoped_ptr<MockBufferQueue> output_surface_; | 167 scoped_ptr<MockBufferQueue> output_surface_; |
| 166 #endif | 168 #endif |
| 167 | 169 |
| 168 DISALLOW_COPY_AND_ASSIGN(VideoCaptureBufferPoolTest); | 170 DISALLOW_COPY_AND_ASSIGN(VideoCaptureBufferPoolTest); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (buffer4->data() != nullptr) | 304 if (buffer4->data() != nullptr) |
| 303 memset(buffer4->data(), 0x77, buffer4->size()); | 305 memset(buffer4->data(), 0x77, buffer4->size()); |
| 304 buffer4.reset(); | 306 buffer4.reset(); |
| 305 } | 307 } |
| 306 | 308 |
| 307 INSTANTIATE_TEST_CASE_P(, | 309 INSTANTIATE_TEST_CASE_P(, |
| 308 VideoCaptureBufferPoolTest, | 310 VideoCaptureBufferPoolTest, |
| 309 testing::ValuesIn(kCaptureFormats)); | 311 testing::ValuesIn(kCaptureFormats)); |
| 310 | 312 |
| 311 } // namespace content | 313 } // namespace content |
| OLD | NEW |