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

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

Issue 287553003: cc: Set requires high res upon becoming visible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « cc/trees/layer_tree_host_impl.cc ('k') | 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 5722 matching lines...) Expand 10 before | Expand all | Expand 10 after
5733 host_impl_->SetVisible(true); 5733 host_impl_->SetVisible(true);
5734 host_impl_->SetMemoryPolicy(policy1); 5734 host_impl_->SetMemoryPolicy(policy1);
5735 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5735 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5736 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_); 5736 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_);
5737 5737
5738 host_impl_->SetVisible(false); 5738 host_impl_->SetVisible(false);
5739 EXPECT_EQ(0u, current_limit_bytes_); 5739 EXPECT_EQ(0u, current_limit_bytes_);
5740 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); 5740 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_);
5741 } 5741 }
5742 5742
5743 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) {
5744 ASSERT_TRUE(host_impl_->active_tree());
5745
5746 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5747 host_impl_->SetVisible(false);
5748 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5749 host_impl_->SetVisible(true);
5750 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5751 host_impl_->SetVisible(false);
5752 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5753
5754 host_impl_->CreatePendingTree();
5755 host_impl_->ActivatePendingTree();
5756
5757 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5758 host_impl_->SetVisible(true);
5759 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5760 }
5761
5743 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest { 5762 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest {
5744 public: 5763 public:
5745 virtual void SetUp() OVERRIDE { 5764 virtual void SetUp() OVERRIDE {
5746 LayerTreeSettings settings; 5765 LayerTreeSettings settings;
5747 settings.impl_side_painting = true; 5766 settings.impl_side_painting = true;
5748 5767
5749 fake_host_impl_ = new FakeLayerTreeHostImpl( 5768 fake_host_impl_ = new FakeLayerTreeHostImpl(
5750 settings, &proxy_, shared_bitmap_manager_.get()); 5769 settings, &proxy_, shared_bitmap_manager_.get());
5751 host_impl_.reset(fake_host_impl_); 5770 host_impl_.reset(fake_host_impl_);
5752 host_impl_->InitializeRenderer(CreateOutputSurface()); 5771 host_impl_->InitializeRenderer(CreateOutputSurface());
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
6567 FakePictureLayerImpl* active_mask_content = 6586 FakePictureLayerImpl* active_mask_content =
6568 static_cast<FakePictureLayerImpl*>( 6587 static_cast<FakePictureLayerImpl*>(
6569 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); 6588 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer());
6570 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); 6589 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority();
6571 6590
6572 ASSERT_TRUE(!r2.IsEmpty()); 6591 ASSERT_TRUE(!r2.IsEmpty());
6573 } 6592 }
6574 6593
6575 } // namespace 6594 } // namespace
6576 } // namespace cc 6595 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698