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/delegated_renderer_layer_impl.h" | 5 #include "cc/delegated_renderer_layer_impl.h" |
6 | 6 |
7 #include "cc/append_quads_data.h" | 7 #include "cc/append_quads_data.h" |
8 #include "cc/layer_tree_host_impl.h" | 8 #include "cc/layer_tree_host_impl.h" |
9 #include "cc/quad_sink.h" | 9 #include "cc/quad_sink.h" |
10 #include "cc/render_pass_draw_quad.h" | 10 #include "cc/render_pass_draw_quad.h" |
11 #include "cc/scoped_ptr_vector.h" | 11 #include "cc/scoped_ptr_vector.h" |
12 #include "cc/single_thread_proxy.h" | 12 #include "cc/single_thread_proxy.h" |
13 #include "cc/solid_color_draw_quad.h" | 13 #include "cc/solid_color_draw_quad.h" |
14 #include "cc/solid_color_layer_impl.h" | 14 #include "cc/solid_color_layer_impl.h" |
15 #include "cc/test/fake_layer_tree_host_impl.h" | 15 #include "cc/test/fake_layer_tree_host_impl.h" |
| 16 #include "cc/test/fake_layer_tree_host_impl_client.h" |
16 #include "cc/test/fake_output_surface.h" | 17 #include "cc/test/fake_output_surface.h" |
17 #include "cc/test/fake_proxy.h" | 18 #include "cc/test/fake_proxy.h" |
18 #include "cc/test/fake_web_graphics_context_3d.h" | 19 #include "cc/test/fake_web_graphics_context_3d.h" |
19 #include "cc/test/geometry_test_utils.h" | 20 #include "cc/test/geometry_test_utils.h" |
20 #include "cc/test/mock_quad_culler.h" | 21 #include "cc/test/mock_quad_culler.h" |
21 #include "cc/test/render_pass_test_common.h" | 22 #include "cc/test/render_pass_test_common.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "ui/gfx/transform.h" | 24 #include "ui/gfx/transform.h" |
24 | 25 |
25 using WebKit::FakeWebGraphicsContext3D; | 26 using WebKit::FakeWebGraphicsContext3D; |
26 | 27 |
27 using namespace WebKitTests; | 28 using namespace WebKitTests; |
28 | 29 |
29 namespace cc { | 30 namespace cc { |
30 namespace { | 31 namespace { |
31 | 32 |
32 class DelegatedRendererLayerImplTest : public testing::Test, public LayerTreeHos
tImplClient { | 33 class DelegatedRendererLayerImplTest : public testing::Test { |
33 public: | 34 public: |
34 DelegatedRendererLayerImplTest() | 35 DelegatedRendererLayerImplTest() |
35 : m_proxy(scoped_ptr<Thread>(NULL)) | 36 : m_proxy(scoped_ptr<Thread>(NULL)) |
36 , m_alwaysImplThreadAndMainThreadBlocked(&m_proxy) | 37 , m_alwaysImplThreadAndMainThreadBlocked(&m_proxy) |
37 { | 38 { |
38 LayerTreeSettings settings; | 39 LayerTreeSettings settings; |
39 settings.minimumOcclusionTrackingSize = gfx::Size(); | 40 settings.minimumOcclusionTrackingSize = gfx::Size(); |
40 | 41 |
41 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); | 42 m_hostImpl = LayerTreeHostImpl::create(settings, &m_client, &m_proxy); |
42 m_hostImpl->initializeRenderer(createFakeOutputSurface()); | 43 m_hostImpl->initializeRenderer(createFakeOutputSurface()); |
43 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 44 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
44 } | 45 } |
45 | 46 |
46 // LayerTreeHostImplClient implementation. | |
47 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { } | |
48 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | |
49 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER
RIDE { } | |
50 virtual void onCanDrawStateChanged(bool) OVERRIDE { } | |
51 virtual void setNeedsRedrawOnImplThread() OVERRIDE { } | |
52 virtual void setNeedsCommitOnImplThread() OVERRIDE { } | |
53 virtual void setNeedsManageTilesOnImplThread() OVERRIDE { } | |
54 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE { } | |
55 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE { return true; } | |
56 virtual void sendManagedMemoryStats() OVERRIDE { } | |
57 | |
58 protected: | 47 protected: |
59 FakeProxy m_proxy; | 48 FakeProxy m_proxy; |
| 49 FakeLayerTreeHostImplClient m_client; |
60 DebugScopedSetImplThreadAndMainThreadBlocked m_alwaysImplThreadAndMainThread
Blocked; | 50 DebugScopedSetImplThreadAndMainThreadBlocked m_alwaysImplThreadAndMainThread
Blocked; |
61 scoped_ptr<LayerTreeHostImpl> m_hostImpl; | 51 scoped_ptr<LayerTreeHostImpl> m_hostImpl; |
62 }; | 52 }; |
63 | 53 |
64 static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend
erPass::Id id, gfx::Rect outputRect, gfx::Transform rootTransform) | 54 static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend
erPass::Id id, gfx::Rect outputRect, gfx::Transform rootTransform) |
65 { | 55 { |
66 scoped_ptr<TestRenderPass> pass(TestRenderPass::Create()); | 56 scoped_ptr<TestRenderPass> pass(TestRenderPass::Create()); |
67 pass->SetNew(id, outputRect, outputRect, rootTransform); | 57 pass->SetNew(id, outputRect, outputRect, rootTransform); |
68 TestRenderPass* saved = pass.get(); | 58 TestRenderPass* saved = pass.get(); |
69 passList.append(pass.PassAs<RenderPass>()); | 59 passList.append(pass.PassAs<RenderPass>()); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 gfx::Transform expected; | 490 gfx::Transform expected; |
501 expected.Translate(30, 30); | 491 expected.Translate(30, 30); |
502 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->content_to_target_tra
nsform); | 492 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->content_to_target_tra
nsform); |
503 | 493 |
504 m_hostImpl->drawLayers(frame); | 494 m_hostImpl->drawLayers(frame); |
505 m_hostImpl->didDrawAllLayers(frame); | 495 m_hostImpl->didDrawAllLayers(frame); |
506 } | 496 } |
507 | 497 |
508 } // namespace | 498 } // namespace |
509 } // namespace cc | 499 } // namespace cc |
OLD | NEW |