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/compositor_frame_metadata.h" |
10 #include "cc/draw_quad.h" | 10 #include "cc/draw_quad.h" |
11 #include "cc/prioritized_resource_manager.h" | 11 #include "cc/prioritized_resource_manager.h" |
12 #include "cc/resource_provider.h" | 12 #include "cc/resource_provider.h" |
13 #include "cc/test/paths.h" | 13 #include "cc/test/paths.h" |
14 #include "cc/test/pixel_test_output_surface.h" | |
15 #include "cc/test/pixel_test_utils.h" | 14 #include "cc/test/pixel_test_utils.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/gfx/codec/png_codec.h" | 16 #include "ui/gfx/codec/png_codec.h" |
18 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
18 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 namespace { | 21 namespace { |
22 | 22 |
23 class FakeRendererClient : public RendererClient { | 23 class FakeRendererClient : public RendererClient { |
24 public: | 24 public: |
25 FakeRendererClient() | 25 FakeRendererClient() |
26 { | 26 { |
27 } | 27 } |
28 | 28 |
(...skipping 17 matching lines...) Expand all Loading... | |
46 virtual CompositorFrameMetadata makeCompositorFrameMetadata() const | 46 virtual CompositorFrameMetadata makeCompositorFrameMetadata() const |
47 OVERRIDE { return CompositorFrameMetadata(); } | 47 OVERRIDE { return CompositorFrameMetadata(); } |
48 }; | 48 }; |
49 | 49 |
50 class GLRendererPixelTest : public testing::Test { | 50 class GLRendererPixelTest : public testing::Test { |
51 protected: | 51 protected: |
52 GLRendererPixelTest() {} | 52 GLRendererPixelTest() {} |
53 | 53 |
54 virtual void SetUp() { | 54 virtual void SetUp() { |
55 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); | 55 gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); |
56 output_surface_ = PixelTestOutputSurface::create(); | 56 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> cont ext3d( |
57 new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl); | |
58 context3d->Initialize(WebKit::WebGraphicsContext3D::Attributes(), NULL); | |
59 output_surface_.reset(new OutputSurface( | |
60 context3d.PassAs<WebKit::WebGraphicsContext3D>())); | |
61 CHECK(context3d.get() == NULL); | |
danakj
2013/01/24 02:03:06
You don't need this unless you're trying to verify
| |
57 resource_provider_ = ResourceProvider::create(output_surface_.get()); | 62 resource_provider_ = ResourceProvider::create(output_surface_.get()); |
58 renderer_ = GLRenderer::create(&fake_client_, | 63 renderer_ = GLRenderer::create(&fake_client_, |
59 output_surface_.get(), | 64 output_surface_.get(), |
60 resource_provider_.get()); | 65 resource_provider_.get()); |
61 } | 66 } |
62 | 67 |
63 bool PixelsMatchReference(FilePath ref_file, gfx::Rect viewport_rect) { | 68 bool PixelsMatchReference(FilePath ref_file, gfx::Rect viewport_rect) { |
64 SkBitmap bitmap; | 69 SkBitmap bitmap; |
65 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 70 bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
66 viewport_rect.width(), viewport_rect.height()); | 71 viewport_rect.width(), viewport_rect.height()); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 renderer_->decideRenderPassAllocationsForFrame(pass_list); | 192 renderer_->decideRenderPassAllocationsForFrame(pass_list); |
188 renderer_->drawFrame(pass_list); | 193 renderer_->drawFrame(pass_list); |
189 | 194 |
190 EXPECT_TRUE(PixelsMatchReference( | 195 EXPECT_TRUE(PixelsMatchReference( |
191 FilePath(FILE_PATH_LITERAL("blue_yellow.png")), viewport_rect)); | 196 FilePath(FILE_PATH_LITERAL("blue_yellow.png")), viewport_rect)); |
192 } | 197 } |
193 #endif | 198 #endif |
194 | 199 |
195 } // namespace | 200 } // namespace |
196 } // namespace cc | 201 } // namespace cc |
OLD | NEW |