| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
| 6 #include "base/memory/ref_counted_memory.h" | 6 #include "base/memory/ref_counted_memory.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
| 10 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "components/display_compositor/gl_helper.h" | 13 #include "components/display_compositor/gl_helper.h" |
| 14 #include "gpu/command_buffer/client/gles2_implementation.h" | 14 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 15 #include "gpu/command_buffer/client/shared_memory_limits.h" | 15 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 16 #include "gpu/ipc/common/surface_handle.h" |
| 16 #include "gpu/ipc/gl_in_process_context.h" | 17 #include "gpu/ipc/gl_in_process_context.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/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 21 #include "ui/gl/gl_implementation.h" | 22 #include "ui/gl/gl_implementation.h" |
| 22 | 23 |
| 23 namespace display_compositor { | 24 namespace display_compositor { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 int kYUVReadbackSizes[] = {2, 4, 14}; | 27 int kYUVReadbackSizes[] = {2, 4, 14}; |
| 27 } | 28 } |
| 28 | 29 |
| 29 class YUVReadbackTest : public testing::Test { | 30 class YUVReadbackTest : public testing::Test { |
| 30 protected: | 31 protected: |
| 31 void SetUp() override { | 32 void SetUp() override { |
| 32 gpu::gles2::ContextCreationAttribHelper attributes; | 33 gpu::gles2::ContextCreationAttribHelper attributes; |
| 33 attributes.alpha_size = 8; | 34 attributes.alpha_size = 8; |
| 34 attributes.depth_size = 24; | 35 attributes.depth_size = 24; |
| 35 attributes.red_size = 8; | 36 attributes.red_size = 8; |
| 36 attributes.green_size = 8; | 37 attributes.green_size = 8; |
| 37 attributes.blue_size = 8; | 38 attributes.blue_size = 8; |
| 38 attributes.stencil_size = 8; | 39 attributes.stencil_size = 8; |
| 39 attributes.samples = 4; | 40 attributes.samples = 4; |
| 40 attributes.sample_buffers = 1; | 41 attributes.sample_buffers = 1; |
| 41 attributes.bind_generates_resource = false; | 42 attributes.bind_generates_resource = false; |
| 42 | 43 |
| 43 context_.reset(gpu::GLInProcessContext::Create( | 44 context_.reset( |
| 44 nullptr, /* service */ | 45 gpu::GLInProcessContext::Create(nullptr, /* service */ |
| 45 nullptr, /* surface */ | 46 nullptr, /* surface */ |
| 46 true, /* offscreen */ | 47 true, /* offscreen */ |
| 47 gfx::kNullAcceleratedWidget, /* window */ | 48 gpu::kNullSurfaceHandle, /* window */ |
| 48 nullptr, /* share_context */ | 49 nullptr, /* share_context */ |
| 49 attributes, gpu::SharedMemoryLimits(), | 50 attributes, gpu::SharedMemoryLimits(), |
| 50 nullptr, /* gpu_memory_buffer_manager */ | 51 nullptr, /* gpu_memory_buffer_manager */ |
| 51 nullptr, /* image_factory */ | 52 nullptr, /* image_factory */ |
| 52 base::ThreadTaskRunnerHandle::Get())); | 53 base::ThreadTaskRunnerHandle::Get())); |
| 53 gl_ = context_->GetImplementation(); | 54 gl_ = context_->GetImplementation(); |
| 54 gpu::ContextSupport* support = context_->GetImplementation(); | 55 gpu::ContextSupport* support = context_->GetImplementation(); |
| 55 | 56 |
| 56 helper_.reset(new display_compositor::GLHelper(gl_, support)); | 57 helper_.reset(new display_compositor::GLHelper(gl_, support)); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void TearDown() override { | 60 void TearDown() override { |
| 60 helper_.reset(NULL); | 61 helper_.reset(NULL); |
| 61 context_.reset(NULL); | 62 context_.reset(NULL); |
| 62 } | 63 } |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 INSTANTIATE_TEST_CASE_P( | 549 INSTANTIATE_TEST_CASE_P( |
| 549 , | 550 , |
| 550 YUVReadbackPixelTest, | 551 YUVReadbackPixelTest, |
| 551 ::testing::Combine( | 552 ::testing::Combine( |
| 552 ::testing::Bool(), | 553 ::testing::Bool(), |
| 553 ::testing::Bool(), | 554 ::testing::Bool(), |
| 554 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)), | 555 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)), |
| 555 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)))); | 556 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)))); |
| 556 | 557 |
| 557 } // namespace display_compositor | 558 } // namespace display_compositor |
| OLD | NEW |