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" |
11 #include "cc/resources/resource_provider.h" | 11 #include "cc/resources/resource_provider.h" |
12 #include "cc/test/paths.h" | 12 #include "cc/test/paths.h" |
13 #include "cc/test/pixel_test_utils.h" | 13 #include "cc/test/pixel_test_utils.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/gl/gl_implementation.h" | 15 #include "ui/gl/gl_implementation.h" |
16 #include "webkit/gpu/context_provider_in_process.h" | 16 #include "webkit/gpu/context_provider_in_process.h" |
17 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 17 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 class PixelTest::PixelTestRendererClient : public RendererClient { | 21 class PixelTest::PixelTestRendererClient : public RendererClient { |
22 public: | 22 public: |
23 PixelTestRendererClient(gfx::Size device_viewport_size) | 23 explicit PixelTestRendererClient(gfx::Size device_viewport_size) |
24 : device_viewport_size_(device_viewport_size) {} | 24 : device_viewport_size_(device_viewport_size) {} |
25 | 25 |
26 // RendererClient implementation. | 26 // RendererClient implementation. |
27 virtual gfx::Size DeviceViewportSize() const OVERRIDE { | 27 virtual gfx::Size DeviceViewportSize() const OVERRIDE { |
28 return device_viewport_size_; | 28 return device_viewport_size_; |
29 } | 29 } |
30 virtual const LayerTreeSettings& Settings() const OVERRIDE { | 30 virtual const LayerTreeSettings& Settings() const OVERRIDE { |
31 return settings_; | 31 return settings_; |
32 } | 32 } |
33 virtual void DidLoseOutputSurface() OVERRIDE {} | 33 virtual void DidLoseOutputSurface() OVERRIDE {} |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 device_viewport_rect.height()); | 84 device_viewport_rect.height()); |
85 bitmap.allocPixels(); | 85 bitmap.allocPixels(); |
86 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); | 86 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); |
87 renderer_->GetFramebufferPixels(pixels, device_viewport_rect); | 87 renderer_->GetFramebufferPixels(pixels, device_viewport_rect); |
88 | 88 |
89 base::FilePath test_data_dir; | 89 base::FilePath test_data_dir; |
90 if (!PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)) | 90 if (!PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)) |
91 return false; | 91 return false; |
92 | 92 |
93 // To rebaseline: | 93 // To rebaseline: |
94 //return WritePNGFile(bitmap, test_data_dir.Append(ref_file)); | 94 // return WritePNGFile(bitmap, test_data_dir.Append(ref_file)); |
95 | 95 |
96 return IsSameAsPNGFile(bitmap, test_data_dir.Append(ref_file)); | 96 return IsSameAsPNGFile(bitmap, test_data_dir.Append(ref_file)); |
97 } | 97 } |
98 | 98 |
99 } // namespace cc | 99 } // namespace cc |
OLD | NEW |