| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation/animation_host.h" | 5 #include "cc/animation/animation_host.h" |
| 6 #include "cc/test/fake_layer_tree_host.h" | 6 #include "cc/test/fake_layer_tree_host.h" |
| 7 #include "cc/test/fake_layer_tree_host_client.h" | 7 #include "cc/test/fake_layer_tree_host_client.h" |
| 8 #include "cc/test/test_task_graph_runner.h" | 8 #include "cc/test/test_task_graph_runner.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 TEST(LayerTreeHostRecordGpuHistogramTest, SingleThreaded) { | 15 TEST(LayerTreeHostRecordGpuHistogramTest, SingleThreaded) { |
| 16 FakeLayerTreeHostClient host_client; | 16 FakeLayerTreeHostClient host_client; |
| 17 TestTaskGraphRunner task_graph_runner; | 17 TestTaskGraphRunner task_graph_runner; |
| 18 LayerTreeSettings settings; | 18 LayerTreeSettings settings; |
| 19 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 19 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 20 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( | 20 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
| 21 &host_client, &task_graph_runner, animation_host.get(), settings, | 21 &host_client, &task_graph_runner, animation_host.get(), settings, |
| 22 CompositorMode::SINGLE_THREADED); | 22 CompositorMode::SINGLE_THREADED); |
| 23 host->RecordGpuRasterizationHistogram(); | 23 host->RecordGpuRasterizationHistogram(host->host_impl()); |
| 24 EXPECT_FALSE(host->gpu_rasterization_histogram_recorded()); | 24 EXPECT_FALSE(host->gpu_rasterization_histogram_recorded()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 TEST(LayerTreeHostRecordGpuHistogramTest, Threaded) { | 27 TEST(LayerTreeHostRecordGpuHistogramTest, Threaded) { |
| 28 FakeLayerTreeHostClient host_client; | 28 FakeLayerTreeHostClient host_client; |
| 29 TestTaskGraphRunner task_graph_runner; | 29 TestTaskGraphRunner task_graph_runner; |
| 30 LayerTreeSettings settings; | 30 LayerTreeSettings settings; |
| 31 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 31 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 32 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( | 32 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
| 33 &host_client, &task_graph_runner, animation_host.get(), settings, | 33 &host_client, &task_graph_runner, animation_host.get(), settings, |
| 34 CompositorMode::THREADED); | 34 CompositorMode::THREADED); |
| 35 host->RecordGpuRasterizationHistogram(); | 35 host->RecordGpuRasterizationHistogram(host->host_impl()); |
| 36 EXPECT_TRUE(host->gpu_rasterization_histogram_recorded()); | 36 EXPECT_TRUE(host->gpu_rasterization_histogram_recorded()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 } // namespace cc | 41 } // namespace cc |
| OLD | NEW |