| 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 "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
| 9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
| 10 #include "cc/resources/resource_update_queue.h" | 10 #include "cc/resources/resource_update_queue.h" |
| 11 #include "cc/test/fake_layer_tree_host.h" | 11 #include "cc/test/fake_layer_tree_host.h" |
| 12 #include "cc/test/fake_picture_layer.h" | 12 #include "cc/test/fake_picture_layer.h" |
| 13 #include "cc/test/fake_picture_layer_impl.h" | 13 #include "cc/test/fake_picture_layer_impl.h" |
| 14 #include "cc/test/fake_proxy.h" | 14 #include "cc/test/fake_proxy.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 void PaintContents(SkCanvas* canvas, | 25 void PaintContents(SkCanvas* canvas, |
| 26 const gfx::Rect& clip, | 26 const gfx::Rect& clip, |
| 27 PaintingControlSetting picture_control) override {} | 27 PaintingControlSetting picture_control) override {} |
| 28 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 28 void PaintContentsToDisplayList( |
| 29 DisplayItemList* display_list, |
| 29 const gfx::Rect& clip, | 30 const gfx::Rect& clip, |
| 30 PaintingControlSetting picture_control) override { | 31 PaintingControlSetting picture_control) override { |
| 31 NOTIMPLEMENTED(); | 32 NOTIMPLEMENTED(); |
| 32 return DisplayItemList::Create(); | |
| 33 } | 33 } |
| 34 bool FillsBoundsCompletely() const override { return false; }; | 34 bool FillsBoundsCompletely() const override { return false; }; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 37 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
| 38 MockContentLayerClient client; | 38 MockContentLayerClient client; |
| 39 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 39 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 40 layer->SetBounds(gfx::Size(10, 10)); | 40 layer->SetBounds(gfx::Size(10, 10)); |
| 41 | 41 |
| 42 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 42 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Do a main frame, record the picture layers. The frame number has changed | 161 // Do a main frame, record the picture layers. The frame number has changed |
| 162 // non-monotonically. | 162 // non-monotonically. |
| 163 layer->SetNeedsDisplay(); | 163 layer->SetNeedsDisplay(); |
| 164 host2->Composite(base::TimeTicks::Now()); | 164 host2->Composite(base::TimeTicks::Now()); |
| 165 EXPECT_EQ(3u, layer->update_count()); | 165 EXPECT_EQ(3u, layer->update_count()); |
| 166 EXPECT_EQ(1, host2->source_frame_number()); | 166 EXPECT_EQ(1, host2->source_frame_number()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace | 169 } // namespace |
| 170 } // namespace cc | 170 } // namespace cc |
| OLD | NEW |