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/layers/layer_settings.h" | |
11 #include "cc/test/fake_impl_task_runner_provider.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
12 #include "cc/test/fake_layer_tree_host.h" | 11 #include "cc/test/fake_layer_tree_host.h" |
13 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
14 #include "cc/test/fake_proxy.h" | 13 #include "cc/test/fake_proxy.h" |
15 #include "cc/test/test_task_graph_runner.h" | 14 #include "cc/test/test_task_graph_runner.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 | 16 |
18 namespace cc { | 17 namespace cc { |
19 namespace { | 18 namespace { |
20 | 19 |
21 class MicroBenchmarkControllerTest : public testing::Test { | 20 class MicroBenchmarkControllerTest : public testing::Test { |
22 public: | 21 public: |
23 MicroBenchmarkControllerTest() | 22 MicroBenchmarkControllerTest() |
24 : layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D) {} | 23 : layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D) {} |
25 | 24 |
26 void SetUp() override { | 25 void SetUp() override { |
27 impl_task_runner_provider_ = | 26 impl_task_runner_provider_ = |
28 make_scoped_ptr(new FakeImplTaskRunnerProvider); | 27 make_scoped_ptr(new FakeImplTaskRunnerProvider); |
29 layer_tree_host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl( | 28 layer_tree_host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl( |
30 impl_task_runner_provider_.get(), &shared_bitmap_manager_, | 29 impl_task_runner_provider_.get(), &shared_bitmap_manager_, |
31 &task_graph_runner_)); | 30 &task_graph_runner_)); |
32 | 31 |
33 layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_, | 32 layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_, |
34 &task_graph_runner_); | 33 &task_graph_runner_); |
35 layer_tree_host_->SetRootLayer(Layer::Create(LayerSettings())); | 34 layer_tree_host_->SetRootLayer(Layer::Create()); |
36 layer_tree_host_->InitializeForTesting( | 35 layer_tree_host_->InitializeForTesting( |
37 TaskRunnerProvider::Create(nullptr, nullptr), | 36 TaskRunnerProvider::Create(nullptr, nullptr), |
38 scoped_ptr<Proxy>(new FakeProxy), nullptr); | 37 scoped_ptr<Proxy>(new FakeProxy), nullptr); |
39 } | 38 } |
40 | 39 |
41 void TearDown() override { | 40 void TearDown() override { |
42 layer_tree_host_impl_ = nullptr; | 41 layer_tree_host_impl_ = nullptr; |
43 layer_tree_host_ = nullptr; | 42 layer_tree_host_ = nullptr; |
44 impl_task_runner_provider_ = nullptr; | 43 impl_task_runner_provider_ = nullptr; |
45 } | 44 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Send invalid message to valid benchmark | 172 // Send invalid message to valid benchmark |
174 message = make_scoped_ptr(new base::DictionaryValue); | 173 message = make_scoped_ptr(new base::DictionaryValue); |
175 message->SetBoolean("can_handle", false); | 174 message->SetBoolean("can_handle", false); |
176 message_handled = | 175 message_handled = |
177 layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(message)); | 176 layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(message)); |
178 EXPECT_FALSE(message_handled); | 177 EXPECT_FALSE(message_handled); |
179 } | 178 } |
180 | 179 |
181 } // namespace | 180 } // namespace |
182 } // namespace cc | 181 } // namespace cc |
OLD | NEW |