| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
| 6 | 6 |
| 7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
| 8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
| 9 #include "cc/resources/resource_update_queue.h" | 9 #include "cc/resources/resource_update_queue.h" |
| 10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
| 11 #include "cc/test/fake_picture_layer_impl.h" | 11 #include "cc/test/fake_picture_layer_impl.h" |
| 12 #include "cc/test/fake_proxy.h" | 12 #include "cc/test/fake_proxy.h" |
| 13 #include "cc/test/gpu_rasterization_settings.h" | 13 #include "cc/test/gpu_rasterization_settings.h" |
| 14 #include "cc/test/hybrid_rasterization_settings.h" | 14 #include "cc/test/hybrid_rasterization_settings.h" |
| 15 #include "cc/test/impl_side_painting_settings.h" | 15 #include "cc/test/impl_side_painting_settings.h" |
| 16 #include "cc/trees/occlusion_tracker.h" | 16 #include "cc/trees/occlusion_tracker.h" |
| 17 #include "cc/trees/single_thread_proxy.h" | 17 #include "cc/trees/single_thread_proxy.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class MockContentLayerClient : public ContentLayerClient { | 23 class MockContentLayerClient : public ContentLayerClient { |
| 24 public: | 24 public: |
| 25 virtual void PaintContents(SkCanvas* canvas, | 25 virtual void PaintContents( |
| 26 const gfx::Rect& clip, | 26 SkCanvas* canvas, |
| 27 gfx::RectF* opaque) OVERRIDE {} | 27 const gfx::Rect& clip, |
| 28 gfx::RectF* opaque, |
| 29 ContentLayerClient::GraphicsContextStatus) OVERRIDE {} |
| 28 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 30 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} |
| 29 virtual bool FillsBoundsCompletely() const OVERRIDE { | 31 virtual bool FillsBoundsCompletely() const OVERRIDE { |
| 30 return false; | 32 return false; |
| 31 }; | 33 }; |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 36 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
| 35 MockContentLayerClient client; | 37 MockContentLayerClient client; |
| 36 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 38 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 37 layer->SetBounds(gfx::Size(10, 10)); | 39 layer->SetBounds(gfx::Size(10, 10)); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 147 |
| 146 // Veto gpu rasterization. | 148 // Veto gpu rasterization. |
| 147 PicturePile* pile = layer->GetPicturePileForTesting(); | 149 PicturePile* pile = layer->GetPicturePileForTesting(); |
| 148 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); | 150 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); |
| 149 pile->SetUnsuitableForGpuRasterizationForTesting(); | 151 pile->SetUnsuitableForGpuRasterizationForTesting(); |
| 150 EXPECT_FALSE(layer->ShouldUseGpuRasterization()); | 152 EXPECT_FALSE(layer->ShouldUseGpuRasterization()); |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace | 155 } // namespace |
| 154 } // namespace cc | 156 } // namespace cc |
| OLD | NEW |