| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/nine_patch_layer.h" | 5 #include "cc/layers/nine_patch_layer.h" |
| 6 | 6 |
| 7 #include "cc/resources/prioritized_resource_manager.h" | 7 #include "cc/resources/prioritized_resource_manager.h" |
| 8 #include "cc/resources/resource_provider.h" | 8 #include "cc/resources/resource_provider.h" |
| 9 #include "cc/resources/resource_update_queue.h" | 9 #include "cc/resources/resource_update_queue.h" |
| 10 #include "cc/resources/scoped_ui_resource.h" | 10 #include "cc/resources/scoped_ui_resource.h" |
| 11 #include "cc/test/fake_layer_tree_host.h" | 11 #include "cc/test/fake_layer_tree_host.h" |
| 12 #include "cc/test/fake_layer_tree_host_client.h" | 12 #include "cc/test/fake_layer_tree_host_client.h" |
| 13 #include "cc/test/fake_output_surface.h" | 13 #include "cc/test/fake_output_surface.h" |
| 14 #include "cc/test/fake_output_surface_client.h" | 14 #include "cc/test/fake_output_surface_client.h" |
| 15 #include "cc/test/geometry_test_utils.h" | 15 #include "cc/test/geometry_test_utils.h" |
| 16 #include "cc/test/test_shared_bitmap_manager.h" | 16 #include "cc/test/test_task_graph_runner.h" |
| 17 #include "cc/trees/layer_tree_host.h" | 17 #include "cc/trees/layer_tree_host.h" |
| 18 #include "cc/trees/single_thread_proxy.h" | 18 #include "cc/trees/single_thread_proxy.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 22 | 22 |
| 23 using ::testing::Mock; | 23 using ::testing::Mock; |
| 24 using ::testing::_; | 24 using ::testing::_; |
| 25 using ::testing::AtLeast; | 25 using ::testing::AtLeast; |
| 26 using ::testing::AnyNumber; | 26 using ::testing::AnyNumber; |
| 27 | 27 |
| 28 namespace cc { | 28 namespace cc { |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 class NinePatchLayerTest : public testing::Test { | 31 class NinePatchLayerTest : public testing::Test { |
| 32 public: | 32 public: |
| 33 NinePatchLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} | 33 NinePatchLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 void SetUp() override { | 36 void SetUp() override { |
| 37 layer_tree_host_ = FakeLayerTreeHost::Create(&fake_client_); | 37 layer_tree_host_ = |
| 38 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 38 } | 39 } |
| 39 | 40 |
| 40 void TearDown() override { | 41 void TearDown() override { |
| 41 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 42 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 42 } | 43 } |
| 43 | 44 |
| 44 FakeLayerTreeHostClient fake_client_; | 45 FakeLayerTreeHostClient fake_client_; |
| 46 TestTaskGraphRunner task_graph_runner_; |
| 45 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; | 47 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 TEST_F(NinePatchLayerTest, SetLayerProperties) { | 50 TEST_F(NinePatchLayerTest, SetLayerProperties) { |
| 49 scoped_refptr<NinePatchLayer> test_layer = | 51 scoped_refptr<NinePatchLayer> test_layer = |
| 50 NinePatchLayer::Create(LayerSettings()); | 52 NinePatchLayer::Create(LayerSettings()); |
| 51 ASSERT_TRUE(test_layer.get()); | 53 ASSERT_TRUE(test_layer.get()); |
| 52 test_layer->SetIsDrawable(true); | 54 test_layer->SetIsDrawable(true); |
| 53 test_layer->SetBounds(gfx::Size(100, 100)); | 55 test_layer->SetBounds(gfx::Size(100, 100)); |
| 54 | 56 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 test_layer->SetAperture(aperture); | 73 test_layer->SetAperture(aperture); |
| 72 test_layer->SetUIResourceId(resource->id()); | 74 test_layer->SetUIResourceId(resource->id()); |
| 73 test_layer->SetFillCenter(fill_center); | 75 test_layer->SetFillCenter(fill_center); |
| 74 test_layer->Update(&queue); | 76 test_layer->Update(&queue); |
| 75 | 77 |
| 76 EXPECT_TRUE(test_layer->DrawsContent()); | 78 EXPECT_TRUE(test_layer->DrawsContent()); |
| 77 } | 79 } |
| 78 | 80 |
| 79 } // namespace | 81 } // namespace |
| 80 } // namespace cc | 82 } // namespace cc |
| OLD | NEW |