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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 165444 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_tree_host_impl.h" 7 #include "cc/layer_tree_host_impl.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "cc/delegated_renderer_layer_impl.h" 12 #include "cc/delegated_renderer_layer_impl.h"
13 #include "cc/gl_renderer.h" 13 #include "cc/gl_renderer.h"
14 #include "cc/heads_up_display_layer_impl.h" 14 #include "cc/heads_up_display_layer_impl.h"
15 #include "cc/io_surface_layer_impl.h" 15 #include "cc/io_surface_layer_impl.h"
16 #include "cc/layer_impl.h" 16 #include "cc/layer_impl.h"
17 #include "cc/layer_tiling_data.h" 17 #include "cc/layer_tiling_data.h"
18 #include "cc/quad_sink.h" 18 #include "cc/quad_sink.h"
19 #include "cc/render_pass_draw_quad.h" 19 #include "cc/render_pass_draw_quad.h"
20 #include "cc/scrollbar_geometry_fixed_thumb.h" 20 #include "cc/scrollbar_geometry_fixed_thumb.h"
21 #include "cc/scrollbar_layer_impl.h" 21 #include "cc/scrollbar_layer_impl.h"
22 #include "cc/settings.h" 22 #include "cc/settings.h"
23 #include "cc/single_thread_proxy.h" 23 #include "cc/single_thread_proxy.h"
24 #include "cc/solid_color_draw_quad.h" 24 #include "cc/solid_color_draw_quad.h"
25 #include "cc/test/animation_test_common.h" 25 #include "cc/test/animation_test_common.h"
26 #include "cc/test/fake_proxy.h"
26 #include "cc/test/fake_web_compositor_output_surface.h" 27 #include "cc/test/fake_web_compositor_output_surface.h"
27 #include "cc/test/fake_web_graphics_context_3d.h" 28 #include "cc/test/fake_web_graphics_context_3d.h"
28 #include "cc/test/fake_web_scrollbar_theme_geometry.h" 29 #include "cc/test/fake_web_scrollbar_theme_geometry.h"
29 #include "cc/test/geometry_test_utils.h" 30 #include "cc/test/geometry_test_utils.h"
30 #include "cc/test/layer_test_common.h" 31 #include "cc/test/layer_test_common.h"
31 #include "cc/test/render_pass_test_common.h" 32 #include "cc/test/render_pass_test_common.h"
32 #include "cc/test/test_common.h" 33 #include "cc/test/test_common.h"
33 #include "cc/texture_draw_quad.h" 34 #include "cc/texture_draw_quad.h"
34 #include "cc/texture_layer_impl.h" 35 #include "cc/texture_layer_impl.h"
35 #include "cc/tile_draw_quad.h" 36 #include "cc/tile_draw_quad.h"
(...skipping 20 matching lines...) Expand all
56 using ::testing::_; 57 using ::testing::_;
57 58
58 namespace { 59 namespace {
59 60
60 // This test is parametrized to run all tests with the 61 // This test is parametrized to run all tests with the
61 // Settings::pageScalePinchZoomEnabled field enabled and disabled. 62 // Settings::pageScalePinchZoomEnabled field enabled and disabled.
62 class LayerTreeHostImplTest : public testing::TestWithParam<bool>, 63 class LayerTreeHostImplTest : public testing::TestWithParam<bool>,
63 public LayerTreeHostImplClient { 64 public LayerTreeHostImplClient {
64 public: 65 public:
65 LayerTreeHostImplTest() 66 LayerTreeHostImplTest()
66 : m_onCanDrawStateChangedCalled(false) 67 : m_proxy(scoped_ptr<Thread>(NULL))
68 , m_alwaysImplThread(&m_proxy)
69 , m_alwaysMainThreadBlocked(&m_proxy)
70 , m_onCanDrawStateChangedCalled(false)
67 , m_didRequestCommit(false) 71 , m_didRequestCommit(false)
68 , m_didRequestRedraw(false) 72 , m_didRequestRedraw(false)
69 , m_reduceMemoryResult(true) 73 , m_reduceMemoryResult(true)
70 { 74 {
71 media::InitializeMediaLibraryForTesting(); 75 media::InitializeMediaLibraryForTesting();
72 } 76 }
73 77
74 virtual void SetUp() 78 virtual void SetUp()
75 { 79 {
76 Settings::setPageScalePinchZoomEnabled(GetParam()); 80 Settings::setPageScalePinchZoomEnabled(GetParam());
77 LayerTreeSettings settings; 81 LayerTreeSettings settings;
78 settings.minimumOcclusionTrackingSize = gfx::Size(); 82 settings.minimumOcclusionTrackingSize = gfx::Size();
79 83
80 m_hostImpl = LayerTreeHostImpl::create(settings, this); 84 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
81 m_hostImpl->initializeRenderer(createContext()); 85 m_hostImpl->initializeRenderer(createContext());
82 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 86 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
83 } 87 }
84 88
85 virtual void TearDown() 89 virtual void TearDown()
86 { 90 {
87 } 91 }
88 92
89 virtual void didLoseContextOnImplThread() OVERRIDE { } 93 virtual void didLoseContextOnImplThread() OVERRIDE { }
90 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } 94 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
91 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER RIDE { } 95 virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVER RIDE { }
92 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState ChangedCalled = true; } 96 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState ChangedCalled = true; }
93 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr ue; } 97 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr ue; }
94 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr ue; } 98 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr ue; }
95 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, base::Time wallClockTime) OVERRIDE { } 99 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, base::Time wallClockTime) OVERRIDE { }
96 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } 100 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; }
97 virtual void sendManagedMemoryStats() OVERRIDE { } 101 virtual void sendManagedMemoryStats() OVERRIDE { }
98 102
99 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; } 103 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; }
100 104
101 scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_p tr<GraphicsContext> graphicsContext, scoped_ptr<LayerImpl> root) 105 scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_p tr<GraphicsContext> graphicsContext, scoped_ptr<LayerImpl> root)
102 { 106 {
103 Settings::setPartialSwapEnabled(partialSwap); 107 Settings::setPartialSwapEnabled(partialSwap);
104 108
105 LayerTreeSettings settings; 109 LayerTreeSettings settings;
106 settings.minimumOcclusionTrackingSize = gfx::Size(); 110 settings.minimumOcclusionTrackingSize = gfx::Size();
107 111
108 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this); 112 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this, &m_proxy);
109 113
110 myHostImpl->initializeRenderer(graphicsContext.Pass()); 114 myHostImpl->initializeRenderer(graphicsContext.Pass());
111 myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 115 myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
112 116
113 root->setAnchorPoint(gfx::PointF(0, 0)); 117 root->setAnchorPoint(gfx::PointF(0, 0));
114 root->setPosition(gfx::PointF(0, 0)); 118 root->setPosition(gfx::PointF(0, 0));
115 root->setBounds(gfx::Size(10, 10)); 119 root->setBounds(gfx::Size(10, 10));
116 root->setContentBounds(gfx::Size(10, 10)); 120 root->setContentBounds(gfx::Size(10, 10));
117 root->setVisibleContentRect(gfx::Rect(0, 0, 10, 10)); 121 root->setVisibleContentRect(gfx::Rect(0, 0, 10, 10));
118 root->setDrawsContent(true); 122 root->setDrawsContent(true);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 m_hostImpl->drawLayers(frame); 186 m_hostImpl->drawLayers(frame);
183 m_hostImpl->didDrawAllLayers(frame); 187 m_hostImpl->didDrawAllLayers(frame);
184 } 188 }
185 189
186 protected: 190 protected:
187 scoped_ptr<GraphicsContext> createContext() 191 scoped_ptr<GraphicsContext> createContext()
188 { 192 {
189 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); 193 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
190 } 194 }
191 195
196 FakeProxy m_proxy;
192 DebugScopedSetImplThread m_alwaysImplThread; 197 DebugScopedSetImplThread m_alwaysImplThread;
193 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; 198 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked;
194 199
195 scoped_ptr<LayerTreeHostImpl> m_hostImpl; 200 scoped_ptr<LayerTreeHostImpl> m_hostImpl;
196 bool m_onCanDrawStateChangedCalled; 201 bool m_onCanDrawStateChangedCalled;
197 bool m_didRequestCommit; 202 bool m_didRequestCommit;
198 bool m_didRequestRedraw; 203 bool m_didRequestRedraw;
199 bool m_reduceMemoryResult; 204 bool m_reduceMemoryResult;
200 ScopedSettings m_scopedSettings; 205 ScopedSettings m_scopedSettings;
201 }; 206 };
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 350
346 TEST_P(LayerTreeHostImplTest, scrollWithoutRootLayer) 351 TEST_P(LayerTreeHostImplTest, scrollWithoutRootLayer)
347 { 352 {
348 // We should not crash when trying to scroll an empty layer tree. 353 // We should not crash when trying to scroll an empty layer tree.
349 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored); 354 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored);
350 } 355 }
351 356
352 TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer) 357 TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer)
353 { 358 {
354 LayerTreeSettings settings; 359 LayerTreeSettings settings;
355 m_hostImpl = LayerTreeHostImpl::create(settings, this); 360 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
356 361
357 // Initialization will fail here. 362 // Initialization will fail here.
358 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>()); 363 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>());
359 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 364 m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
360 365
361 setupScrollAndContentsLayers(gfx::Size(100, 100)); 366 setupScrollAndContentsLayers(gfx::Size(100, 100));
362 367
363 // We should not crash when trying to scroll after the renderer initializati on fails. 368 // We should not crash when trying to scroll after the renderer initializati on fails.
364 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored); 369 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored);
365 } 370 }
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 // where it should request to swap only the subBuffer that is damaged. 1946 // where it should request to swap only the subBuffer that is damaged.
1942 TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) 1947 TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
1943 { 1948 {
1944 scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface:: create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)). PassAs<GraphicsContext>(); 1949 scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface:: create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)). PassAs<GraphicsContext>();
1945 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->context3D()); 1950 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->context3D());
1946 1951
1947 // This test creates its own LayerTreeHostImpl, so 1952 // This test creates its own LayerTreeHostImpl, so
1948 // that we can force partial swap enabled. 1953 // that we can force partial swap enabled.
1949 LayerTreeSettings settings; 1954 LayerTreeSettings settings;
1950 Settings::setPartialSwapEnabled(true); 1955 Settings::setPartialSwapEnabled(true);
1951 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this); 1956 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this, &m_proxy);
1952 layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); 1957 layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
1953 layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)) ; 1958 layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)) ;
1954 1959
1955 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); 1960 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
1956 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); 1961 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2);
1957 child->setPosition(gfx::PointF(12, 13)); 1962 child->setPosition(gfx::PointF(12, 13));
1958 child->setAnchorPoint(gfx::PointF(0, 0)); 1963 child->setAnchorPoint(gfx::PointF(0, 0));
1959 child->setBounds(gfx::Size(14, 15)); 1964 child->setBounds(gfx::Size(14, 15));
1960 child->setContentBounds(gfx::Size(14, 15)); 1965 child->setContentBounds(gfx::Size(14, 15));
1961 child->setDrawsContent(true); 1966 child->setDrawsContent(true);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 } 2226 }
2222 2227
2223 // Unlimited texture size. 2228 // Unlimited texture size.
2224 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) 2229 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value)
2225 { 2230 {
2226 if (pname == GL_MAX_TEXTURE_SIZE) 2231 if (pname == GL_MAX_TEXTURE_SIZE)
2227 *value = 8192; 2232 *value = 8192;
2228 } 2233 }
2229 }; 2234 };
2230 2235
2231 static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay erTreeHostImplClient* client) 2236 static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay erTreeHostImplClient* client, Proxy* proxy)
2232 { 2237 {
2233 Settings::setPartialSwapEnabled(partialSwap); 2238 Settings::setPartialSwapEnabled(partialSwap);
2234 2239
2235 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 2240 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>();
2236 2241
2237 LayerTreeSettings settings; 2242 LayerTreeSettings settings;
2238 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, client); 2243 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, client, proxy);
2239 myHostImpl->initializeRenderer(context.Pass()); 2244 myHostImpl->initializeRenderer(context.Pass());
2240 myHostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); 2245 myHostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
2241 2246
2242 /* 2247 /*
2243 Layers are created as follows: 2248 Layers are created as follows:
2244 2249
2245 +--------------------+ 2250 +--------------------+
2246 | 1 | 2251 | 1 |
2247 | +-----------+ | 2252 | +-----------+ |
2248 | | 2 | | 2253 | | 2 | |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 2296
2292 child->addChild(grandChild.Pass()); 2297 child->addChild(grandChild.Pass());
2293 root->addChild(child.Pass()); 2298 root->addChild(child.Pass());
2294 2299
2295 myHostImpl->setRootLayer(root.Pass()); 2300 myHostImpl->setRootLayer(root.Pass());
2296 return myHostImpl.Pass(); 2301 return myHostImpl.Pass();
2297 } 2302 }
2298 2303
2299 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) 2304 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap)
2300 { 2305 {
2301 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this) ; 2306 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this, &m_proxy);
2302 2307
2303 { 2308 {
2304 LayerTreeHostImpl::FrameData frame; 2309 LayerTreeHostImpl::FrameData frame;
2305 EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); 2310 EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
2306 2311
2307 // Just for consistency, the most interesting stuff already happened 2312 // Just for consistency, the most interesting stuff already happened
2308 myHostImpl->drawLayers(frame); 2313 myHostImpl->drawLayers(frame);
2309 myHostImpl->didDrawAllLayers(frame); 2314 myHostImpl->didDrawAllLayers(frame);
2310 2315
2311 // Verify all quads have been computed 2316 // Verify all quads have been computed
2312 ASSERT_EQ(2U, frame.renderPasses.size()); 2317 ASSERT_EQ(2U, frame.renderPasses.size());
2313 ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size()); 2318 ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size());
2314 ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size()); 2319 ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size());
2315 EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->ma terial()); 2320 EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->ma terial());
2316 EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->ma terial()); 2321 EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->ma terial());
2317 } 2322 }
2318 } 2323 }
2319 2324
2320 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) 2325 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap)
2321 { 2326 {
2322 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this ); 2327 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this , &m_proxy);
2323 2328
2324 { 2329 {
2325 LayerTreeHostImpl::FrameData frame; 2330 LayerTreeHostImpl::FrameData frame;
2326 EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); 2331 EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
2327 2332
2328 // Just for consistency, the most interesting stuff already happened 2333 // Just for consistency, the most interesting stuff already happened
2329 myHostImpl->drawLayers(frame); 2334 myHostImpl->drawLayers(frame);
2330 myHostImpl->didDrawAllLayers(frame); 2335 myHostImpl->didDrawAllLayers(frame);
2331 2336
2332 // Verify all quads have been computed 2337 // Verify all quads have been computed
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 m_hostImpl->initializeRenderer(createContext()); 2383 m_hostImpl->initializeRenderer(createContext());
2379 2384
2380 EXPECT_TRUE(root->didLoseContextCalled()); 2385 EXPECT_TRUE(root->didLoseContextCalled());
2381 EXPECT_TRUE(layer1->didLoseContextCalled()); 2386 EXPECT_TRUE(layer1->didLoseContextCalled());
2382 EXPECT_TRUE(layer2->didLoseContextCalled()); 2387 EXPECT_TRUE(layer2->didLoseContextCalled());
2383 } 2388 }
2384 2389
2385 TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost) 2390 TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost)
2386 { 2391 {
2387 LayerTreeSettings settings; 2392 LayerTreeSettings settings;
2388 m_hostImpl = LayerTreeHostImpl::create(settings, this); 2393 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
2389 2394
2390 // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. 2395 // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
2391 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>()); 2396 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>());
2392 m_hostImpl->finishAllRendering(); 2397 m_hostImpl->finishAllRendering();
2393 } 2398 }
2394 2399
2395 class FakeWebGraphicsContext3DMakeCurrentFailsEventually : public FakeWebGraphic sContext3D { 2400 class FakeWebGraphicsContext3DMakeCurrentFailsEventually : public FakeWebGraphic sContext3D {
2396 public: 2401 public:
2397 explicit FakeWebGraphicsContext3DMakeCurrentFailsEventually(unsigned succeed Count) : m_succeedCount(succeedCount) { } 2402 explicit FakeWebGraphicsContext3DMakeCurrentFailsEventually(unsigned succeed Count) : m_succeedCount(succeedCount) { }
2398 virtual bool makeContextCurrent() { 2403 virtual bool makeContextCurrent() {
2399 if (!m_succeedCount) 2404 if (!m_succeedCount)
2400 return false; 2405 return false;
2401 --m_succeedCount; 2406 --m_succeedCount;
2402 return true; 2407 return true;
2403 } 2408 }
2404 2409
2405 private: 2410 private:
2406 unsigned m_succeedCount; 2411 unsigned m_succeedCount;
2407 }; 2412 };
2408 2413
2409 TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize) 2414 TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize)
2410 { 2415 {
2411 LayerTreeSettings settings; 2416 LayerTreeSettings settings;
2412 m_hostImpl = LayerTreeHostImpl::create(settings, this); 2417 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
2413 2418
2414 // Initialize into a known successful state. 2419 // Initialize into a known successful state.
2415 EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); 2420 EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext()));
2416 EXPECT_TRUE(m_hostImpl->context()); 2421 EXPECT_TRUE(m_hostImpl->context());
2417 EXPECT_TRUE(m_hostImpl->renderer()); 2422 EXPECT_TRUE(m_hostImpl->renderer());
2418 EXPECT_TRUE(m_hostImpl->resourceProvider()); 2423 EXPECT_TRUE(m_hostImpl->resourceProvider());
2419 2424
2420 // We will make the context get lost after a numer of makeContextCurrent 2425 // We will make the context get lost after a numer of makeContextCurrent
2421 // calls. The exact number of calls to make it succeed is dependent on the 2426 // calls. The exact number of calls to make it succeed is dependent on the
2422 // implementation and doesn't really matter (i.e. can be changed to make the 2427 // implementation and doesn't really matter (i.e. can be changed to make the
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
3013 public: 3018 public:
3014 using GLRenderer::releaseRenderPassTextures; 3019 using GLRenderer::releaseRenderPassTextures;
3015 }; 3020 };
3016 3021
3017 TEST_P(LayerTreeHostImplTest, textureCachingWithClipping) 3022 TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
3018 { 3023 {
3019 Settings::setPartialSwapEnabled(true); 3024 Settings::setPartialSwapEnabled(true);
3020 3025
3021 LayerTreeSettings settings; 3026 LayerTreeSettings settings;
3022 settings.minimumOcclusionTrackingSize = gfx::Size(); 3027 settings.minimumOcclusionTrackingSize = gfx::Size();
3023 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3028 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3024 3029
3025 LayerImpl* rootPtr; 3030 LayerImpl* rootPtr;
3026 LayerImpl* surfaceLayerPtr; 3031 LayerImpl* surfaceLayerPtr;
3027 3032
3028 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 3033 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>();
3029 3034
3030 gfx::Size rootSize(100, 100); 3035 gfx::Size rootSize(100, 100);
3031 3036
3032 myHostImpl->initializeRenderer(context.Pass()); 3037 myHostImpl->initializeRenderer(context.Pass());
3033 myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height())); 3038 myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
3110 myHostImpl->didDrawAllLayers(frame); 3115 myHostImpl->didDrawAllLayers(frame);
3111 } 3116 }
3112 } 3117 }
3113 3118
3114 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion) 3119 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
3115 { 3120 {
3116 Settings::setPartialSwapEnabled(false); 3121 Settings::setPartialSwapEnabled(false);
3117 3122
3118 LayerTreeSettings settings; 3123 LayerTreeSettings settings;
3119 settings.minimumOcclusionTrackingSize = gfx::Size(); 3124 settings.minimumOcclusionTrackingSize = gfx::Size();
3120 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3125 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3121 3126
3122 // Layers are structure as follows: 3127 // Layers are structure as follows:
3123 // 3128 //
3124 // R +-- S1 +- L10 (owning) 3129 // R +-- S1 +- L10 (owning)
3125 // | +- L11 3130 // | +- L11
3126 // | +- L12 3131 // | +- L12
3127 // | 3132 // |
3128 // +-- S2 +- L20 (owning) 3133 // +-- S2 +- L20 (owning)
3129 // +- L21 3134 // +- L21
3130 // 3135 //
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 } 3231 }
3227 3232
3228 } 3233 }
3229 3234
3230 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) 3235 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
3231 { 3236 {
3232 Settings::setPartialSwapEnabled(false); 3237 Settings::setPartialSwapEnabled(false);
3233 3238
3234 LayerTreeSettings settings; 3239 LayerTreeSettings settings;
3235 settings.minimumOcclusionTrackingSize = gfx::Size(); 3240 settings.minimumOcclusionTrackingSize = gfx::Size();
3236 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3241 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3237 3242
3238 // Layers are structure as follows: 3243 // Layers are structure as follows:
3239 // 3244 //
3240 // R +-- S1 +- L10 (owning, non drawing) 3245 // R +-- S1 +- L10 (owning, non drawing)
3241 // | +- L11 (corner, unoccluded) 3246 // | +- L11 (corner, unoccluded)
3242 // | +- L12 (corner, unoccluded) 3247 // | +- L12 (corner, unoccluded)
3243 // | +- L13 (corner, unoccluded) 3248 // | +- L13 (corner, unoccluded)
3244 // | +- L14 (corner, entirely occluded) 3249 // | +- L14 (corner, entirely occluded)
3245 // | 3250 // |
3246 // +-- S2 +- L20 (owning, drawing) 3251 // +-- S2 +- L20 (owning, drawing)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3342 myHostImpl->didDrawAllLayers(frame); 3347 myHostImpl->didDrawAllLayers(frame);
3343 } 3348 }
3344 } 3349 }
3345 3350
3346 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) 3351 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
3347 { 3352 {
3348 Settings::setPartialSwapEnabled(false); 3353 Settings::setPartialSwapEnabled(false);
3349 3354
3350 LayerTreeSettings settings; 3355 LayerTreeSettings settings;
3351 settings.minimumOcclusionTrackingSize = gfx::Size(); 3356 settings.minimumOcclusionTrackingSize = gfx::Size();
3352 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3357 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3353 3358
3354 // Layers are structured as follows: 3359 // Layers are structured as follows:
3355 // 3360 //
3356 // R +-- S1 +- L10 (owning, drawing) 3361 // R +-- S1 +- L10 (owning, drawing)
3357 // | +- L11 (corner, occluded by L12) 3362 // | +- L11 (corner, occluded by L12)
3358 // | +- L12 (opposite corner) 3363 // | +- L12 (opposite corner)
3359 // | 3364 // |
3360 // +-- S2 +- L20 (owning, drawing) 3365 // +-- S2 +- L20 (owning, drawing)
3361 // 3366 //
3362 3367
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3430 myHostImpl->drawLayers(frame); 3435 myHostImpl->drawLayers(frame);
3431 myHostImpl->didDrawAllLayers(frame); 3436 myHostImpl->didDrawAllLayers(frame);
3432 } 3437 }
3433 } 3438 }
3434 3439
3435 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) 3440 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
3436 { 3441 {
3437 Settings::setPartialSwapEnabled(false); 3442 Settings::setPartialSwapEnabled(false);
3438 3443
3439 LayerTreeSettings settings; 3444 LayerTreeSettings settings;
3440 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3445 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3441 3446
3442 // Layers are structured as follows: 3447 // Layers are structured as follows:
3443 // 3448 //
3444 // R +-- S1 +- L10 (rotated, drawing) 3449 // R +-- S1 +- L10 (rotated, drawing)
3445 // +- L11 (occupies half surface) 3450 // +- L11 (occupies half surface)
3446 3451
3447 LayerImpl* rootPtr; 3452 LayerImpl* rootPtr;
3448 LayerImpl* layerS1Ptr; 3453 LayerImpl* layerS1Ptr;
3449 3454
3450 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 3455 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3505 myHostImpl->didDrawAllLayers(frame); 3510 myHostImpl->didDrawAllLayers(frame);
3506 } 3511 }
3507 } 3512 }
3508 3513
3509 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) 3514 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
3510 { 3515 {
3511 Settings::setPartialSwapEnabled(true); 3516 Settings::setPartialSwapEnabled(true);
3512 3517
3513 LayerTreeSettings settings; 3518 LayerTreeSettings settings;
3514 settings.minimumOcclusionTrackingSize = gfx::Size(); 3519 settings.minimumOcclusionTrackingSize = gfx::Size();
3515 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3520 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3516 3521
3517 // Layers are structure as follows: 3522 // Layers are structure as follows:
3518 // 3523 //
3519 // R +-- S1 +- L10 (owning) 3524 // R +-- S1 +- L10 (owning)
3520 // | +- L11 3525 // | +- L11
3521 // | +- L12 3526 // | +- L12
3522 // | 3527 // |
3523 // +-- S2 +- L20 (owning) 3528 // +-- S2 +- L20 (owning)
3524 // +- L21 3529 // +- L21
3525 // 3530 //
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 myHostImpl->didDrawAllLayers(frame); 3623 myHostImpl->didDrawAllLayers(frame);
3619 } 3624 }
3620 } 3625 }
3621 3626
3622 TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) 3627 TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
3623 { 3628 {
3624 Settings::setPartialSwapEnabled(false); 3629 Settings::setPartialSwapEnabled(false);
3625 3630
3626 LayerTreeSettings settings; 3631 LayerTreeSettings settings;
3627 settings.minimumOcclusionTrackingSize = gfx::Size(); 3632 settings.minimumOcclusionTrackingSize = gfx::Size();
3628 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3633 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3629 3634
3630 /* 3635 /*
3631 Layers are created as follows: 3636 Layers are created as follows:
3632 3637
3633 +--------------------+ 3638 +--------------------+
3634 | 1 | 3639 | 1 |
3635 | +-----------+ | 3640 | +-----------+ |
3636 | | 2 | | 3641 | | 2 | |
3637 | | +-------------------+ 3642 | | +-------------------+
3638 | | | 3 | 3643 | | | 3 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3725 // We should have a cached texture for surface 2 again even though it was da maged. 3730 // We should have a cached texture for surface 2 again even though it was da maged.
3726 EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(child PassId)); 3731 EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(child PassId));
3727 } 3732 }
3728 3733
3729 TEST_P(LayerTreeHostImplTest, surfaceTextureCaching) 3734 TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
3730 { 3735 {
3731 Settings::setPartialSwapEnabled(true); 3736 Settings::setPartialSwapEnabled(true);
3732 3737
3733 LayerTreeSettings settings; 3738 LayerTreeSettings settings;
3734 settings.minimumOcclusionTrackingSize = gfx::Size(); 3739 settings.minimumOcclusionTrackingSize = gfx::Size();
3735 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3740 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3736 3741
3737 LayerImpl* rootPtr; 3742 LayerImpl* rootPtr;
3738 LayerImpl* intermediateLayerPtr; 3743 LayerImpl* intermediateLayerPtr;
3739 LayerImpl* surfaceLayerPtr; 3744 LayerImpl* surfaceLayerPtr;
3740 LayerImpl* childPtr; 3745 LayerImpl* childPtr;
3741 3746
3742 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100)); 3747 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100));
3743 3748
3744 { 3749 {
3745 LayerTreeHostImpl::FrameData frame; 3750 LayerTreeHostImpl::FrameData frame;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 myHostImpl->didDrawAllLayers(frame); 3891 myHostImpl->didDrawAllLayers(frame);
3887 } 3892 }
3888 } 3893 }
3889 3894
3890 TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) 3895 TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
3891 { 3896 {
3892 Settings::setPartialSwapEnabled(false); 3897 Settings::setPartialSwapEnabled(false);
3893 3898
3894 LayerTreeSettings settings; 3899 LayerTreeSettings settings;
3895 settings.minimumOcclusionTrackingSize = gfx::Size(); 3900 settings.minimumOcclusionTrackingSize = gfx::Size();
3896 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3901 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3897 3902
3898 LayerImpl* rootPtr; 3903 LayerImpl* rootPtr;
3899 LayerImpl* intermediateLayerPtr; 3904 LayerImpl* intermediateLayerPtr;
3900 LayerImpl* surfaceLayerPtr; 3905 LayerImpl* surfaceLayerPtr;
3901 LayerImpl* childPtr; 3906 LayerImpl* childPtr;
3902 3907
3903 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100)); 3908 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100));
3904 3909
3905 { 3910 {
3906 LayerTreeHostImpl::FrameData frame; 3911 LayerTreeHostImpl::FrameData frame;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4078 EXPECT_FALSE(m_didRequestCommit); 4083 EXPECT_FALSE(m_didRequestCommit);
4079 } 4084 }
4080 4085
4081 struct RenderPassRemovalTestData : public LayerTreeHostImpl::FrameData { 4086 struct RenderPassRemovalTestData : public LayerTreeHostImpl::FrameData {
4082 ScopedPtrHashMap<RenderPass::Id, TestRenderPass> renderPassCache; 4087 ScopedPtrHashMap<RenderPass::Id, TestRenderPass> renderPassCache;
4083 scoped_ptr<SharedQuadState> sharedQuadState; 4088 scoped_ptr<SharedQuadState> sharedQuadState;
4084 }; 4089 };
4085 4090
4086 class TestRenderer : public GLRenderer, public RendererClient { 4091 class TestRenderer : public GLRenderer, public RendererClient {
4087 public: 4092 public:
4088 static scoped_ptr<TestRenderer> create(ResourceProvider* resourceProvider) 4093 static scoped_ptr<TestRenderer> create(ResourceProvider* resourceProvider, P roxy* proxy)
4089 { 4094 {
4090 scoped_ptr<TestRenderer> renderer(new TestRenderer(resourceProvider)); 4095 scoped_ptr<TestRenderer> renderer(new TestRenderer(resourceProvider, pro xy));
4091 if (!renderer->initialize()) 4096 if (!renderer->initialize())
4092 return scoped_ptr<TestRenderer>(); 4097 return scoped_ptr<TestRenderer>();
4093 4098
4094 return renderer.Pass(); 4099 return renderer.Pass();
4095 } 4100 }
4096 4101
4097 void clearCachedTextures() { m_textures.clear(); } 4102 void clearCachedTextures() { m_textures.clear(); }
4098 void setHaveCachedResourcesForRenderPassId(RenderPass::Id id) { m_textures.i nsert(id); } 4103 void setHaveCachedResourcesForRenderPassId(RenderPass::Id id) { m_textures.i nsert(id); }
4099 4104
4100 virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id id) const OVE RRIDE { return m_textures.count(id); } 4105 virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id id) const OVE RRIDE { return m_textures.count(id); }
4101 4106
4102 // RendererClient implementation. 4107 // RendererClient implementation.
4103 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view portSize; } 4108 virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_view portSize; }
4104 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin gs; } 4109 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin gs; }
4105 virtual void didLoseContext() OVERRIDE { } 4110 virtual void didLoseContext() OVERRIDE { }
4106 virtual void onSwapBuffersComplete() OVERRIDE { } 4111 virtual void onSwapBuffersComplete() OVERRIDE { }
4107 virtual void setFullRootLayerDamage() OVERRIDE { } 4112 virtual void setFullRootLayerDamage() OVERRIDE { }
4108 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR IDE { } 4113 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR IDE { }
4109 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O VERRIDE { } 4114 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O VERRIDE { }
4115 virtual bool hasImplThread() const OVERRIDE { return false; }
4110 4116
4111 protected: 4117 protected:
4112 TestRenderer(ResourceProvider* resourceProvider) : GLRenderer(this, resource Provider) { } 4118 TestRenderer(ResourceProvider* resourceProvider, Proxy* proxy) : GLRenderer( this, resourceProvider) { }
4113 4119
4114 private: 4120 private:
4115 LayerTreeSettings m_settings; 4121 LayerTreeSettings m_settings;
4116 gfx::Size m_viewportSize; 4122 gfx::Size m_viewportSize;
4117 base::hash_set<RenderPass::Id> m_textures; 4123 base::hash_set<RenderPass::Id> m_textures;
4118 }; 4124 };
4119 4125
4120 static void configureRenderPassTestData(const char* testScript, RenderPassRemova lTestData& testData, TestRenderer* renderer) 4126 static void configureRenderPassTestData(const char* testScript, RenderPassRemova lTestData& testData, TestRenderer* renderer)
4121 { 4127 {
4122 renderer->clearCachedTextures(); 4128 renderer->clearCachedTextures();
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
4386 dumpRenderPassTestData(testData, actualResult); 4392 dumpRenderPassTestData(testData, actualResult);
4387 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t estCase.name; 4393 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t estCase.name;
4388 } 4394 }
4389 4395
4390 TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses) 4396 TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses)
4391 { 4397 {
4392 scoped_ptr<GraphicsContext> context(createContext()); 4398 scoped_ptr<GraphicsContext> context(createContext());
4393 ASSERT_TRUE(context->context3D()); 4399 ASSERT_TRUE(context->context3D());
4394 scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(conte xt.get())); 4400 scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(conte xt.get()));
4395 4401
4396 scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get( ))); 4402 scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get( ), &m_proxy));
4397 4403
4398 int testCaseIndex = 0; 4404 int testCaseIndex = 0;
4399 while (removeRenderPassesCases[testCaseIndex].name) { 4405 while (removeRenderPassesCases[testCaseIndex].name) {
4400 RenderPassRemovalTestData testData; 4406 RenderPassRemovalTestData testData;
4401 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS cript, testData, renderer.get()); 4407 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS cript, testData, renderer.get());
4402 LayerTreeHostImpl::removeRenderPasses(LayerTreeHostImpl::CullRenderPasse sWithCachedTextures(*renderer), testData); 4408 LayerTreeHostImpl::removeRenderPasses(LayerTreeHostImpl::CullRenderPasse sWithCachedTextures(*renderer), testData);
4403 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4409 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4404 testCaseIndex++; 4410 testCaseIndex++;
4405 } 4411 }
4406 } 4412 }
4407 4413
4408 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4414 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4409 LayerTreeHostImplTest, 4415 LayerTreeHostImplTest,
4410 ::testing::Values(false, true)); 4416 ::testing::Values(false, true));
4411 4417
4412 } // namespace 4418 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698