OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/gl_renderer.h" | 5 #include "cc/gl_renderer.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "cc/compositor_frame_metadata.h" |
9 #include "cc/draw_quad.h" | 10 #include "cc/draw_quad.h" |
10 #include "cc/prioritized_resource_manager.h" | 11 #include "cc/prioritized_resource_manager.h" |
11 #include "cc/resource_provider.h" | 12 #include "cc/resource_provider.h" |
12 #include "cc/test/paths.h" | 13 #include "cc/test/paths.h" |
13 #include "cc/test/pixel_test_output_surface.h" | 14 #include "cc/test/pixel_test_output_surface.h" |
14 #include "cc/test/pixel_test_utils.h" | 15 #include "cc/test/pixel_test_utils.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "ui/gfx/codec/png_codec.h" | 17 #include "ui/gfx/codec/png_codec.h" |
17 #include "ui/gl/gl_implementation.h" | 18 #include "ui/gl/gl_implementation.h" |
18 | 19 |
(...skipping 15 matching lines...) Expand all Loading... |
34 static LayerTreeSettings fake_settings; | 35 static LayerTreeSettings fake_settings; |
35 return fake_settings; | 36 return fake_settings; |
36 } | 37 } |
37 virtual void didLoseOutputSurface() OVERRIDE { } | 38 virtual void didLoseOutputSurface() OVERRIDE { } |
38 virtual void onSwapBuffersComplete() OVERRIDE { } | 39 virtual void onSwapBuffersComplete() OVERRIDE { } |
39 virtual void setFullRootLayerDamage() OVERRIDE { } | 40 virtual void setFullRootLayerDamage() OVERRIDE { } |
40 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy&) OVERRIDE {} | 41 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy&) OVERRIDE {} |
41 virtual void enforceManagedMemoryPolicy( | 42 virtual void enforceManagedMemoryPolicy( |
42 const ManagedMemoryPolicy&) OVERRIDE {} | 43 const ManagedMemoryPolicy&) OVERRIDE {} |
43 virtual bool hasImplThread() const OVERRIDE { return false; } | 44 virtual bool hasImplThread() const OVERRIDE { return false; } |
| 45 virtual CompositorFrameMetadata makeCompositorFrameMetadata() const |
| 46 OVERRIDE { return CompositorFrameMetadata(); } |
44 }; | 47 }; |
45 | 48 |
46 class GLRendererPixelTest : public testing::Test { | 49 class GLRendererPixelTest : public testing::Test { |
47 protected: | 50 protected: |
48 GLRendererPixelTest() {} | 51 GLRendererPixelTest() {} |
49 | 52 |
50 virtual void SetUp() { | 53 virtual void SetUp() { |
51 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); | 54 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); |
52 output_surface_ = PixelTestOutputSurface::create(); | 55 output_surface_ = PixelTestOutputSurface::create(); |
53 resource_provider_ = ResourceProvider::create(output_surface_.get()); | 56 resource_provider_ = ResourceProvider::create(output_surface_.get()); |
54 renderer_ = GLRenderer::create(&fake_client_, resource_provider_.get()); | 57 renderer_ = GLRenderer::create(&fake_client_, |
| 58 output_surface_.get(), |
| 59 resource_provider_.get()); |
55 } | 60 } |
56 | 61 |
57 bool PixelsMatchReference(FilePath ref_file, gfx::Rect viewport_rect) { | 62 bool PixelsMatchReference(FilePath ref_file, gfx::Rect viewport_rect) { |
58 SkBitmap bitmap; | 63 SkBitmap bitmap; |
59 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 64 bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
60 viewport_rect.width(), viewport_rect.height()); | 65 viewport_rect.width(), viewport_rect.height()); |
61 bitmap.allocPixels(); | 66 bitmap.allocPixels(); |
62 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); | 67 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); |
63 renderer_->getFramebufferPixels(pixels, viewport_rect); | 68 renderer_->getFramebufferPixels(pixels, viewport_rect); |
64 | 69 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 renderer_->decideRenderPassAllocationsForFrame(pass_list); | 191 renderer_->decideRenderPassAllocationsForFrame(pass_list); |
187 renderer_->drawFrame(pass_list, pass_map); | 192 renderer_->drawFrame(pass_list, pass_map); |
188 | 193 |
189 EXPECT_TRUE(PixelsMatchReference( | 194 EXPECT_TRUE(PixelsMatchReference( |
190 FilePath(FILE_PATH_LITERAL("blue_yellow.png")), viewport_rect)); | 195 FilePath(FILE_PATH_LITERAL("blue_yellow.png")), viewport_rect)); |
191 } | 196 } |
192 #endif | 197 #endif |
193 | 198 |
194 } // namespace | 199 } // namespace |
195 } // namespace cc | 200 } // namespace cc |
OLD | NEW |