| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 virtual bool FillsBoundsCompletely() const OVERRIDE { | 28 virtual bool FillsBoundsCompletely() const OVERRIDE { |
| 29 return false; | 29 return false; |
| 30 }; | 30 }; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 33 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
| 34 MockContentLayerClient client; | 34 MockContentLayerClient client; |
| 35 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 35 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 36 layer->SetBounds(gfx::Size(10, 10)); | 36 layer->SetBounds(gfx::Size(10, 10)); |
| 37 | 37 |
| 38 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 38 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 39 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
| 39 host->SetRootLayer(layer); | 40 host->SetRootLayer(layer); |
| 40 layer->SetIsDrawable(true); | 41 layer->SetIsDrawable(true); |
| 41 layer->SavePaintProperties(); | 42 layer->SavePaintProperties(); |
| 42 | 43 |
| 43 OcclusionTracker<Layer> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 44 OcclusionTracker<Layer> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 44 scoped_ptr<ResourceUpdateQueue> queue(new ResourceUpdateQueue); | 45 scoped_ptr<ResourceUpdateQueue> queue(new ResourceUpdateQueue); |
| 45 layer->Update(queue.get(), &occlusion); | 46 layer->Update(queue.get(), &occlusion); |
| 46 | 47 |
| 47 layer->SetBounds(gfx::Size(0, 0)); | 48 layer->SetBounds(gfx::Size(0, 0)); |
| 48 layer->SavePaintProperties(); | 49 layer->SavePaintProperties(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 pile->SetUnsuitableForGpuRasterizationForTesting(); | 82 pile->SetUnsuitableForGpuRasterizationForTesting(); |
| 82 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); | 83 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); |
| 83 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 84 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
| 84 } | 85 } |
| 85 | 86 |
| 86 TEST(PictureLayerTest, RecordingModes) { | 87 TEST(PictureLayerTest, RecordingModes) { |
| 87 MockContentLayerClient client; | 88 MockContentLayerClient client; |
| 88 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 89 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 89 | 90 |
| 90 LayerTreeSettings settings; | 91 LayerTreeSettings settings; |
| 91 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(settings); | 92 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 93 scoped_ptr<FakeLayerTreeHost> host = |
| 94 FakeLayerTreeHost::Create(&host_client, settings); |
| 92 host->SetRootLayer(layer); | 95 host->SetRootLayer(layer); |
| 93 EXPECT_EQ(Picture::RECORD_NORMALLY, layer->RecordingMode()); | 96 EXPECT_EQ(Picture::RECORD_NORMALLY, layer->RecordingMode()); |
| 94 | 97 |
| 95 settings.recording_mode = LayerTreeSettings::RecordWithSkRecord; | 98 settings.recording_mode = LayerTreeSettings::RecordWithSkRecord; |
| 96 host = FakeLayerTreeHost::Create(settings); | 99 host = FakeLayerTreeHost::Create(&host_client, settings); |
| 97 host->SetRootLayer(layer); | 100 host->SetRootLayer(layer); |
| 98 EXPECT_EQ(Picture::RECORD_WITH_SKRECORD, layer->RecordingMode()); | 101 EXPECT_EQ(Picture::RECORD_WITH_SKRECORD, layer->RecordingMode()); |
| 99 } | 102 } |
| 100 | 103 |
| 101 } // namespace | 104 } // namespace |
| 102 } // namespace cc | 105 } // namespace cc |
| OLD | NEW |