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/resource_provider.h" | 7 #include "cc/resources/resource_provider.h" |
8 #include "cc/resources/scoped_ui_resource.h" | 8 #include "cc/resources/scoped_ui_resource.h" |
9 #include "cc/test/fake_layer_tree_host.h" | 9 #include "cc/test/fake_layer_tree_host.h" |
10 #include "cc/test/fake_layer_tree_host_client.h" | 10 #include "cc/test/fake_layer_tree_host_client.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 layer_tree_host_ = | 35 layer_tree_host_ = |
36 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 36 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
37 } | 37 } |
38 | 38 |
39 void TearDown() override { | 39 void TearDown() override { |
40 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 40 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
41 } | 41 } |
42 | 42 |
43 FakeLayerTreeHostClient fake_client_; | 43 FakeLayerTreeHostClient fake_client_; |
44 TestTaskGraphRunner task_graph_runner_; | 44 TestTaskGraphRunner task_graph_runner_; |
45 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; | 45 std::unique_ptr<FakeLayerTreeHost> layer_tree_host_; |
46 }; | 46 }; |
47 | 47 |
48 TEST_F(NinePatchLayerTest, SetLayerProperties) { | 48 TEST_F(NinePatchLayerTest, SetLayerProperties) { |
49 scoped_refptr<NinePatchLayer> test_layer = NinePatchLayer::Create(); | 49 scoped_refptr<NinePatchLayer> test_layer = NinePatchLayer::Create(); |
50 ASSERT_TRUE(test_layer.get()); | 50 ASSERT_TRUE(test_layer.get()); |
51 test_layer->SetIsDrawable(true); | 51 test_layer->SetIsDrawable(true); |
52 test_layer->SetBounds(gfx::Size(100, 100)); | 52 test_layer->SetBounds(gfx::Size(100, 100)); |
53 | 53 |
54 layer_tree_host_->SetRootLayer(test_layer); | 54 layer_tree_host_->SetRootLayer(test_layer); |
55 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 55 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
56 EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); | 56 EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); |
57 | 57 |
58 gfx::Rect screen_space_clip_rect; | 58 gfx::Rect screen_space_clip_rect; |
59 test_layer->SavePaintProperties(); | 59 test_layer->SavePaintProperties(); |
60 test_layer->Update(); | 60 test_layer->Update(); |
61 | 61 |
62 EXPECT_FALSE(test_layer->DrawsContent()); | 62 EXPECT_FALSE(test_layer->DrawsContent()); |
63 | 63 |
64 bool is_opaque = false; | 64 bool is_opaque = false; |
65 scoped_ptr<ScopedUIResource> resource = ScopedUIResource::Create( | 65 std::unique_ptr<ScopedUIResource> resource = ScopedUIResource::Create( |
66 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque)); | 66 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque)); |
67 gfx::Rect aperture(5, 5, 1, 1); | 67 gfx::Rect aperture(5, 5, 1, 1); |
68 bool fill_center = true; | 68 bool fill_center = true; |
69 test_layer->SetAperture(aperture); | 69 test_layer->SetAperture(aperture); |
70 test_layer->SetUIResourceId(resource->id()); | 70 test_layer->SetUIResourceId(resource->id()); |
71 test_layer->SetFillCenter(fill_center); | 71 test_layer->SetFillCenter(fill_center); |
72 test_layer->Update(); | 72 test_layer->Update(); |
73 | 73 |
74 EXPECT_TRUE(test_layer->DrawsContent()); | 74 EXPECT_TRUE(test_layer->DrawsContent()); |
75 } | 75 } |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 } // namespace cc | 78 } // namespace cc |
OLD | NEW |