Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: cc/delegated_renderer_layer_impl_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address code review comments and fix all cc_unittests Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "CCDelegatedRendererLayerImpl.h" 7 #include "CCDelegatedRendererLayerImpl.h"
8 8
9 #include "CCAppendQuadsData.h" 9 #include "CCAppendQuadsData.h"
10 #include "cc/layer_tree_host_impl.h" 10 #include "cc/layer_tree_host_impl.h"
11 #include "cc/quad_sink.h" 11 #include "cc/quad_sink.h"
12 #include "cc/render_pass_draw_quad.h" 12 #include "cc/render_pass_draw_quad.h"
13 #include "cc/scoped_ptr_vector.h" 13 #include "cc/scoped_ptr_vector.h"
14 #include "cc/single_thread_proxy.h" 14 #include "cc/single_thread_proxy.h"
15 #include "cc/solid_color_draw_quad.h" 15 #include "cc/solid_color_draw_quad.h"
16 #include "cc/solid_color_layer_impl.h" 16 #include "cc/solid_color_layer_impl.h"
17 #include "cc/test/fake_proxy.h"
17 #include "cc/test/fake_web_compositor_output_surface.h" 18 #include "cc/test/fake_web_compositor_output_surface.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 <public/WebTransformationMatrix.h> 24 #include <public/WebTransformationMatrix.h>
24 25
25 using WebKit::FakeWebCompositorOutputSurface; 26 using WebKit::FakeWebCompositorOutputSurface;
26 using WebKit::FakeWebGraphicsContext3D; 27 using WebKit::FakeWebGraphicsContext3D;
27 using WebKit::WebTransformationMatrix; 28 using WebKit::WebTransformationMatrix;
28 29
29 using namespace cc; 30 using namespace cc;
30 using namespace WebKitTests; 31 using namespace WebKitTests;
31 32
32 namespace { 33 namespace {
33 34
34 class DelegatedRendererLayerImplTest : public testing::Test, public LayerTreeHos tImplClient { 35 class DelegatedRendererLayerImplTest : public testing::Test, public LayerTreeHos tImplClient {
35 public: 36 public:
36 DelegatedRendererLayerImplTest() 37 DelegatedRendererLayerImplTest()
38 : m_proxy(0)
39 , m_alwaysImplThreadAndMainThreadBlocked(&m_proxy)
37 { 40 {
38 LayerTreeSettings settings; 41 LayerTreeSettings settings;
39 settings.minimumOcclusionTrackingSize = IntSize(); 42 settings.minimumOcclusionTrackingSize = IntSize();
40 43
41 m_hostImpl = LayerTreeHostImpl::create(settings, this); 44 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
42 m_hostImpl->initializeRenderer(createContext()); 45 m_hostImpl->initializeRenderer(createContext());
43 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); 46 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
44 } 47 }
45 48
46 // LayerTreeHostImplClient implementation. 49 // LayerTreeHostImplClient implementation.
47 virtual void didLoseContextOnImplThread() OVERRIDE { } 50 virtual void didLoseContextOnImplThread() OVERRIDE { }
48 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } 51 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
49 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } 52 virtual void onVSyncParametersChanged(double, double) OVERRIDE { }
50 virtual void onCanDrawStateChanged(bool) OVERRIDE { } 53 virtual void onCanDrawStateChanged(bool) OVERRIDE { }
51 virtual void setNeedsRedrawOnImplThread() OVERRIDE { } 54 virtual void setNeedsRedrawOnImplThread() OVERRIDE { }
52 virtual void setNeedsCommitOnImplThread() OVERRIDE { } 55 virtual void setNeedsCommitOnImplThread() OVERRIDE { }
53 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, double wallClockTime) OVERRIDE { } 56 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, double wallClockTime) OVERRIDE { }
54 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return true; } 57 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return true; }
55 58
56 protected: 59 protected:
57 scoped_ptr<GraphicsContext> createContext() 60 scoped_ptr<GraphicsContext> createContext()
58 { 61 {
59 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); 62 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
60 } 63 }
61 64
62 DebugScopedSetImplThread m_alwaysImplThread; 65 FakeProxy m_proxy;
63 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; 66 DebugScopedSetImplThreadAndMainThreadBlocked m_alwaysImplThreadAndMainThread Blocked;
64
65 scoped_ptr<LayerTreeHostImpl> m_hostImpl; 67 scoped_ptr<LayerTreeHostImpl> m_hostImpl;
66 }; 68 };
67 69
68 static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend erPass::Id id, IntRect outputRect, WebTransformationMatrix rootTransform) 70 static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend erPass::Id id, IntRect outputRect, WebTransformationMatrix rootTransform)
69 { 71 {
70 scoped_ptr<TestRenderPass> pass(TestRenderPass::create(id, outputRect, rootT ransform)); 72 scoped_ptr<TestRenderPass> pass(TestRenderPass::create(id, outputRect, rootT ransform));
71 TestRenderPass* saved = pass.get(); 73 TestRenderPass* saved = pass.get();
72 passList.append(pass.PassAs<RenderPass>()); 74 passList.append(pass.PassAs<RenderPass>());
73 return saved; 75 return saved;
74 } 76 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 EXPECT_EQ(sharedState, quadList[3]->sharedQuadState()); 447 EXPECT_EQ(sharedState, quadList[3]->sharedQuadState());
446 448
447 // The state should be transformed only once. 449 // The state should be transformed only once.
448 EXPECT_RECT_EQ(IntRect(30, 30, 50, 50), sharedState->clippedRectInTarget); 450 EXPECT_RECT_EQ(IntRect(30, 30, 50, 50), sharedState->clippedRectInTarget);
449 WebTransformationMatrix expected; 451 WebTransformationMatrix expected;
450 expected.translate(30, 30); 452 expected.translate(30, 30);
451 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform); 453 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform);
452 } 454 }
453 455
454 } // namespace 456 } // namespace
OLDNEW
« no previous file with comments | « cc/damage_tracker_unittest.cc ('k') | cc/font_atlas.h » ('j') | cc/gl_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698