| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "cc/test/fake_layer_tree_host.h" | 22 #include "cc/test/fake_layer_tree_host.h" |
| 23 #include "cc/test/fake_picture_layer.h" | 23 #include "cc/test/fake_picture_layer.h" |
| 24 #include "cc/test/fake_picture_layer_impl.h" | 24 #include "cc/test/fake_picture_layer_impl.h" |
| 25 #include "cc/test/fake_proxy.h" | 25 #include "cc/test/fake_proxy.h" |
| 26 #include "cc/test/fake_recording_source.h" | 26 #include "cc/test/fake_recording_source.h" |
| 27 #include "cc/test/layer_tree_settings_for_testing.h" | 27 #include "cc/test/layer_tree_settings_for_testing.h" |
| 28 #include "cc/test/skia_common.h" | 28 #include "cc/test/skia_common.h" |
| 29 #include "cc/test/stub_layer_tree_host_single_thread_client.h" | 29 #include "cc/test/stub_layer_tree_host_single_thread_client.h" |
| 30 #include "cc/test/test_task_graph_runner.h" | 30 #include "cc/test/test_task_graph_runner.h" |
| 31 #include "cc/trees/single_thread_proxy.h" | 31 #include "cc/trees/single_thread_proxy.h" |
| 32 #include "skia/ext/cdl_paint.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 34 #include "third_party/skia/include/core/SkRefCnt.h" | 35 #include "third_party/skia/include/core/SkRefCnt.h" |
| 35 | 36 |
| 36 namespace cc { | 37 namespace cc { |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 41 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
| 41 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 42 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 layer->PushPropertiesTo(layer_impl); | 164 layer->PushPropertiesTo(layer_impl); |
| 164 | 165 |
| 165 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); | 166 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); |
| 166 } | 167 } |
| 167 | 168 |
| 168 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { | 169 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { |
| 169 gfx::Size layer_size(50, 50); | 170 gfx::Size layer_size(50, 50); |
| 170 FakeContentLayerClient client; | 171 FakeContentLayerClient client; |
| 171 client.set_bounds(layer_size); | 172 client.set_bounds(layer_size); |
| 172 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), | 173 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), |
| 173 SkPaint()); | 174 CdlPaint()); |
| 174 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 175 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 175 layer->SetBounds(gfx::Size(10, 10)); | 176 layer->SetBounds(gfx::Size(10, 10)); |
| 176 | 177 |
| 177 FakeLayerTreeHostClient host_client; | 178 FakeLayerTreeHostClient host_client; |
| 178 TestTaskGraphRunner task_graph_runner; | 179 TestTaskGraphRunner task_graph_runner; |
| 179 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 180 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 180 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( | 181 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
| 181 &host_client, &task_graph_runner, animation_host.get()); | 182 &host_client, &task_graph_runner, animation_host.get()); |
| 182 host->GetLayerTree()->SetRootLayer(layer); | 183 host->GetLayerTree()->SetRootLayer(layer); |
| 183 layer->SetIsDrawable(true); | 184 layer->SetIsDrawable(true); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 host2->Composite(base::TimeTicks::Now()); | 359 host2->Composite(base::TimeTicks::Now()); |
| 359 EXPECT_EQ(3, layer->update_count()); | 360 EXPECT_EQ(3, layer->update_count()); |
| 360 EXPECT_EQ(1, host2->SourceFrameNumber()); | 361 EXPECT_EQ(1, host2->SourceFrameNumber()); |
| 361 | 362 |
| 362 animation_host->SetMutatorHostClient(nullptr); | 363 animation_host->SetMutatorHostClient(nullptr); |
| 363 animation_host2->SetMutatorHostClient(nullptr); | 364 animation_host2->SetMutatorHostClient(nullptr); |
| 364 } | 365 } |
| 365 | 366 |
| 366 } // namespace | 367 } // namespace |
| 367 } // namespace cc | 368 } // namespace cc |
| OLD | NEW |