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

Side by Side Diff: cc/layer_tree_host_unittest.cc

Issue 11464007: Add the DelegatingRenderer class with its initialize path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize() Created 8 years 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 | Annotate | Revision Log
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 "cc/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "cc/content_layer.h" 8 #include "cc/content_layer.h"
9 #include "cc/content_layer_client.h" 9 #include "cc/content_layer_client.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2953 class LayerTreeHostTestLostContextWhileUpdatingResources : public LayerTreeHostT est { 2953 class LayerTreeHostTestLostContextWhileUpdatingResources : public LayerTreeHostT est {
2954 public: 2954 public:
2955 LayerTreeHostTestLostContextWhileUpdatingResources() 2955 LayerTreeHostTestLostContextWhileUpdatingResources()
2956 : m_parent(ContentLayerWithUpdateTracking::create(&m_client)) 2956 : m_parent(ContentLayerWithUpdateTracking::create(&m_client))
2957 , m_numChildren(50) 2957 , m_numChildren(50)
2958 { 2958 {
2959 for (int i = 0; i < m_numChildren; i++) 2959 for (int i = 0; i < m_numChildren; i++)
2960 m_children.push_back(ContentLayerWithUpdateTracking::create(&m_clien t)); 2960 m_children.push_back(ContentLayerWithUpdateTracking::create(&m_clien t));
2961 } 2961 }
2962 2962
2963 virtual scoped_ptr<OutputSurface> createOutputSurface()
2964 {
2965 return FakeOutputSurface::Create3d(CompositorFakeWebGraphicsContext3DWit hEndQueryCausingLostContext::create(WebGraphicsContext3D::Attributes()).PassAs<W ebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
2966 }
2967
2968 virtual void beginTest() 2963 virtual void beginTest()
2969 { 2964 {
2970 m_layerTreeHost->setRootLayer(m_parent); 2965 m_layerTreeHost->setRootLayer(m_parent);
2971 m_layerTreeHost->setViewportSize(gfx::Size(m_numChildren, 1), gfx::Size( m_numChildren, 1)); 2966 m_layerTreeHost->setViewportSize(gfx::Size(m_numChildren, 1), gfx::Size( m_numChildren, 1));
2972 2967
2973 gfx::Transform identityMatrix; 2968 gfx::Transform identityMatrix;
2974 setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::Poi ntF(0, 0), gfx::PointF(0, 0), gfx::Size(m_numChildren, 1), true); 2969 setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::Poi ntF(0, 0), gfx::PointF(0, 0), gfx::Size(m_numChildren, 1), true);
2975 for (int i = 0; i < m_numChildren; i++) 2970 for (int i = 0; i < m_numChildren; i++)
2976 setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), id entityMatrix, gfx::PointF(0, 0), gfx::PointF(i, 0), gfx::Size(1, 1), false); 2971 setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), id entityMatrix, gfx::PointF(0, 0), gfx::PointF(i, 0), gfx::Size(1, 1), false);
2977 2972
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 LayerTreeHostWithProxy host(&client, settings, proxy.PassAs<Proxy>()); 3323 LayerTreeHostWithProxy host(&client, settings, proxy.PassAs<Proxy>());
3329 EXPECT_TRUE(host.initializeRendererIfNeeded()); 3324 EXPECT_TRUE(host.initializeRendererIfNeeded());
3330 3325
3331 EXPECT_EQ(10u, host.settings().maxPartialTextureUpdates); 3326 EXPECT_EQ(10u, host.settings().maxPartialTextureUpdates);
3332 } 3327 }
3333 } 3328 }
3334 3329
3335 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) 3330 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer)
3336 { 3331 {
3337 bool useSoftwareRendering = false; 3332 bool useSoftwareRendering = false;
3338 FakeLayerImplTreeHostClient client(useSoftwareRendering); 3333 bool useDelegatingRenderer = false;
3334 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender er);
3339 3335
3340 LayerTreeSettings settings; 3336 LayerTreeSettings settings;
3341 settings.maxPartialTextureUpdates = 4; 3337 settings.maxPartialTextureUpdates = 4;
3342 3338
3343 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); 3339 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
3344 EXPECT_TRUE(host->initializeRendererIfNeeded()); 3340 EXPECT_TRUE(host->initializeRendererIfNeeded());
3345 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); 3341 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates);
3346 } 3342 }
3347 3343
3348 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) 3344 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer)
3349 { 3345 {
3350 bool useSoftwareRendering = true; 3346 bool useSoftwareRendering = true;
3351 FakeLayerImplTreeHostClient client(useSoftwareRendering); 3347 bool useDelegatingRenderer = false;
3348 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender er);
3352 3349
3353 LayerTreeSettings settings; 3350 LayerTreeSettings settings;
3354 settings.maxPartialTextureUpdates = 4; 3351 settings.maxPartialTextureUpdates = 4;
3355 3352
3356 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); 3353 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
3357 EXPECT_TRUE(host->initializeRendererIfNeeded()); 3354 EXPECT_TRUE(host->initializeRendererIfNeeded());
3358 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); 3355 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates);
3359 } 3356 }
3360 3357
3358 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent)
3359 {
3360 bool useSoftwareRendering = false;
3361 bool useDelegatingRenderer = true;
3362 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender er);
3363
3364 LayerTreeSettings settings;
3365 settings.maxPartialTextureUpdates = 4;
3366
3367 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
3368 EXPECT_TRUE(host->initializeRendererIfNeeded());
3369 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates);
3370 }
3371
3372 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndSoftwareContent)
3373 {
3374 bool useSoftwareRendering = true;
3375 bool useDelegatingRenderer = true;
3376 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender er);
3377
3378 LayerTreeSettings settings;
3379 settings.maxPartialTextureUpdates = 4;
3380
3381 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>());
3382 EXPECT_TRUE(host->initializeRendererIfNeeded());
3383 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates);
3384 }
3385
3361 } // namespace 3386 } // namespace
3362 } // namespace cc 3387 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698