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/ui_resource_layer.h" | 5 #include "cc/layers/ui_resource_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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 namespace cc { | 28 namespace cc { |
29 namespace { | 29 namespace { |
30 | 30 |
31 class UIResourceLayerTest : public testing::Test { | 31 class UIResourceLayerTest : public testing::Test { |
32 public: | 32 public: |
33 UIResourceLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} | 33 UIResourceLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} |
34 | 34 |
35 protected: | 35 protected: |
36 virtual void SetUp() { | 36 virtual void SetUp() { |
37 layer_tree_host_ = FakeLayerTreeHost::Create(); | 37 layer_tree_host_ = FakeLayerTreeHost::Create(&fake_client_); |
38 layer_tree_host_->InitializeSingleThreaded( | 38 layer_tree_host_->InitializeSingleThreaded( |
39 &fake_client_, base::MessageLoopProxy::current()); | 39 &fake_client_, base::MessageLoopProxy::current()); |
40 } | 40 } |
41 | 41 |
42 virtual void TearDown() { | 42 virtual void TearDown() { |
43 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 43 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
44 } | 44 } |
45 | 45 |
| 46 FakeLayerTreeHostClient fake_client_; |
46 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; | 47 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; |
47 FakeLayerTreeHostClient fake_client_; | |
48 }; | 48 }; |
49 | 49 |
50 TEST_F(UIResourceLayerTest, SetBitmap) { | 50 TEST_F(UIResourceLayerTest, SetBitmap) { |
51 scoped_refptr<UIResourceLayer> test_layer = UIResourceLayer::Create(); | 51 scoped_refptr<UIResourceLayer> test_layer = UIResourceLayer::Create(); |
52 ASSERT_TRUE(test_layer.get()); | 52 ASSERT_TRUE(test_layer.get()); |
53 test_layer->SetIsDrawable(true); | 53 test_layer->SetIsDrawable(true); |
54 test_layer->SetBounds(gfx::Size(100, 100)); | 54 test_layer->SetBounds(gfx::Size(100, 100)); |
55 | 55 |
56 layer_tree_host_->SetRootLayer(test_layer); | 56 layer_tree_host_->SetRootLayer(test_layer); |
57 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 57 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 scoped_ptr<ScopedUIResource> resource = ScopedUIResource::Create( | 97 scoped_ptr<ScopedUIResource> resource = ScopedUIResource::Create( |
98 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque)); | 98 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque)); |
99 test_layer->SetUIResourceId(resource->id()); | 99 test_layer->SetUIResourceId(resource->id()); |
100 test_layer->Update(&queue, &occlusion_tracker); | 100 test_layer->Update(&queue, &occlusion_tracker); |
101 | 101 |
102 EXPECT_TRUE(test_layer->DrawsContent()); | 102 EXPECT_TRUE(test_layer->DrawsContent()); |
103 } | 103 } |
104 | 104 |
105 } // namespace | 105 } // namespace |
106 } // namespace cc | 106 } // namespace cc |
OLD | NEW |