| 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" | |
| 16 #include "cc/trees/occlusion_tracker.h" | 15 #include "cc/trees/occlusion_tracker.h" |
| 17 #include "cc/trees/single_thread_proxy.h" | 16 #include "cc/trees/single_thread_proxy.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 18 |
| 20 namespace cc { | 19 namespace cc { |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 class MockContentLayerClient : public ContentLayerClient { | 22 class MockContentLayerClient : public ContentLayerClient { |
| 24 public: | 23 public: |
| 25 virtual void PaintContents(SkCanvas* canvas, | 24 virtual void PaintContents(SkCanvas* canvas, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 layer->SavePaintProperties(); | 48 layer->SavePaintProperties(); |
| 50 // Intentionally skipping Update since it would normally be skipped on | 49 // Intentionally skipping Update since it would normally be skipped on |
| 51 // a layer with empty bounds. | 50 // a layer with empty bounds. |
| 52 | 51 |
| 53 FakeProxy proxy; | 52 FakeProxy proxy; |
| 54 { | 53 { |
| 55 DebugScopedSetImplThread impl_thread(&proxy); | 54 DebugScopedSetImplThread impl_thread(&proxy); |
| 56 | 55 |
| 57 TestSharedBitmapManager shared_bitmap_manager; | 56 TestSharedBitmapManager shared_bitmap_manager; |
| 58 FakeLayerTreeHostImpl host_impl( | 57 FakeLayerTreeHostImpl host_impl( |
| 59 ImplSidePaintingSettings(), &proxy, &shared_bitmap_manager); | 58 LayerTreeSettings(true), &proxy, &shared_bitmap_manager); |
| 60 host_impl.CreatePendingTree(); | 59 host_impl.CreatePendingTree(); |
| 61 scoped_ptr<FakePictureLayerImpl> layer_impl = | 60 scoped_ptr<FakePictureLayerImpl> layer_impl = |
| 62 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); | 61 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); |
| 63 | 62 |
| 64 layer->PushPropertiesTo(layer_impl.get()); | 63 layer->PushPropertiesTo(layer_impl.get()); |
| 65 EXPECT_FALSE(layer_impl->CanHaveTilings()); | 64 EXPECT_FALSE(layer_impl->CanHaveTilings()); |
| 66 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); | 65 EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); |
| 67 EXPECT_TRUE(layer_impl->pile()->tiling_rect() == gfx::Rect()); | 66 EXPECT_TRUE(layer_impl->pile()->tiling_rect() == gfx::Rect()); |
| 68 EXPECT_FALSE(layer_impl->pile()->HasRecordings()); | 67 EXPECT_FALSE(layer_impl->pile()->HasRecordings()); |
| 69 } | 68 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 144 |
| 146 // Veto gpu rasterization. | 145 // Veto gpu rasterization. |
| 147 PicturePile* pile = layer->GetPicturePileForTesting(); | 146 PicturePile* pile = layer->GetPicturePileForTesting(); |
| 148 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); | 147 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); |
| 149 pile->SetUnsuitableForGpuRasterizationForTesting(); | 148 pile->SetUnsuitableForGpuRasterizationForTesting(); |
| 150 EXPECT_FALSE(layer->ShouldUseGpuRasterization()); | 149 EXPECT_FALSE(layer->ShouldUseGpuRasterization()); |
| 151 } | 150 } |
| 152 | 151 |
| 153 } // namespace | 152 } // namespace |
| 154 } // namespace cc | 153 } // namespace cc |
| OLD | NEW |