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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 }; | 43 }; |
44 | 44 |
45 TEST_F(NinePatchLayerTest, SetLayerProperties) { | 45 TEST_F(NinePatchLayerTest, SetLayerProperties) { |
46 scoped_refptr<NinePatchLayer> test_layer = NinePatchLayer::Create(); | 46 scoped_refptr<NinePatchLayer> test_layer = NinePatchLayer::Create(); |
47 ASSERT_TRUE(test_layer.get()); | 47 ASSERT_TRUE(test_layer.get()); |
48 test_layer->SetIsDrawable(true); | 48 test_layer->SetIsDrawable(true); |
49 test_layer->SetBounds(gfx::Size(100, 100)); | 49 test_layer->SetBounds(gfx::Size(100, 100)); |
50 | 50 |
51 layer_tree_host_->SetRootLayer(test_layer); | 51 layer_tree_host_->SetRootLayer(test_layer); |
52 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 52 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
53 EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); | 53 EXPECT_EQ(test_layer->GetLayerTreeHostForTesting(), layer_tree_host_.get()); |
54 | 54 |
55 gfx::Rect screen_space_clip_rect; | 55 gfx::Rect screen_space_clip_rect; |
56 test_layer->SavePaintProperties(); | 56 test_layer->SavePaintProperties(); |
57 test_layer->Update(); | 57 test_layer->Update(); |
58 | 58 |
59 EXPECT_FALSE(test_layer->DrawsContent()); | 59 EXPECT_FALSE(test_layer->DrawsContent()); |
60 | 60 |
61 bool is_opaque = false; | 61 bool is_opaque = false; |
62 std::unique_ptr<ScopedUIResource> resource = | 62 std::unique_ptr<ScopedUIResource> resource = |
63 ScopedUIResource::Create(layer_tree_host_->GetUIResourceManager(), | 63 ScopedUIResource::Create(layer_tree_host_->GetUIResourceManager(), |
64 UIResourceBitmap(gfx::Size(10, 10), is_opaque)); | 64 UIResourceBitmap(gfx::Size(10, 10), is_opaque)); |
65 gfx::Rect aperture(5, 5, 1, 1); | 65 gfx::Rect aperture(5, 5, 1, 1); |
66 bool fill_center = true; | 66 bool fill_center = true; |
67 test_layer->SetAperture(aperture); | 67 test_layer->SetAperture(aperture); |
68 test_layer->SetUIResourceId(resource->id()); | 68 test_layer->SetUIResourceId(resource->id()); |
69 test_layer->SetFillCenter(fill_center); | 69 test_layer->SetFillCenter(fill_center); |
70 test_layer->Update(); | 70 test_layer->Update(); |
71 | 71 |
72 EXPECT_TRUE(test_layer->DrawsContent()); | 72 EXPECT_TRUE(test_layer->DrawsContent()); |
73 } | 73 } |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 } // namespace cc | 76 } // namespace cc |
OLD | NEW |