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

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

Issue 23702023: Unit test for freeing tiles when going invisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 16 matching lines...) Expand all
27 #include "cc/output/begin_frame_args.h" 27 #include "cc/output/begin_frame_args.h"
28 #include "cc/output/compositor_frame_ack.h" 28 #include "cc/output/compositor_frame_ack.h"
29 #include "cc/output/compositor_frame_metadata.h" 29 #include "cc/output/compositor_frame_metadata.h"
30 #include "cc/output/gl_renderer.h" 30 #include "cc/output/gl_renderer.h"
31 #include "cc/quads/render_pass_draw_quad.h" 31 #include "cc/quads/render_pass_draw_quad.h"
32 #include "cc/quads/solid_color_draw_quad.h" 32 #include "cc/quads/solid_color_draw_quad.h"
33 #include "cc/quads/texture_draw_quad.h" 33 #include "cc/quads/texture_draw_quad.h"
34 #include "cc/quads/tile_draw_quad.h" 34 #include "cc/quads/tile_draw_quad.h"
35 #include "cc/resources/layer_tiling_data.h" 35 #include "cc/resources/layer_tiling_data.h"
36 #include "cc/test/animation_test_common.h" 36 #include "cc/test/animation_test_common.h"
37 #include "cc/test/fake_layer_tree_host_impl.h"
37 #include "cc/test/fake_output_surface.h" 38 #include "cc/test/fake_output_surface.h"
38 #include "cc/test/fake_output_surface_client.h" 39 #include "cc/test/fake_output_surface_client.h"
39 #include "cc/test/fake_proxy.h" 40 #include "cc/test/fake_proxy.h"
40 #include "cc/test/fake_rendering_stats_instrumentation.h" 41 #include "cc/test/fake_rendering_stats_instrumentation.h"
41 #include "cc/test/fake_video_frame_provider.h" 42 #include "cc/test/fake_video_frame_provider.h"
42 #include "cc/test/geometry_test_utils.h" 43 #include "cc/test/geometry_test_utils.h"
43 #include "cc/test/layer_test_common.h" 44 #include "cc/test/layer_test_common.h"
44 #include "cc/test/render_pass_test_common.h" 45 #include "cc/test/render_pass_test_common.h"
45 #include "cc/trees/layer_tree_impl.h" 46 #include "cc/trees/layer_tree_impl.h"
46 #include "cc/trees/single_thread_proxy.h" 47 #include "cc/trees/single_thread_proxy.h"
(...skipping 6374 matching lines...) Expand 10 before | Expand all | Expand 10 after
6421 6422
6422 host_impl_->SetVisible(false); 6423 host_impl_->SetVisible(false);
6423 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); 6424 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_);
6424 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); 6425 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_);
6425 6426
6426 host_impl_->SetVisible(true); 6427 host_impl_->SetVisible(true);
6427 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 6428 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
6428 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); 6429 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_);
6429 } 6430 }
6430 6431
6432 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest {
6433 public:
6434 virtual void SetUp() OVERRIDE {
6435 LayerTreeSettings settings;
6436 settings.impl_side_painting = true;
6437
6438 fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_);
6439 host_impl_.reset(fake_host_impl_);
6440 host_impl_->InitializeRenderer(CreateOutputSurface());
6441 host_impl_->SetViewportSize(gfx::Size(10, 10));
6442 }
6443
6444 FakeLayerTreeHostImpl* fake_host_impl_;
6445 };
6446
6447 TEST_F(LayerTreeHostImplTestManageTiles, ManageTilesWhenInvisible) {
6448 fake_host_impl_->SetNeedsManageTiles();
6449 EXPECT_TRUE(fake_host_impl_->manage_tiles_needed());
6450 fake_host_impl_->SetVisible(false);
6451 EXPECT_FALSE(fake_host_impl_->manage_tiles_needed());
6452 }
6453
6431 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { 6454 TEST_F(LayerTreeHostImplTest, UIResourceManagement) {
6432 scoped_ptr<TestWebGraphicsContext3D> context = 6455 scoped_ptr<TestWebGraphicsContext3D> context =
6433 TestWebGraphicsContext3D::Create(); 6456 TestWebGraphicsContext3D::Create();
6434 TestWebGraphicsContext3D* context3d = context.get(); 6457 TestWebGraphicsContext3D* context3d = context.get();
6435 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); 6458 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface();
6436 host_impl_->InitializeRenderer(output_surface.Pass()); 6459 host_impl_->InitializeRenderer(output_surface.Pass());
6437 6460
6438 EXPECT_EQ(0u, context3d->NumTextures()); 6461 EXPECT_EQ(0u, context3d->NumTextures());
6439 6462
6440 UIResourceId ui_resource_id = 1; 6463 UIResourceId ui_resource_id = 1;
(...skipping 27 matching lines...) Expand all
6468 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); 6491 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id));
6469 EXPECT_EQ(0u, context3d->NumTextures()); 6492 EXPECT_EQ(0u, context3d->NumTextures());
6470 6493
6471 // Should not change state for multiple deletion on one UIResourceId 6494 // Should not change state for multiple deletion on one UIResourceId
6472 host_impl_->DeleteUIResource(ui_resource_id); 6495 host_impl_->DeleteUIResource(ui_resource_id);
6473 EXPECT_EQ(0u, context3d->NumTextures()); 6496 EXPECT_EQ(0u, context3d->NumTextures());
6474 } 6497 }
6475 6498
6476 } // namespace 6499 } // namespace
6477 } // namespace cc 6500 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698