| 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> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 namespace content { | 32 namespace content { |
| 33 | 33 |
| 34 struct PixelFormatAndStorage { | 34 struct PixelFormatAndStorage { |
| 35 media::VideoPixelFormat pixel_format; | 35 media::VideoPixelFormat pixel_format; |
| 36 media::VideoPixelStorage pixel_storage; | 36 media::VideoPixelStorage pixel_storage; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 static const PixelFormatAndStorage kCapturePixelFormatAndStorages[] = { | 39 static const PixelFormatAndStorage kCapturePixelFormatAndStorages[] = { |
| 40 {media::PIXEL_FORMAT_I420, media::PIXEL_STORAGE_CPU}, | 40 {media::PIXEL_FORMAT_I420, media::PIXEL_STORAGE_CPU}, |
| 41 {media::PIXEL_FORMAT_ARGB, media::PIXEL_STORAGE_CPU}, | 41 {media::PIXEL_FORMAT_ARGB, media::PIXEL_STORAGE_CPU}, |
| 42 {media::PIXEL_FORMAT_Y16, media::PIXEL_STORAGE_CPU}, |
| 42 #if !defined(OS_ANDROID) | 43 #if !defined(OS_ANDROID) |
| 43 {media::PIXEL_FORMAT_I420, | 44 {media::PIXEL_FORMAT_I420, media::PIXEL_STORAGE_GPUMEMORYBUFFER}, |
| 44 media::PIXEL_STORAGE_GPUMEMORYBUFFER}, | 45 // TODO(astojilj): Y16 on OSX/Linux is OK. Why Windows is fine with I420? |
| 46 {media::PIXEL_FORMAT_Y16, media::PIXEL_STORAGE_GPUMEMORYBUFFER}, |
| 45 #endif | 47 #endif |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 static const int kTestBufferPoolSize = 3; | 50 static const int kTestBufferPoolSize = 3; |
| 49 | 51 |
| 50 class VideoCaptureBufferPoolTest | 52 class VideoCaptureBufferPoolTest |
| 51 : public testing::TestWithParam<PixelFormatAndStorage> { | 53 : public testing::TestWithParam<PixelFormatAndStorage> { |
| 52 protected: | 54 protected: |
| 53 // A GpuMemoryBuffer Mock to provide a trivial RGBA buffer as Map() backing. | 55 // A GpuMemoryBuffer Mock to provide a trivial RGBA buffer as Map() backing. |
| 54 // We need to allocate on ctor and deallocate on dtor so that consecutive | 56 // We need to allocate on ctor and deallocate on dtor so that consecutive |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 ASSERT_NE(nullptr, held_buffers.back().get()); | 497 ASSERT_NE(nullptr, held_buffers.back().get()); |
| 496 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam()); | 498 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam()); |
| 497 ASSERT_EQ(nullptr, resurrected.get()); | 499 ASSERT_EQ(nullptr, resurrected.get()); |
| 498 } | 500 } |
| 499 | 501 |
| 500 INSTANTIATE_TEST_CASE_P(, | 502 INSTANTIATE_TEST_CASE_P(, |
| 501 VideoCaptureBufferPoolTest, | 503 VideoCaptureBufferPoolTest, |
| 502 testing::ValuesIn(kCapturePixelFormatAndStorages)); | 504 testing::ValuesIn(kCapturePixelFormatAndStorages)); |
| 503 | 505 |
| 504 } // namespace content | 506 } // namespace content |
| OLD | NEW |