| 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 void SetUp() override { | 26 void SetUp() override { |
| 27 impl_task_runner_provider_ = | 27 impl_task_runner_provider_ = |
| 28 base::WrapUnique(new FakeImplTaskRunnerProvider); | 28 base::WrapUnique(new FakeImplTaskRunnerProvider); |
| 29 layer_tree_host_impl_ = base::WrapUnique(new FakeLayerTreeHostImpl( | 29 layer_tree_host_impl_ = base::MakeUnique<FakeLayerTreeHostImpl>( |
| 30 impl_task_runner_provider_.get(), &shared_bitmap_manager_, | 30 impl_task_runner_provider_.get(), &shared_bitmap_manager_, |
| 31 &task_graph_runner_)); | 31 &task_graph_runner_); |
| 32 | 32 |
| 33 layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_, | 33 layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_, |
| 34 &task_graph_runner_); | 34 &task_graph_runner_); |
| 35 layer_tree_host_->SetRootLayer(Layer::Create()); | 35 layer_tree_host_->SetRootLayer(Layer::Create()); |
| 36 layer_tree_host_->InitializeForTesting( | 36 layer_tree_host_->InitializeForTesting( |
| 37 TaskRunnerProvider::Create(nullptr, nullptr), | 37 TaskRunnerProvider::Create(nullptr, nullptr), |
| 38 std::unique_ptr<Proxy>(new FakeProxy), nullptr); | 38 std::unique_ptr<Proxy>(new FakeProxy), nullptr); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void TearDown() override { | 41 void TearDown() override { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // Send invalid message to valid benchmark | 172 // Send invalid message to valid benchmark |
| 173 message = base::WrapUnique(new base::DictionaryValue); | 173 message = base::WrapUnique(new base::DictionaryValue); |
| 174 message->SetBoolean("can_handle", false); | 174 message->SetBoolean("can_handle", false); |
| 175 message_handled = | 175 message_handled = |
| 176 layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(message)); | 176 layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(message)); |
| 177 EXPECT_FALSE(message_handled); | 177 EXPECT_FALSE(message_handled); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace | 180 } // namespace |
| 181 } // namespace cc | 181 } // namespace cc |
| OLD | NEW |