| 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/layer_settings.h" | 9 #include "cc/layers/layer_settings.h" |
| 10 #include "cc/layers/picture_layer_impl.h" | 10 #include "cc/layers/picture_layer_impl.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 namespace cc { | 23 namespace cc { |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 class MockContentLayerClient : public ContentLayerClient { | 26 class MockContentLayerClient : public ContentLayerClient { |
| 27 public: | 27 public: |
| 28 gfx::Rect PaintableRegion() override { return gfx::Rect(); } | 28 gfx::Rect PaintableRegion() override { return gfx::Rect(); } |
| 29 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 29 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
| 30 PaintingControlSetting picture_control) override { | 30 PaintingControlSetting picture_control) override { |
| 31 return DisplayItemList::Create(gfx::Rect(), DisplayItemListSettings()); | 31 return DisplayItemList::Create(DisplayItemListSettings()); |
| 32 } | 32 } |
| 33 bool FillsBoundsCompletely() const override { return false; }; | 33 bool FillsBoundsCompletely() const override { return false; }; |
| 34 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } | 34 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 37 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
| 38 MockContentLayerClient client; | 38 MockContentLayerClient client; |
| 39 scoped_refptr<PictureLayer> layer = | 39 scoped_refptr<PictureLayer> layer = |
| 40 PictureLayer::Create(LayerSettings(), &client); | 40 PictureLayer::Create(LayerSettings(), &client); |
| 41 layer->SetBounds(gfx::Size(10, 10)); | 41 layer->SetBounds(gfx::Size(10, 10)); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // Do a main frame, record the picture layers. The frame number has changed | 167 // Do a main frame, record the picture layers. The frame number has changed |
| 168 // non-monotonically. | 168 // non-monotonically. |
| 169 layer->SetNeedsDisplay(); | 169 layer->SetNeedsDisplay(); |
| 170 host2->Composite(base::TimeTicks::Now()); | 170 host2->Composite(base::TimeTicks::Now()); |
| 171 EXPECT_EQ(3, layer->update_count()); | 171 EXPECT_EQ(3, layer->update_count()); |
| 172 EXPECT_EQ(1, host2->source_frame_number()); | 172 EXPECT_EQ(1, host2->source_frame_number()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace | 175 } // namespace |
| 176 } // namespace cc | 176 } // namespace cc |
| OLD | NEW |