| 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/debug/micro_benchmark_controller.h" | 5 #include "cc/debug/micro_benchmark_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "cc/debug/micro_benchmark.h" | 12 #include "cc/debug/micro_benchmark.h" |
| 13 #include "cc/layers/layer.h" | 13 #include "cc/layers/layer.h" |
| 14 #include "cc/test/fake_impl_task_runner_provider.h" | 14 #include "cc/test/fake_impl_task_runner_provider.h" |
| 15 #include "cc/test/fake_layer_tree_host.h" | 15 #include "cc/test/fake_layer_tree_host.h" |
| 16 #include "cc/test/fake_layer_tree_host_impl.h" | 16 #include "cc/test/fake_layer_tree_host_impl.h" |
| 17 #include "cc/test/fake_proxy.h" | 17 #include "cc/test/fake_proxy.h" |
| 18 #include "cc/test/test_task_graph_runner.h" | 18 #include "cc/test/test_task_graph_runner.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class MicroBenchmarkControllerTest : public testing::Test { | 24 class MicroBenchmarkControllerTest : public testing::Test { |
| 25 public: | 25 public: |
| 26 MicroBenchmarkControllerTest() | |
| 27 : layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D) {} | |
| 28 | |
| 29 void SetUp() override { | 26 void SetUp() override { |
| 30 impl_task_runner_provider_ = | 27 impl_task_runner_provider_ = |
| 31 base::WrapUnique(new FakeImplTaskRunnerProvider); | 28 base::WrapUnique(new FakeImplTaskRunnerProvider); |
| 32 layer_tree_host_impl_ = base::WrapUnique(new FakeLayerTreeHostImpl( | 29 layer_tree_host_impl_ = base::WrapUnique(new FakeLayerTreeHostImpl( |
| 33 impl_task_runner_provider_.get(), &shared_bitmap_manager_, | 30 impl_task_runner_provider_.get(), &shared_bitmap_manager_, |
| 34 &task_graph_runner_)); | 31 &task_graph_runner_)); |
| 35 | 32 |
| 36 layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_, | 33 layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_, |
| 37 &task_graph_runner_); | 34 &task_graph_runner_); |
| 38 layer_tree_host_->SetRootLayer(Layer::Create()); | 35 layer_tree_host_->SetRootLayer(Layer::Create()); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Send invalid message to valid benchmark | 172 // Send invalid message to valid benchmark |
| 176 message = base::WrapUnique(new base::DictionaryValue); | 173 message = base::WrapUnique(new base::DictionaryValue); |
| 177 message->SetBoolean("can_handle", false); | 174 message->SetBoolean("can_handle", false); |
| 178 message_handled = | 175 message_handled = |
| 179 layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(message)); | 176 layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(message)); |
| 180 EXPECT_FALSE(message_handled); | 177 EXPECT_FALSE(message_handled); |
| 181 } | 178 } |
| 182 | 179 |
| 183 } // namespace | 180 } // namespace |
| 184 } // namespace cc | 181 } // namespace cc |
| OLD | NEW |