| 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/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "cc/output/compositor_frame_metadata.h" | 8 #include "cc/output/compositor_frame_metadata.h" |
| 9 #include "cc/output/gl_renderer.h" | 9 #include "cc/output/gl_renderer.h" |
| 10 #include "cc/output/output_surface.h" | 10 #include "cc/output/output_surface.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 void PixelTest::SetUp() { | 56 void PixelTest::SetUp() { |
| 57 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); | 57 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); |
| 58 | 58 |
| 59 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> | 59 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> |
| 60 context3d( | 60 context3d( |
| 61 new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl( | 61 new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl( |
| 62 WebKit::WebGraphicsContext3D::Attributes())); | 62 WebKit::WebGraphicsContext3D::Attributes())); |
| 63 output_surface_.reset(new OutputSurface( | 63 output_surface_.reset(new OutputSurface( |
| 64 context3d.PassAs<WebKit::WebGraphicsContext3D>())); | 64 context3d.PassAs<WebKit::WebGraphicsContext3D>())); |
| 65 resource_provider_ = ResourceProvider::Create(output_surface_.get()); | 65 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); |
| 66 fake_client_ = | 66 fake_client_ = |
| 67 make_scoped_ptr(new PixelTestRendererClient(device_viewport_size_)); | 67 make_scoped_ptr(new PixelTestRendererClient(device_viewport_size_)); |
| 68 renderer_ = GLRenderer::Create(fake_client_.get(), | 68 renderer_ = GLRenderer::Create(fake_client_.get(), |
| 69 output_surface_.get(), | 69 output_surface_.get(), |
| 70 resource_provider_.get()); | 70 resource_provider_.get(), |
| 71 0); |
| 71 | 72 |
| 72 scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts = | 73 scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts = |
| 73 webkit::gpu::ContextProviderInProcess::Create(); | 74 webkit::gpu::ContextProviderInProcess::Create(); |
| 74 ASSERT_TRUE(offscreen_contexts->BindToCurrentThread()); | 75 ASSERT_TRUE(offscreen_contexts->BindToCurrentThread()); |
| 75 resource_provider_->set_offscreen_context_provider(offscreen_contexts); | 76 resource_provider_->set_offscreen_context_provider(offscreen_contexts); |
| 76 } | 77 } |
| 77 | 78 |
| 78 bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file, | 79 bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file, |
| 79 const PixelComparator& comparator) { | 80 const PixelComparator& comparator) { |
| 80 gfx::Rect device_viewport_rect(device_viewport_size_); | 81 gfx::Rect device_viewport_rect(device_viewport_size_); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 91 if (!PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)) | 92 if (!PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)) |
| 92 return false; | 93 return false; |
| 93 | 94 |
| 94 // To rebaseline: | 95 // To rebaseline: |
| 95 // return WritePNGFile(bitmap, test_data_dir.Append(ref_file)); | 96 // return WritePNGFile(bitmap, test_data_dir.Append(ref_file)); |
| 96 | 97 |
| 97 return MatchesPNGFile(bitmap, test_data_dir.Append(ref_file), comparator); | 98 return MatchesPNGFile(bitmap, test_data_dir.Append(ref_file), comparator); |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace cc | 101 } // namespace cc |
| OLD | NEW |