| Index: cc/trees/layer_tree_host_impl_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
|
| index 22174b4aff7beb19cca12041c12a74897e332b65..5f45115f186bfca8df31ae02898470f73494daa3 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -5848,5 +5848,30 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) {
|
| EXPECT_FALSE(did_request_redraw_);
|
| }
|
|
|
| +class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest {
|
| + public:
|
| + virtual void SetUp() OVERRIDE {
|
| + LayerTreeSettings settings = DefaultSettings();
|
| + settings.max_unused_resource_memory_percentage = 50;
|
| + settings.max_memory_for_prepaint_percentage = 50;
|
| + CreateHostImpl(settings, CreateOutputSurface());
|
| + }
|
| +};
|
| +
|
| +TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) {
|
| + // Set up a memory policy and percentages which could cause
|
| + // 32-bit integer overflows.
|
| + ManagedMemoryPolicy mem_policy(300 * 1024 * 1024); // 300MB
|
| +
|
| + // Verify implicit limits are calculated correctly with no overflows
|
| + host_impl_->SetMemoryPolicy(mem_policy);
|
| + EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes,
|
| + 300u * 1024u * 1024u);
|
| + EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes,
|
| + 150u * 1024u * 1024u);
|
| + EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes,
|
| + 75u * 1024u * 1024u);
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|