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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "cc/debug/micro_benchmark.h" | 7 #include "cc/debug/micro_benchmark.h" |
8 #include "cc/debug/micro_benchmark_controller.h" | 8 #include "cc/debug/micro_benchmark_controller.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/resources/resource_update_queue.h" | 10 #include "cc/resources/resource_update_queue.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_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
13 #include "cc/test/fake_proxy.h" | 13 #include "cc/test/fake_proxy.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 namespace { | 17 namespace { |
18 | 18 |
19 class MicroBenchmarkControllerTest : public testing::Test { | 19 class MicroBenchmarkControllerTest : public testing::Test { |
20 public: | 20 public: |
21 virtual void SetUp() OVERRIDE { | 21 virtual void SetUp() OVERRIDE { |
22 impl_proxy_ = make_scoped_ptr(new FakeImplProxy); | 22 impl_proxy_ = make_scoped_ptr(new FakeImplProxy); |
23 layer_tree_host_impl_ = | 23 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
24 make_scoped_ptr(new FakeLayerTreeHostImpl(impl_proxy_.get())); | 24 layer_tree_host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl( |
| 25 impl_proxy_.get(), shared_bitmap_manager_.get())); |
25 | 26 |
26 layer_tree_host_ = FakeLayerTreeHost::Create(); | 27 layer_tree_host_ = FakeLayerTreeHost::Create(); |
27 layer_tree_host_->SetRootLayer(Layer::Create()); | 28 layer_tree_host_->SetRootLayer(Layer::Create()); |
28 layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy)); | 29 layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy)); |
29 } | 30 } |
30 | 31 |
31 virtual void TearDown() OVERRIDE { | 32 virtual void TearDown() OVERRIDE { |
32 layer_tree_host_impl_.reset(); | 33 layer_tree_host_impl_.reset(); |
33 layer_tree_host_.reset(); | 34 layer_tree_host_.reset(); |
34 impl_proxy_.reset(); | 35 impl_proxy_.reset(); |
35 } | 36 } |
36 | 37 |
37 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; | 38 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; |
| 39 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
38 scoped_ptr<FakeLayerTreeHostImpl> layer_tree_host_impl_; | 40 scoped_ptr<FakeLayerTreeHostImpl> layer_tree_host_impl_; |
39 scoped_ptr<FakeImplProxy> impl_proxy_; | 41 scoped_ptr<FakeImplProxy> impl_proxy_; |
40 }; | 42 }; |
41 | 43 |
42 void Noop(scoped_ptr<base::Value> value) { | 44 void Noop(scoped_ptr<base::Value> value) { |
43 } | 45 } |
44 | 46 |
45 void IncrementCallCount(int* count, scoped_ptr<base::Value> value) { | 47 void IncrementCallCount(int* count, scoped_ptr<base::Value> value) { |
46 ++(*count); | 48 ++(*count); |
47 } | 49 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 layer_tree_host_impl_->CommitComplete(); | 134 layer_tree_host_impl_->CommitComplete(); |
133 | 135 |
134 // Make sure all posted messages run. | 136 // Make sure all posted messages run. |
135 base::MessageLoop::current()->RunUntilIdle(); | 137 base::MessageLoop::current()->RunUntilIdle(); |
136 | 138 |
137 EXPECT_EQ(1, run_count); | 139 EXPECT_EQ(1, run_count); |
138 } | 140 } |
139 | 141 |
140 } // namespace | 142 } // namespace |
141 } // namespace cc | 143 } // namespace cc |
OLD | NEW |