| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "cc/test/pixel_test.h" | 5 #include "cc/test/pixel_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "cc/base/switches.h" | 10 #include "cc/base/switches.h" |
| 11 #include "cc/output/compositor_frame_metadata.h" | 11 #include "cc/output/compositor_frame_metadata.h" |
| 12 #include "cc/output/copy_output_request.h" | 12 #include "cc/output/copy_output_request.h" |
| 13 #include "cc/output/copy_output_result.h" | 13 #include "cc/output/copy_output_result.h" |
| 14 #include "cc/output/gl_renderer.h" | 14 #include "cc/output/gl_renderer.h" |
| 15 #include "cc/output/output_surface_client.h" | 15 #include "cc/output/output_surface_client.h" |
| 16 #include "cc/output/software_renderer.h" | 16 #include "cc/output/software_renderer.h" |
| 17 #include "cc/resources/resource_provider.h" | 17 #include "cc/resources/resource_provider.h" |
| 18 #include "cc/resources/texture_mailbox_deleter.h" | 18 #include "cc/resources/texture_mailbox_deleter.h" |
| 19 #include "cc/test/fake_output_surface_client.h" | 19 #include "cc/test/fake_output_surface_client.h" |
| 20 #include "cc/test/paths.h" | 20 #include "cc/test/paths.h" |
| 21 #include "cc/test/pixel_test_output_surface.h" | 21 #include "cc/test/pixel_test_output_surface.h" |
| 22 #include "cc/test/pixel_test_software_output_device.h" | 22 #include "cc/test/pixel_test_software_output_device.h" |
| 23 #include "cc/test/pixel_test_utils.h" | 23 #include "cc/test/pixel_test_utils.h" |
| 24 #include "cc/test/test_in_process_context_provider.h" | 24 #include "cc/test/test_in_process_context_provider.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 #include "ui/gl/gl_implementation.h" |
| 26 | 27 |
| 27 namespace cc { | 28 namespace cc { |
| 28 | 29 |
| 29 PixelTest::PixelTest() | 30 PixelTest::PixelTest() |
| 30 : device_viewport_size_(gfx::Size(200, 200)), | 31 : device_viewport_size_(gfx::Size(200, 200)), |
| 31 disable_picture_quad_image_filtering_(false), | 32 disable_picture_quad_image_filtering_(false), |
| 32 output_surface_client_(new FakeOutputSurfaceClient) {} | 33 output_surface_client_(new FakeOutputSurfaceClient) {} |
| 33 | 34 |
| 34 PixelTest::~PixelTest() {} | 35 PixelTest::~PixelTest() {} |
| 35 | 36 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 111 |
| 111 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 112 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 112 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests)) | 113 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests)) |
| 113 return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true); | 114 return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true); |
| 114 | 115 |
| 115 return MatchesPNGFile( | 116 return MatchesPNGFile( |
| 116 *result_bitmap_, test_data_dir.Append(ref_file), comparator); | 117 *result_bitmap_, test_data_dir.Append(ref_file), comparator); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) { | 120 void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) { |
| 121 CHECK(gfx::InitializeStaticGLBindings(gfx::kGLImplementationOSMesaGL)); |
| 122 |
| 120 output_surface_.reset( | 123 output_surface_.reset( |
| 121 new PixelTestOutputSurface(new TestInProcessContextProvider)); | 124 new PixelTestOutputSurface(new TestInProcessContextProvider)); |
| 122 output_surface_->BindToClient(output_surface_client_.get()); | 125 output_surface_->BindToClient(output_surface_client_.get()); |
| 123 | 126 |
| 124 resource_provider_ = | 127 resource_provider_ = |
| 125 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); | 128 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); |
| 126 | 129 |
| 127 texture_mailbox_deleter_ = make_scoped_ptr(new TextureMailboxDeleter); | 130 texture_mailbox_deleter_ = make_scoped_ptr(new TextureMailboxDeleter); |
| 128 | 131 |
| 129 renderer_ = GLRenderer::Create(this, | 132 renderer_ = GLRenderer::Create(this, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 output_surface_.reset(new PixelTestOutputSurface(device.Pass())); | 165 output_surface_.reset(new PixelTestOutputSurface(device.Pass())); |
| 163 output_surface_->BindToClient(output_surface_client_.get()); | 166 output_surface_->BindToClient(output_surface_client_.get()); |
| 164 resource_provider_ = | 167 resource_provider_ = |
| 165 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); | 168 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); |
| 166 renderer_ = SoftwareRenderer::Create( | 169 renderer_ = SoftwareRenderer::Create( |
| 167 this, &settings_, output_surface_.get(), resource_provider_.get()) | 170 this, &settings_, output_surface_.get(), resource_provider_.get()) |
| 168 .PassAs<DirectRenderer>(); | 171 .PassAs<DirectRenderer>(); |
| 169 } | 172 } |
| 170 | 173 |
| 171 } // namespace cc | 174 } // namespace cc |
| OLD | NEW |