Index: content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc |
diff --git a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc |
index 1e82cd8078fcb93581522559a3da592528b82bf7..e51eb794a6cda1b0f98a5f52ff2e2454aeea5c00 100644 |
--- a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc |
+++ b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc |
@@ -22,18 +22,25 @@ |
namespace content { |
-static const media::VideoPixelFormat kCaptureFormats[] = { |
- media::PIXEL_FORMAT_I420, |
- media::PIXEL_FORMAT_TEXTURE, |
+struct PixelFormatAndStorage { |
+ media::VideoPixelFormat pixel_format; |
+ media::VideoPixelStorage pixel_storage; |
+}; |
+ |
+static const PixelFormatAndStorage kCapturePixelFormatAndStorages[] = { |
+ {media::PIXEL_FORMAT_I420, media::PIXEL_STORAGE_CPU}, |
+ {media::PIXEL_FORMAT_ARGB, media::PIXEL_STORAGE_CPU}, |
+ {media::PIXEL_FORMAT_ARGB, media::PIXEL_STORAGE_TEXTURE}, |
#if !defined(OS_ANDROID) |
- media::PIXEL_FORMAT_GPUMEMORYBUFFER |
+ {media::PIXEL_FORMAT_I420, media::PIXEL_STORAGE_GPUMEMORYBUFFER}, |
+ {media::PIXEL_FORMAT_ARGB, media::PIXEL_STORAGE_GPUMEMORYBUFFER}, |
#endif |
}; |
static const int kTestBufferPoolSize = 3; |
class VideoCaptureBufferPoolTest |
- : public testing::TestWithParam<media::VideoPixelFormat> { |
+ : public testing::TestWithParam<PixelFormatAndStorage> { |
protected: |
// A GpuMemoryBuffer Mock to provide a trivial RGBA buffer as Map() backing. |
// We need to allocate on ctor and deallocate on dtor so that consecutive |
@@ -140,14 +147,18 @@ class VideoCaptureBufferPoolTest |
} |
scoped_ptr<Buffer> ReserveBuffer(const gfx::Size& dimensions, |
- media::VideoPixelFormat pixel_format) { |
+ PixelFormatAndStorage format_and_storage) { |
// To verify that ReserveBuffer always sets |buffer_id_to_drop|, |
// initialize it to something different than the expected value. |
int buffer_id_to_drop = ~expected_dropped_id_; |
- DVLOG(1) << media::VideoCaptureFormat::PixelFormatToString(pixel_format) |
- << " " << dimensions.ToString(); |
- int buffer_id = |
- pool_->ReserveForProducer(pixel_format, dimensions, &buffer_id_to_drop); |
+ DVLOG(1) << media::VideoCaptureFormat::PixelStorageToString( |
+ format_and_storage.pixel_storage) << " " |
+ << media::VideoCaptureFormat::PixelFormatToString( |
+ format_and_storage.pixel_format) << " " |
+ << dimensions.ToString(); |
+ const int buffer_id = pool_->ReserveForProducer( |
+ format_and_storage.pixel_format, format_and_storage.pixel_storage, |
+ dimensions, &buffer_id_to_drop); |
if (buffer_id == VideoCaptureBufferPool::kInvalidId) |
return scoped_ptr<Buffer>(); |
EXPECT_EQ(expected_dropped_id_, buffer_id_to_drop); |
@@ -174,8 +185,10 @@ class VideoCaptureBufferPoolTest |
TEST_P(VideoCaptureBufferPoolTest, BufferPool) { |
const gfx::Size size_lo = gfx::Size(10, 10); |
const gfx::Size size_hi = gfx::Size(21, 33); |
- const media::VideoCaptureFormat format_lo(size_lo, 0.0, GetParam()); |
- const media::VideoCaptureFormat format_hi(size_hi, 0.0, GetParam()); |
+ const media::VideoCaptureFormat format_lo( |
+ size_lo, 0.0, GetParam().pixel_format, GetParam().pixel_storage); |
+ const media::VideoCaptureFormat format_hi( |
+ size_hi, 0.0, GetParam().pixel_format, GetParam().pixel_storage); |
// Reallocation won't happen for the first part of the test. |
ExpectDroppedId(VideoCaptureBufferPool::kInvalidId); |
@@ -198,7 +211,7 @@ TEST_P(VideoCaptureBufferPoolTest, BufferPool) { |
ASSERT_EQ(3.0 / kTestBufferPoolSize, pool_->GetBufferPoolUtilization()); |
// Texture backed Frames cannot be manipulated via mapping. |
- if (GetParam() != media::PIXEL_FORMAT_TEXTURE) { |
+ if (GetParam().pixel_storage != media::PIXEL_STORAGE_TEXTURE) { |
ASSERT_NE(nullptr, buffer1->data()); |
ASSERT_NE(nullptr, buffer2->data()); |
ASSERT_NE(nullptr, buffer3->data()); |
@@ -339,6 +352,6 @@ TEST_P(VideoCaptureBufferPoolTest, BufferPool) { |
INSTANTIATE_TEST_CASE_P(, |
VideoCaptureBufferPoolTest, |
- testing::ValuesIn(kCaptureFormats)); |
+ testing::ValuesIn(kCapturePixelFormatAndStorages)); |
} // namespace content |