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

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: 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 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 "CCDelegatedRendererLayerImpl.h" 9 #include "CCDelegatedRendererLayerImpl.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/gl_renderer.h" 12 #include "cc/gl_renderer.h"
13 #include "cc/heads_up_display_layer_impl.h" 13 #include "cc/heads_up_display_layer_impl.h"
14 #include "cc/io_surface_layer_impl.h" 14 #include "cc/io_surface_layer_impl.h"
15 #include "cc/layer_impl.h" 15 #include "cc/layer_impl.h"
16 #include "cc/layer_tiling_data.h" 16 #include "cc/layer_tiling_data.h"
17 #include "cc/quad_sink.h" 17 #include "cc/quad_sink.h"
18 #include "cc/render_pass_draw_quad.h" 18 #include "cc/render_pass_draw_quad.h"
19 #include "cc/scrollbar_geometry_fixed_thumb.h" 19 #include "cc/scrollbar_geometry_fixed_thumb.h"
20 #include "cc/scrollbar_layer_impl.h" 20 #include "cc/scrollbar_layer_impl.h"
21 #include "cc/settings.h" 21 #include "cc/settings.h"
22 #include "cc/single_thread_proxy.h" 22 #include "cc/single_thread_proxy.h"
23 #include "cc/solid_color_draw_quad.h" 23 #include "cc/solid_color_draw_quad.h"
24 #include "cc/test/animation_test_common.h" 24 #include "cc/test/animation_test_common.h"
25 #include "cc/test/fake_proxy.h"
25 #include "cc/test/fake_web_compositor_output_surface.h" 26 #include "cc/test/fake_web_compositor_output_surface.h"
26 #include "cc/test/fake_web_graphics_context_3d.h" 27 #include "cc/test/fake_web_graphics_context_3d.h"
27 #include "cc/test/fake_web_scrollbar_theme_geometry.h" 28 #include "cc/test/fake_web_scrollbar_theme_geometry.h"
28 #include "cc/test/geometry_test_utils.h" 29 #include "cc/test/geometry_test_utils.h"
29 #include "cc/test/layer_test_common.h" 30 #include "cc/test/layer_test_common.h"
30 #include "cc/test/render_pass_test_common.h" 31 #include "cc/test/render_pass_test_common.h"
31 #include "cc/test/test_common.h" 32 #include "cc/test/test_common.h"
32 #include "cc/texture_draw_quad.h" 33 #include "cc/texture_draw_quad.h"
33 #include "cc/texture_layer_impl.h" 34 #include "cc/texture_layer_impl.h"
34 #include "cc/tile_draw_quad.h" 35 #include "cc/tile_draw_quad.h"
(...skipping 16 matching lines...) Expand all
51 using ::testing::_; 52 using ::testing::_;
52 53
53 namespace { 54 namespace {
54 55
55 // This test is parametrized to run all tests with the 56 // This test is parametrized to run all tests with the
56 // Settings::pageScalePinchZoomEnabled field enabled and disabled. 57 // Settings::pageScalePinchZoomEnabled field enabled and disabled.
57 class LayerTreeHostImplTest : public testing::TestWithParam<bool>, 58 class LayerTreeHostImplTest : public testing::TestWithParam<bool>,
58 public LayerTreeHostImplClient { 59 public LayerTreeHostImplClient {
59 public: 60 public:
60 LayerTreeHostImplTest() 61 LayerTreeHostImplTest()
61 : m_onCanDrawStateChangedCalled(false) 62 : m_proxy(0)
63 , m_alwaysImplThread(&m_proxy)
64 , m_alwaysMainThreadBlocked(&m_proxy)
65 , m_onCanDrawStateChangedCalled(false)
62 , m_didRequestCommit(false) 66 , m_didRequestCommit(false)
63 , m_didRequestRedraw(false) 67 , m_didRequestRedraw(false)
64 , m_reduceMemoryResult(true) 68 , m_reduceMemoryResult(true)
65 { 69 {
66 } 70 }
67 71
68 virtual void SetUp() 72 virtual void SetUp()
69 { 73 {
70 Settings::setPageScalePinchZoomEnabled(GetParam()); 74 Settings::setPageScalePinchZoomEnabled(GetParam());
71 LayerTreeSettings settings; 75 LayerTreeSettings settings;
72 settings.minimumOcclusionTrackingSize = IntSize(); 76 settings.minimumOcclusionTrackingSize = IntSize();
73 77
74 m_hostImpl = LayerTreeHostImpl::create(settings, this); 78 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
75 m_hostImpl->initializeRenderer(createContext()); 79 m_hostImpl->initializeRenderer(createContext());
76 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); 80 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
77 } 81 }
78 82
79 virtual void TearDown() 83 virtual void TearDown()
80 { 84 {
81 } 85 }
82 86
83 virtual void didLoseContextOnImplThread() OVERRIDE { } 87 virtual void didLoseContextOnImplThread() OVERRIDE { }
84 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } 88 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
85 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } 89 virtual void onVSyncParametersChanged(double, double) OVERRIDE { }
86 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState ChangedCalled = true; } 90 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState ChangedCalled = true; }
87 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr ue; } 91 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr ue; }
88 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr ue; } 92 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr ue; }
89 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, double wallClockTime) OVERRIDE { } 93 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio nEventsVector>, double wallClockTime) OVERRIDE { }
90 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; } 94 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; }
91 95
92 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; } 96 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; }
93 97
94 scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_p tr<GraphicsContext> graphicsContext, scoped_ptr<LayerImpl> root) 98 scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_p tr<GraphicsContext> graphicsContext, scoped_ptr<LayerImpl> root)
95 { 99 {
96 Settings::setPartialSwapEnabled(partialSwap); 100 Settings::setPartialSwapEnabled(partialSwap);
97 101
98 LayerTreeSettings settings; 102 LayerTreeSettings settings;
99 settings.minimumOcclusionTrackingSize = IntSize(); 103 settings.minimumOcclusionTrackingSize = IntSize();
100 104
101 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this); 105 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this, &m_proxy);
102 106
103 myHostImpl->initializeRenderer(graphicsContext.Pass()); 107 myHostImpl->initializeRenderer(graphicsContext.Pass());
104 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); 108 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
105 109
106 root->setAnchorPoint(FloatPoint(0, 0)); 110 root->setAnchorPoint(FloatPoint(0, 0));
107 root->setPosition(FloatPoint(0, 0)); 111 root->setPosition(FloatPoint(0, 0));
108 root->setBounds(IntSize(10, 10)); 112 root->setBounds(IntSize(10, 10));
109 root->setContentBounds(IntSize(10, 10)); 113 root->setContentBounds(IntSize(10, 10));
110 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); 114 root->setVisibleContentRect(IntRect(0, 0, 10, 10));
111 root->setDrawsContent(true); 115 root->setDrawsContent(true);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 m_hostImpl->drawLayers(frame); 179 m_hostImpl->drawLayers(frame);
176 m_hostImpl->didDrawAllLayers(frame); 180 m_hostImpl->didDrawAllLayers(frame);
177 } 181 }
178 182
179 protected: 183 protected:
180 scoped_ptr<GraphicsContext> createContext() 184 scoped_ptr<GraphicsContext> createContext()
181 { 185 {
182 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>(); 186 return FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGrap hicsContext3D>(new FakeWebGraphicsContext3D)).PassAs<GraphicsContext>();
183 } 187 }
184 188
189 FakeProxy m_proxy;
185 DebugScopedSetImplThread m_alwaysImplThread; 190 DebugScopedSetImplThread m_alwaysImplThread;
186 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; 191 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked;
187 192
188 scoped_ptr<LayerTreeHostImpl> m_hostImpl; 193 scoped_ptr<LayerTreeHostImpl> m_hostImpl;
189 bool m_onCanDrawStateChangedCalled; 194 bool m_onCanDrawStateChangedCalled;
190 bool m_didRequestCommit; 195 bool m_didRequestCommit;
191 bool m_didRequestRedraw; 196 bool m_didRequestRedraw;
192 bool m_reduceMemoryResult; 197 bool m_reduceMemoryResult;
193 ScopedSettings m_scopedSettings; 198 ScopedSettings m_scopedSettings;
194 }; 199 };
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 343
339 TEST_P(LayerTreeHostImplTest, scrollWithoutRootLayer) 344 TEST_P(LayerTreeHostImplTest, scrollWithoutRootLayer)
340 { 345 {
341 // We should not crash when trying to scroll an empty layer tree. 346 // We should not crash when trying to scroll an empty layer tree.
342 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored); 347 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored);
343 } 348 }
344 349
345 TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer) 350 TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer)
346 { 351 {
347 LayerTreeSettings settings; 352 LayerTreeSettings settings;
348 m_hostImpl = LayerTreeHostImpl::create(settings, this); 353 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
349 354
350 // Initialization will fail here. 355 // Initialization will fail here.
351 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>()); 356 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>());
352 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); 357 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
353 358
354 setupScrollAndContentsLayers(IntSize(100, 100)); 359 setupScrollAndContentsLayers(IntSize(100, 100));
355 360
356 // We should not crash when trying to scroll after the renderer initializati on fails. 361 // We should not crash when trying to scroll after the renderer initializati on fails.
357 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored); 362 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel) , InputHandlerClient::ScrollIgnored);
358 } 363 }
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 // where it should request to swap only the subBuffer that is damaged. 1939 // where it should request to swap only the subBuffer that is damaged.
1935 TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect) 1940 TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
1936 { 1941 {
1937 scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface:: create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)). PassAs<GraphicsContext>(); 1942 scoped_ptr<GraphicsContext> outputSurface = FakeWebCompositorOutputSurface:: create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)). PassAs<GraphicsContext>();
1938 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->context3D()); 1943 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->context3D());
1939 1944
1940 // This test creates its own LayerTreeHostImpl, so 1945 // This test creates its own LayerTreeHostImpl, so
1941 // that we can force partial swap enabled. 1946 // that we can force partial swap enabled.
1942 LayerTreeSettings settings; 1947 LayerTreeSettings settings;
1943 Settings::setPartialSwapEnabled(true); 1948 Settings::setPartialSwapEnabled(true);
1944 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this); 1949 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this, &m_proxy);
1945 layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); 1950 layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
1946 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); 1951 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500));
1947 1952
1948 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); 1953 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
1949 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); 1954 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2);
1950 child->setPosition(FloatPoint(12, 13)); 1955 child->setPosition(FloatPoint(12, 13));
1951 child->setAnchorPoint(FloatPoint(0, 0)); 1956 child->setAnchorPoint(FloatPoint(0, 0));
1952 child->setBounds(IntSize(14, 15)); 1957 child->setBounds(IntSize(14, 15));
1953 child->setContentBounds(IntSize(14, 15)); 1958 child->setContentBounds(IntSize(14, 15));
1954 child->setDrawsContent(true); 1959 child->setDrawsContent(true);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 } 2219 }
2215 2220
2216 // Unlimited texture size. 2221 // Unlimited texture size.
2217 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) 2222 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value)
2218 { 2223 {
2219 if (pname == GL_MAX_TEXTURE_SIZE) 2224 if (pname == GL_MAX_TEXTURE_SIZE)
2220 *value = 8192; 2225 *value = 8192;
2221 } 2226 }
2222 }; 2227 };
2223 2228
2224 static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay erTreeHostImplClient* client) 2229 static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay erTreeHostImplClient* client, Proxy* proxy)
2225 { 2230 {
2226 Settings::setPartialSwapEnabled(partialSwap); 2231 Settings::setPartialSwapEnabled(partialSwap);
2227 2232
2228 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 2233 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>();
2229 2234
2230 LayerTreeSettings settings; 2235 LayerTreeSettings settings;
2231 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, client); 2236 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, client, proxy);
2232 myHostImpl->initializeRenderer(context.Pass()); 2237 myHostImpl->initializeRenderer(context.Pass());
2233 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); 2238 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
2234 2239
2235 /* 2240 /*
2236 Layers are created as follows: 2241 Layers are created as follows:
2237 2242
2238 +--------------------+ 2243 +--------------------+
2239 | 1 | 2244 | 1 |
2240 | +-----------+ | 2245 | +-----------+ |
2241 | | 2 | | 2246 | | 2 | |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 2289
2285 child->addChild(grandChild.Pass()); 2290 child->addChild(grandChild.Pass());
2286 root->addChild(child.Pass()); 2291 root->addChild(child.Pass());
2287 2292
2288 myHostImpl->setRootLayer(root.Pass()); 2293 myHostImpl->setRootLayer(root.Pass());
2289 return myHostImpl.Pass(); 2294 return myHostImpl.Pass();
2290 } 2295 }
2291 2296
2292 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) 2297 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap)
2293 { 2298 {
2294 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this) ; 2299 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this, &m_proxy);
2295 2300
2296 { 2301 {
2297 LayerTreeHostImpl::FrameData frame; 2302 LayerTreeHostImpl::FrameData frame;
2298 EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); 2303 EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
2299 2304
2300 // Just for consistency, the most interesting stuff already happened 2305 // Just for consistency, the most interesting stuff already happened
2301 myHostImpl->drawLayers(frame); 2306 myHostImpl->drawLayers(frame);
2302 myHostImpl->didDrawAllLayers(frame); 2307 myHostImpl->didDrawAllLayers(frame);
2303 2308
2304 // Verify all quads have been computed 2309 // Verify all quads have been computed
2305 ASSERT_EQ(2U, frame.renderPasses.size()); 2310 ASSERT_EQ(2U, frame.renderPasses.size());
2306 ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size()); 2311 ASSERT_EQ(1U, frame.renderPasses[0]->quadList().size());
2307 ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size()); 2312 ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size());
2308 EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->ma terial()); 2313 EXPECT_EQ(DrawQuad::SolidColor, frame.renderPasses[0]->quadList()[0]->ma terial());
2309 EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->ma terial()); 2314 EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->ma terial());
2310 } 2315 }
2311 } 2316 }
2312 2317
2313 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) 2318 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap)
2314 { 2319 {
2315 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this ); 2320 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this , &m_proxy);
2316 2321
2317 { 2322 {
2318 LayerTreeHostImpl::FrameData frame; 2323 LayerTreeHostImpl::FrameData frame;
2319 EXPECT_TRUE(myHostImpl->prepareToDraw(frame)); 2324 EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
2320 2325
2321 // Just for consistency, the most interesting stuff already happened 2326 // Just for consistency, the most interesting stuff already happened
2322 myHostImpl->drawLayers(frame); 2327 myHostImpl->drawLayers(frame);
2323 myHostImpl->didDrawAllLayers(frame); 2328 myHostImpl->didDrawAllLayers(frame);
2324 2329
2325 // Verify all quads have been computed 2330 // Verify all quads have been computed
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 m_hostImpl->initializeRenderer(createContext()); 2376 m_hostImpl->initializeRenderer(createContext());
2372 2377
2373 EXPECT_TRUE(root->didLoseContextCalled()); 2378 EXPECT_TRUE(root->didLoseContextCalled());
2374 EXPECT_TRUE(layer1->didLoseContextCalled()); 2379 EXPECT_TRUE(layer1->didLoseContextCalled());
2375 EXPECT_TRUE(layer2->didLoseContextCalled()); 2380 EXPECT_TRUE(layer2->didLoseContextCalled());
2376 } 2381 }
2377 2382
2378 TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost) 2383 TEST_P(LayerTreeHostImplTest, finishAllRenderingAfterContextLost)
2379 { 2384 {
2380 LayerTreeSettings settings; 2385 LayerTreeSettings settings;
2381 m_hostImpl = LayerTreeHostImpl::create(settings, this); 2386 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
2382 2387
2383 // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects. 2388 // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
2384 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>()); 2389 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails) ).PassAs<GraphicsContext>());
2385 m_hostImpl->finishAllRendering(); 2390 m_hostImpl->finishAllRendering();
2386 } 2391 }
2387 2392
2388 class FakeWebGraphicsContext3DMakeCurrentFailsEventually : public FakeWebGraphic sContext3D { 2393 class FakeWebGraphicsContext3DMakeCurrentFailsEventually : public FakeWebGraphic sContext3D {
2389 public: 2394 public:
2390 explicit FakeWebGraphicsContext3DMakeCurrentFailsEventually(unsigned succeed Count) : m_succeedCount(succeedCount) { } 2395 explicit FakeWebGraphicsContext3DMakeCurrentFailsEventually(unsigned succeed Count) : m_succeedCount(succeedCount) { }
2391 virtual bool makeContextCurrent() { 2396 virtual bool makeContextCurrent() {
2392 if (!m_succeedCount) 2397 if (!m_succeedCount)
2393 return false; 2398 return false;
2394 --m_succeedCount; 2399 --m_succeedCount;
2395 return true; 2400 return true;
2396 } 2401 }
2397 2402
2398 private: 2403 private:
2399 unsigned m_succeedCount; 2404 unsigned m_succeedCount;
2400 }; 2405 };
2401 2406
2402 TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize) 2407 TEST_P(LayerTreeHostImplTest, contextLostDuringInitialize)
2403 { 2408 {
2404 LayerTreeSettings settings; 2409 LayerTreeSettings settings;
2405 m_hostImpl = LayerTreeHostImpl::create(settings, this); 2410 m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
2406 2411
2407 // Initialize into a known successful state. 2412 // Initialize into a known successful state.
2408 EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext())); 2413 EXPECT_TRUE(m_hostImpl->initializeRenderer(createContext()));
2409 EXPECT_TRUE(m_hostImpl->context()); 2414 EXPECT_TRUE(m_hostImpl->context());
2410 EXPECT_TRUE(m_hostImpl->renderer()); 2415 EXPECT_TRUE(m_hostImpl->renderer());
2411 EXPECT_TRUE(m_hostImpl->resourceProvider()); 2416 EXPECT_TRUE(m_hostImpl->resourceProvider());
2412 2417
2413 // We will make the context get lost after a numer of makeContextCurrent 2418 // We will make the context get lost after a numer of makeContextCurrent
2414 // calls. The exact number of calls to make it succeed is dependent on the 2419 // calls. The exact number of calls to make it succeed is dependent on the
2415 // implementation and doesn't really matter (i.e. can be changed to make the 2420 // implementation and doesn't really matter (i.e. can be changed to make the
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 public: 2990 public:
2986 using GLRenderer::releaseRenderPassTextures; 2991 using GLRenderer::releaseRenderPassTextures;
2987 }; 2992 };
2988 2993
2989 TEST_P(LayerTreeHostImplTest, textureCachingWithClipping) 2994 TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
2990 { 2995 {
2991 Settings::setPartialSwapEnabled(true); 2996 Settings::setPartialSwapEnabled(true);
2992 2997
2993 LayerTreeSettings settings; 2998 LayerTreeSettings settings;
2994 settings.minimumOcclusionTrackingSize = IntSize(); 2999 settings.minimumOcclusionTrackingSize = IntSize();
2995 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3000 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
2996 3001
2997 LayerImpl* rootPtr; 3002 LayerImpl* rootPtr;
2998 LayerImpl* surfaceLayerPtr; 3003 LayerImpl* surfaceLayerPtr;
2999 3004
3000 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 3005 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>();
3001 3006
3002 IntSize rootSize(100, 100); 3007 IntSize rootSize(100, 100);
3003 3008
3004 myHostImpl->initializeRenderer(context.Pass()); 3009 myHostImpl->initializeRenderer(context.Pass());
3005 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height())); 3010 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height()));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 myHostImpl->didDrawAllLayers(frame); 3087 myHostImpl->didDrawAllLayers(frame);
3083 } 3088 }
3084 } 3089 }
3085 3090
3086 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion) 3091 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
3087 { 3092 {
3088 Settings::setPartialSwapEnabled(false); 3093 Settings::setPartialSwapEnabled(false);
3089 3094
3090 LayerTreeSettings settings; 3095 LayerTreeSettings settings;
3091 settings.minimumOcclusionTrackingSize = IntSize(); 3096 settings.minimumOcclusionTrackingSize = IntSize();
3092 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3097 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3093 3098
3094 // Layers are structure as follows: 3099 // Layers are structure as follows:
3095 // 3100 //
3096 // R +-- S1 +- L10 (owning) 3101 // R +-- S1 +- L10 (owning)
3097 // | +- L11 3102 // | +- L11
3098 // | +- L12 3103 // | +- L12
3099 // | 3104 // |
3100 // +-- S2 +- L20 (owning) 3105 // +-- S2 +- L20 (owning)
3101 // +- L21 3106 // +- L21
3102 // 3107 //
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 } 3203 }
3199 3204
3200 } 3205 }
3201 3206
3202 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) 3207 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
3203 { 3208 {
3204 Settings::setPartialSwapEnabled(false); 3209 Settings::setPartialSwapEnabled(false);
3205 3210
3206 LayerTreeSettings settings; 3211 LayerTreeSettings settings;
3207 settings.minimumOcclusionTrackingSize = IntSize(); 3212 settings.minimumOcclusionTrackingSize = IntSize();
3208 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3213 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3209 3214
3210 // Layers are structure as follows: 3215 // Layers are structure as follows:
3211 // 3216 //
3212 // R +-- S1 +- L10 (owning, non drawing) 3217 // R +-- S1 +- L10 (owning, non drawing)
3213 // | +- L11 (corner, unoccluded) 3218 // | +- L11 (corner, unoccluded)
3214 // | +- L12 (corner, unoccluded) 3219 // | +- L12 (corner, unoccluded)
3215 // | +- L13 (corner, unoccluded) 3220 // | +- L13 (corner, unoccluded)
3216 // | +- L14 (corner, entirely occluded) 3221 // | +- L14 (corner, entirely occluded)
3217 // | 3222 // |
3218 // +-- S2 +- L20 (owning, drawing) 3223 // +-- S2 +- L20 (owning, drawing)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 myHostImpl->didDrawAllLayers(frame); 3319 myHostImpl->didDrawAllLayers(frame);
3315 } 3320 }
3316 } 3321 }
3317 3322
3318 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) 3323 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
3319 { 3324 {
3320 Settings::setPartialSwapEnabled(false); 3325 Settings::setPartialSwapEnabled(false);
3321 3326
3322 LayerTreeSettings settings; 3327 LayerTreeSettings settings;
3323 settings.minimumOcclusionTrackingSize = IntSize(); 3328 settings.minimumOcclusionTrackingSize = IntSize();
3324 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3329 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3325 3330
3326 // Layers are structured as follows: 3331 // Layers are structured as follows:
3327 // 3332 //
3328 // R +-- S1 +- L10 (owning, drawing) 3333 // R +-- S1 +- L10 (owning, drawing)
3329 // | +- L11 (corner, occluded by L12) 3334 // | +- L11 (corner, occluded by L12)
3330 // | +- L12 (opposite corner) 3335 // | +- L12 (opposite corner)
3331 // | 3336 // |
3332 // +-- S2 +- L20 (owning, drawing) 3337 // +-- S2 +- L20 (owning, drawing)
3333 // 3338 //
3334 3339
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 myHostImpl->drawLayers(frame); 3407 myHostImpl->drawLayers(frame);
3403 myHostImpl->didDrawAllLayers(frame); 3408 myHostImpl->didDrawAllLayers(frame);
3404 } 3409 }
3405 } 3410 }
3406 3411
3407 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) 3412 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
3408 { 3413 {
3409 Settings::setPartialSwapEnabled(false); 3414 Settings::setPartialSwapEnabled(false);
3410 3415
3411 LayerTreeSettings settings; 3416 LayerTreeSettings settings;
3412 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3417 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3413 3418
3414 // Layers are structured as follows: 3419 // Layers are structured as follows:
3415 // 3420 //
3416 // R +-- S1 +- L10 (rotated, drawing) 3421 // R +-- S1 +- L10 (rotated, drawing)
3417 // +- L11 (occupies half surface) 3422 // +- L11 (occupies half surface)
3418 3423
3419 LayerImpl* rootPtr; 3424 LayerImpl* rootPtr;
3420 LayerImpl* layerS1Ptr; 3425 LayerImpl* layerS1Ptr;
3421 3426
3422 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 3427 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
3477 myHostImpl->didDrawAllLayers(frame); 3482 myHostImpl->didDrawAllLayers(frame);
3478 } 3483 }
3479 } 3484 }
3480 3485
3481 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) 3486 TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
3482 { 3487 {
3483 Settings::setPartialSwapEnabled(true); 3488 Settings::setPartialSwapEnabled(true);
3484 3489
3485 LayerTreeSettings settings; 3490 LayerTreeSettings settings;
3486 settings.minimumOcclusionTrackingSize = IntSize(); 3491 settings.minimumOcclusionTrackingSize = IntSize();
3487 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3492 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3488 3493
3489 // Layers are structure as follows: 3494 // Layers are structure as follows:
3490 // 3495 //
3491 // R +-- S1 +- L10 (owning) 3496 // R +-- S1 +- L10 (owning)
3492 // | +- L11 3497 // | +- L11
3493 // | +- L12 3498 // | +- L12
3494 // | 3499 // |
3495 // +-- S2 +- L20 (owning) 3500 // +-- S2 +- L20 (owning)
3496 // +- L21 3501 // +- L21
3497 // 3502 //
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3590 myHostImpl->didDrawAllLayers(frame); 3595 myHostImpl->didDrawAllLayers(frame);
3591 } 3596 }
3592 } 3597 }
3593 3598
3594 TEST_P(LayerTreeHostImplTest, textureCachingWithScissor) 3599 TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
3595 { 3600 {
3596 Settings::setPartialSwapEnabled(false); 3601 Settings::setPartialSwapEnabled(false);
3597 3602
3598 LayerTreeSettings settings; 3603 LayerTreeSettings settings;
3599 settings.minimumOcclusionTrackingSize = IntSize(); 3604 settings.minimumOcclusionTrackingSize = IntSize();
3600 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3605 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3601 3606
3602 /* 3607 /*
3603 Layers are created as follows: 3608 Layers are created as follows:
3604 3609
3605 +--------------------+ 3610 +--------------------+
3606 | 1 | 3611 | 1 |
3607 | +-----------+ | 3612 | +-----------+ |
3608 | | 2 | | 3613 | | 2 | |
3609 | | +-------------------+ 3614 | | +-------------------+
3610 | | | 3 | 3615 | | | 3 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3697 // We should have a cached texture for surface 2 again even though it was da maged. 3702 // We should have a cached texture for surface 2 again even though it was da maged.
3698 EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(child PassId)); 3703 EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(child PassId));
3699 } 3704 }
3700 3705
3701 TEST_P(LayerTreeHostImplTest, surfaceTextureCaching) 3706 TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
3702 { 3707 {
3703 Settings::setPartialSwapEnabled(true); 3708 Settings::setPartialSwapEnabled(true);
3704 3709
3705 LayerTreeSettings settings; 3710 LayerTreeSettings settings;
3706 settings.minimumOcclusionTrackingSize = IntSize(); 3711 settings.minimumOcclusionTrackingSize = IntSize();
3707 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3712 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3708 3713
3709 LayerImpl* rootPtr; 3714 LayerImpl* rootPtr;
3710 LayerImpl* intermediateLayerPtr; 3715 LayerImpl* intermediateLayerPtr;
3711 LayerImpl* surfaceLayerPtr; 3716 LayerImpl* surfaceLayerPtr;
3712 LayerImpl* childPtr; 3717 LayerImpl* childPtr;
3713 3718
3714 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, IntSize(100, 100)); 3719 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, IntSize(100, 100));
3715 3720
3716 { 3721 {
3717 LayerTreeHostImpl::FrameData frame; 3722 LayerTreeHostImpl::FrameData frame;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
3858 myHostImpl->didDrawAllLayers(frame); 3863 myHostImpl->didDrawAllLayers(frame);
3859 } 3864 }
3860 } 3865 }
3861 3866
3862 TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) 3867 TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
3863 { 3868 {
3864 Settings::setPartialSwapEnabled(false); 3869 Settings::setPartialSwapEnabled(false);
3865 3870
3866 LayerTreeSettings settings; 3871 LayerTreeSettings settings;
3867 settings.minimumOcclusionTrackingSize = IntSize(); 3872 settings.minimumOcclusionTrackingSize = IntSize();
3868 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this); 3873 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(setting s, this, &m_proxy);
3869 3874
3870 LayerImpl* rootPtr; 3875 LayerImpl* rootPtr;
3871 LayerImpl* intermediateLayerPtr; 3876 LayerImpl* intermediateLayerPtr;
3872 LayerImpl* surfaceLayerPtr; 3877 LayerImpl* surfaceLayerPtr;
3873 LayerImpl* childPtr; 3878 LayerImpl* childPtr;
3874 3879
3875 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, IntSize(100, 100)); 3880 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, IntSize(100, 100));
3876 3881
3877 { 3882 {
3878 LayerTreeHostImpl::FrameData frame; 3883 LayerTreeHostImpl::FrameData frame;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 EXPECT_FALSE(m_didRequestCommit); 4055 EXPECT_FALSE(m_didRequestCommit);
4051 } 4056 }
4052 4057
4053 struct RenderPassRemovalTestData : public LayerTreeHostImpl::FrameData { 4058 struct RenderPassRemovalTestData : public LayerTreeHostImpl::FrameData {
4054 ScopedPtrHashMap<RenderPass::Id, TestRenderPass> renderPassCache; 4059 ScopedPtrHashMap<RenderPass::Id, TestRenderPass> renderPassCache;
4055 scoped_ptr<SharedQuadState> sharedQuadState; 4060 scoped_ptr<SharedQuadState> sharedQuadState;
4056 }; 4061 };
4057 4062
4058 class TestRenderer : public GLRenderer, public RendererClient { 4063 class TestRenderer : public GLRenderer, public RendererClient {
4059 public: 4064 public:
4060 static scoped_ptr<TestRenderer> create(ResourceProvider* resourceProvider) 4065 static scoped_ptr<TestRenderer> create(ResourceProvider* resourceProvider, P roxy* proxy)
4061 { 4066 {
4062 scoped_ptr<TestRenderer> renderer(new TestRenderer(resourceProvider)); 4067 scoped_ptr<TestRenderer> renderer(new TestRenderer(resourceProvider, pro xy));
4063 if (!renderer->initialize()) 4068 if (!renderer->initialize())
4064 return scoped_ptr<TestRenderer>(); 4069 return scoped_ptr<TestRenderer>();
4065 4070
4066 return renderer.Pass(); 4071 return renderer.Pass();
4067 } 4072 }
4068 4073
4069 void clearCachedTextures() { m_textures.clear(); } 4074 void clearCachedTextures() { m_textures.clear(); }
4070 void setHaveCachedResourcesForRenderPassId(RenderPass::Id id) { m_textures.i nsert(id); } 4075 void setHaveCachedResourcesForRenderPassId(RenderPass::Id id) { m_textures.i nsert(id); }
4071 4076
4072 virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id id) const OVE RRIDE { return m_textures.count(id); } 4077 virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id id) const OVE RRIDE { return m_textures.count(id); }
4073 4078
4074 // RendererClient implementation. 4079 // RendererClient implementation.
4075 virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewpo rtSize; } 4080 virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewpo rtSize; }
4076 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin gs; } 4081 virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settin gs; }
4077 virtual void didLoseContext() OVERRIDE { } 4082 virtual void didLoseContext() OVERRIDE { }
4078 virtual void onSwapBuffersComplete() OVERRIDE { } 4083 virtual void onSwapBuffersComplete() OVERRIDE { }
4079 virtual void setFullRootLayerDamage() OVERRIDE { } 4084 virtual void setFullRootLayerDamage() OVERRIDE { }
4080 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR IDE { } 4085 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR IDE { }
4081 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O VERRIDE { } 4086 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O VERRIDE { }
4082 4087
4083 protected: 4088 protected:
4084 TestRenderer(ResourceProvider* resourceProvider) : GLRenderer(this, resource Provider) { } 4089 TestRenderer(ResourceProvider* resourceProvider, Proxy* proxy) : GLRenderer( this, resourceProvider, proxy->hasImplThread()) { }
4085 4090
4086 private: 4091 private:
4087 LayerTreeSettings m_settings; 4092 LayerTreeSettings m_settings;
4088 IntSize m_viewportSize; 4093 IntSize m_viewportSize;
4089 base::hash_set<RenderPass::Id> m_textures; 4094 base::hash_set<RenderPass::Id> m_textures;
4090 }; 4095 };
4091 4096
4092 static void configureRenderPassTestData(const char* testScript, RenderPassRemova lTestData& testData, TestRenderer* renderer) 4097 static void configureRenderPassTestData(const char* testScript, RenderPassRemova lTestData& testData, TestRenderer* renderer)
4093 { 4098 {
4094 renderer->clearCachedTextures(); 4099 renderer->clearCachedTextures();
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
4358 dumpRenderPassTestData(testData, actualResult); 4363 dumpRenderPassTestData(testData, actualResult);
4359 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t estCase.name; 4364 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t estCase.name;
4360 } 4365 }
4361 4366
4362 TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses) 4367 TEST_P(LayerTreeHostImplTest, testRemoveRenderPasses)
4363 { 4368 {
4364 scoped_ptr<GraphicsContext> context(createContext()); 4369 scoped_ptr<GraphicsContext> context(createContext());
4365 ASSERT_TRUE(context->context3D()); 4370 ASSERT_TRUE(context->context3D());
4366 scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(conte xt.get())); 4371 scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(conte xt.get()));
4367 4372
4368 scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get( ))); 4373 scoped_ptr<TestRenderer> renderer(TestRenderer::create(resourceProvider.get( ), &m_proxy));
4369 4374
4370 int testCaseIndex = 0; 4375 int testCaseIndex = 0;
4371 while (removeRenderPassesCases[testCaseIndex].name) { 4376 while (removeRenderPassesCases[testCaseIndex].name) {
4372 RenderPassRemovalTestData testData; 4377 RenderPassRemovalTestData testData;
4373 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS cript, testData, renderer.get()); 4378 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS cript, testData, renderer.get());
4374 LayerTreeHostImpl::removeRenderPasses(LayerTreeHostImpl::CullRenderPasse sWithCachedTextures(*renderer), testData); 4379 LayerTreeHostImpl::removeRenderPasses(LayerTreeHostImpl::CullRenderPasse sWithCachedTextures(*renderer), testData);
4375 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4380 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4376 testCaseIndex++; 4381 testCaseIndex++;
4377 } 4382 }
4378 } 4383 }
4379 4384
4380 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4385 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4381 LayerTreeHostImplTest, 4386 LayerTreeHostImplTest,
4382 ::testing::Values(false, true)); 4387 ::testing::Values(false, true));
4383 4388
4384 } // namespace 4389 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698