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/single_thread_proxy.h" // For DebugScopedSetImplThread | |
14 #include "cc/solid_color_draw_quad.h" | 13 #include "cc/solid_color_draw_quad.h" |
15 #include "cc/test/animation_test_common.h" | 14 #include "cc/test/animation_test_common.h" |
16 #include "cc/test/fake_web_compositor_output_surface.h" | 15 #include "cc/test/fake_web_compositor_output_surface.h" |
17 #include "cc/test/fake_web_compositor_software_output_device.h" | 16 #include "cc/test/fake_web_compositor_software_output_device.h" |
18 #include "cc/test/geometry_test_utils.h" | 17 #include "cc/test/geometry_test_utils.h" |
19 #include "cc/test/render_pass_test_common.h" | 18 #include "cc/test/render_pass_test_common.h" |
20 #include "cc/test/test_common.h" | 19 #include "cc/test/test_common.h" |
21 #include "cc/tile_draw_quad.h" | 20 #include "cc/tile_draw_quad.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 19 matching lines...) Expand all Loading... |
43 void setViewportSize(gfx::Size viewportSize) { m_viewportSize = viewportSize
; } | 42 void setViewportSize(gfx::Size viewportSize) { m_viewportSize = viewportSize
; } |
44 | 43 |
45 // RendererClient implementation. | 44 // RendererClient implementation. |
46 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view
portSize; } | 45 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view
portSize; } |
47 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin
gs; } | 46 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin
gs; } |
48 virtual void didLoseContext() OVERRIDE { } | 47 virtual void didLoseContext() OVERRIDE { } |
49 virtual void onSwapBuffersComplete() OVERRIDE { } | 48 virtual void onSwapBuffersComplete() OVERRIDE { } |
50 virtual void setFullRootLayerDamage() OVERRIDE { } | 49 virtual void setFullRootLayerDamage() OVERRIDE { } |
51 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE { }; | 50 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE { }; |
52 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE { }; | 51 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE { }; |
| 52 virtual bool hasImplThread() const OVERRIDE { return false; } |
53 | 53 |
54 protected: | 54 protected: |
55 DebugScopedSetImplThread m_alwaysImplThread; | |
56 | |
57 scoped_ptr<FakeWebCompositorOutputSurface> m_outputSurface; | 55 scoped_ptr<FakeWebCompositorOutputSurface> m_outputSurface; |
58 scoped_ptr<ResourceProvider> m_resourceProvider; | 56 scoped_ptr<ResourceProvider> m_resourceProvider; |
59 scoped_ptr<SoftwareRenderer> m_renderer; | 57 scoped_ptr<SoftwareRenderer> m_renderer; |
60 gfx::Size m_viewportSize; | 58 gfx::Size m_viewportSize; |
61 LayerTreeSettings m_settings; | 59 LayerTreeSettings m_settings; |
62 }; | 60 }; |
63 | 61 |
64 TEST_F(SoftwareRendererTest, solidColorQuad) | 62 TEST_F(SoftwareRendererTest, solidColorQuad) |
65 { | 63 { |
66 gfx::Size outerSize(100, 100); | 64 gfx::Size outerSize(100, 100); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi
ceViewportSize().height()]); | 144 scoped_array<SkColor> pixels(new SkColor[deviceViewportSize().width() * devi
ceViewportSize().height()]); |
147 renderer()->getFramebufferPixels(pixels.get(), outerRect); | 145 renderer()->getFramebufferPixels(pixels.get(), outerRect); |
148 | 146 |
149 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); | 147 EXPECT_EQ(SK_ColorYELLOW, pixels[0]); |
150 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); | 148 EXPECT_EQ(SK_ColorYELLOW, pixels[outerPixels - 1]); |
151 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); | 149 EXPECT_EQ(SK_ColorCYAN, pixels[outerSize.width() + 1]); |
152 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); | 150 EXPECT_EQ(SK_ColorCYAN, pixels[outerPixels - outerSize.width() - 2]); |
153 } | 151 } |
154 | 152 |
155 } // anonymous namespace | 153 } // anonymous namespace |
OLD | NEW |