| 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/impl_side_painting_settings.h" | 13 #include "cc/test/impl_side_painting_settings.h" |
| 14 #include "cc/trees/occlusion_tracker.h" | 14 #include "cc/trees/occlusion_tracker.h" |
| 15 #include "cc/trees/single_thread_proxy.h" | 15 #include "cc/trees/single_thread_proxy.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class MockContentLayerClient : public ContentLayerClient { | 21 class MockContentLayerClient : public ContentLayerClient { |
| 22 public: | 22 public: |
| 23 void PaintContents( | 23 void PaintContents( |
| 24 SkCanvas* canvas, | 24 SkCanvas* canvas, |
| 25 const gfx::Rect& clip, | 25 const gfx::Rect& clip, |
| 26 ContentLayerClient::GraphicsContextStatus gc_status) override {} | 26 ContentLayerClient::GraphicsContextStatus gc_status) override {} |
| 27 void DidChangeLayerCanUseLCDText() override {} |
| 27 bool FillsBoundsCompletely() const override { return false; }; | 28 bool FillsBoundsCompletely() const override { return false; }; |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 31 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
| 31 MockContentLayerClient client; | 32 MockContentLayerClient client; |
| 32 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 33 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 33 layer->SetBounds(gfx::Size(10, 10)); | 34 layer->SetBounds(gfx::Size(10, 10)); |
| 34 | 35 |
| 35 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 36 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 36 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); | 37 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 99 |
| 99 // Tile-grid is set according to its setting. | 100 // Tile-grid is set according to its setting. |
| 100 SkTileGridFactory::TileGridInfo info = | 101 SkTileGridFactory::TileGridInfo info = |
| 101 layer->GetRecordingSourceForTesting()->GetTileGridInfoForTesting(); | 102 layer->GetRecordingSourceForTesting()->GetTileGridInfoForTesting(); |
| 102 EXPECT_EQ(info.fTileInterval.width(), 123 - 2 * info.fMargin.width()); | 103 EXPECT_EQ(info.fTileInterval.width(), 123 - 2 * info.fMargin.width()); |
| 103 EXPECT_EQ(info.fTileInterval.height(), 123 - 2 * info.fMargin.height()); | 104 EXPECT_EQ(info.fTileInterval.height(), 123 - 2 * info.fMargin.height()); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace | 107 } // namespace |
| 107 } // namespace cc | 108 } // namespace cc |
| OLD | NEW |