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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 61823008: Introduce separate client and init path for single-threaded cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 } 2366 }
2367 } 2367 }
2368 2368
2369 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { 2369 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) {
2370 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 2370 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
2371 2371
2372 LayerTreeSettings settings; 2372 LayerTreeSettings settings;
2373 settings.max_partial_texture_updates = 4; 2373 settings.max_partial_texture_updates = 4;
2374 2374
2375 scoped_ptr<LayerTreeHost> host = 2375 scoped_ptr<LayerTreeHost> host =
2376 LayerTreeHost::Create(&client, NULL, settings, NULL); 2376 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
2377 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); 2377 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
2378 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 2378 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
2379 } 2379 }
2380 2380
2381 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { 2381 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) {
2382 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); 2382 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE);
2383 2383
2384 LayerTreeSettings settings; 2384 LayerTreeSettings settings;
2385 settings.max_partial_texture_updates = 4; 2385 settings.max_partial_texture_updates = 4;
2386 2386
2387 scoped_ptr<LayerTreeHost> host = 2387 scoped_ptr<LayerTreeHost> host =
2388 LayerTreeHost::Create(&client, NULL, settings, NULL); 2388 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
2389 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); 2389 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
2390 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 2390 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
2391 } 2391 }
2392 2392
2393 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { 2393 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
2394 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); 2394 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D);
2395 2395
2396 LayerTreeSettings settings; 2396 LayerTreeSettings settings;
2397 settings.max_partial_texture_updates = 4; 2397 settings.max_partial_texture_updates = 4;
2398 2398
2399 scoped_ptr<LayerTreeHost> host = 2399 scoped_ptr<LayerTreeHost> host =
2400 LayerTreeHost::Create(&client, NULL, settings, NULL); 2400 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
2401 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); 2401 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
2402 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2402 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2403 } 2403 }
2404 2404
2405 TEST(LayerTreeHostTest, 2405 TEST(LayerTreeHostTest,
2406 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { 2406 PartialUpdatesWithDelegatingRendererAndSoftwareContent) {
2407 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); 2407 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE);
2408 2408
2409 LayerTreeSettings settings; 2409 LayerTreeSettings settings;
2410 settings.max_partial_texture_updates = 4; 2410 settings.max_partial_texture_updates = 4;
2411 2411
2412 scoped_ptr<LayerTreeHost> host = 2412 scoped_ptr<LayerTreeHost> host =
2413 LayerTreeHost::Create(&client, NULL, settings, NULL); 2413 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings);
2414 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); 2414 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
2415 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2415 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2416 } 2416 }
2417 2417
2418 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2418 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2419 : public LayerTreeHostTest { 2419 : public LayerTreeHostTest {
2420 public: 2420 public:
2421 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2421 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2422 : root_layer_(FakeContentLayer::Create(&client_)), 2422 : root_layer_(FakeContentLayer::Create(&client_)),
2423 child_layer1_(FakeContentLayer::Create(&client_)), 2423 child_layer1_(FakeContentLayer::Create(&client_)),
(...skipping 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after
5277 size_t second_output_surface_memory_limit_; 5277 size_t second_output_surface_memory_limit_;
5278 FakeContentLayerClient client_; 5278 FakeContentLayerClient client_;
5279 scoped_refptr<FakeContentLayer> root_; 5279 scoped_refptr<FakeContentLayer> root_;
5280 }; 5280 };
5281 5281
5282 // No output to copy for delegated renderers. 5282 // No output to copy for delegated renderers.
5283 SINGLE_AND_MULTI_THREAD_TEST_F( 5283 SINGLE_AND_MULTI_THREAD_TEST_F(
5284 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface); 5284 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface);
5285 5285
5286 } // namespace cc 5286 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_single_thread_client.h ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698