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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/software_renderer.h" | 7 #include "cc/software_renderer.h" |
8 | 8 |
9 #include "cc/quad_sink.h" | 9 #include "cc/quad_sink.h" |
10 #include "cc/render_pass.h" | 10 #include "cc/render_pass.h" |
11 #include "cc/render_pass_draw_quad.h" | 11 #include "cc/render_pass_draw_quad.h" |
12 #include "cc/settings.h" | 12 #include "cc/settings.h" |
13 #include "cc/solid_color_draw_quad.h" | 13 #include "cc/solid_color_draw_quad.h" |
14 #include "cc/test/animation_test_common.h" | 14 #include "cc/test/animation_test_common.h" |
15 #include "cc/test/fake_web_compositor_output_surface.h" | 15 #include "cc/test/fake_web_compositor_output_surface.h" |
16 #include "cc/test/fake_web_compositor_software_output_device.h" | 16 #include "cc/test/fake_web_compositor_software_output_device.h" |
17 #include "cc/test/geometry_test_utils.h" | 17 #include "cc/test/geometry_test_utils.h" |
18 #include "cc/test/render_pass_test_common.h" | 18 #include "cc/test/render_pass_test_common.h" |
19 #include "cc/test/test_common.h" | 19 #include "cc/test/test_common.h" |
20 #include "cc/tile_draw_quad.h" | 20 #include "cc/tile_draw_quad.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 using namespace cc; | |
25 using namespace WebKit; | 24 using namespace WebKit; |
26 using namespace WebKitTests; | 25 using namespace WebKitTests; |
27 | 26 |
| 27 namespace cc { |
28 namespace { | 28 namespace { |
29 | 29 |
30 class SoftwareRendererTest : public testing::Test, public RendererClient { | 30 class SoftwareRendererTest : public testing::Test, public RendererClient { |
31 public: | 31 public: |
32 void initializeRenderer() { | 32 void initializeRenderer() { |
33 m_outputSurface = FakeWebCompositorOutputSurface::createSoftware(scoped_
ptr<WebKit::WebCompositorSoftwareOutputDevice>(new FakeWebCompositorSoftwareOutp
utDevice)); | 33 m_outputSurface = FakeWebCompositorOutputSurface::createSoftware(scoped_
ptr<WebKit::WebCompositorSoftwareOutputDevice>(new FakeWebCompositorSoftwareOutp
utDevice)); |
34 m_resourceProvider = ResourceProvider::create(m_outputSurface.get()); | 34 m_resourceProvider = ResourceProvider::create(m_outputSurface.get()); |
35 m_renderer = SoftwareRenderer::create(this, resourceProvider(), software
Device()); | 35 m_renderer = SoftwareRenderer::create(this, resourceProvider(), software
Device()); |
36 } | 36 } |
37 | 37 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi
ceViewportSize().height()]); | 144 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi
ceViewportSize().height()]); |
145 renderer()->getFramebufferPixels(pixels.get(), outerRect); | 145 renderer()->getFramebufferPixels(pixels.get(), outerRect); |
146 | 146 |
147 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); | 147 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); |
148 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); | 148 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); |
149 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); | 149 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); |
150 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); | 150 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); |
151 } | 151 } |
152 | 152 |
153 } // anonymous namespace | 153 } // namespace |
| 154 } // namespace cc |
OLD | NEW |