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

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

Powered by Google App Engine
This is Rietveld 408576698