OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/test/fake_channel_impl.h" | |
6 #include "cc/test/fake_layer_tree_host.h" | |
7 #include "cc/test/fake_layer_tree_host_client.h" | |
8 #include "cc/test/proxy_impl_for_test.h" | |
9 #include "cc/test/test_hooks.h" | |
10 #include "cc/test/test_task_graph_runner.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | |
12 | |
13 namespace cc { | |
14 | |
15 class ProxyImplTest : public testing::Test, public TestHooks { | |
16 public: | |
17 ~ProxyImplTest() override { | |
18 DebugScopedSetImplThreadAndMainThreadBlocked impl_and_main_blocked( | |
19 task_runner_provider_); | |
20 proxy_impl_.reset(); | |
21 } | |
22 | |
23 void RequestNewOutputSurface() override {} | |
24 | |
25 protected: | |
26 ProxyImplTest() | |
27 : host_client_(FakeLayerTreeHostClient::DIRECT_3D), | |
28 task_runner_provider_(nullptr) {} | |
29 | |
30 void Initialize(CompositorMode mode) { | |
31 layer_tree_host_ = FakeLayerTreeHost::Create( | |
32 &host_client_, &task_graph_runner_, settings_, mode); | |
33 task_runner_provider_ = layer_tree_host_->task_runner_provider(); | |
34 { | |
35 DebugScopedSetImplThreadAndMainThreadBlocked impl_and_main_blocked( | |
36 task_runner_provider_); | |
37 proxy_impl_ = | |
38 ProxyImplForTest::Create(this, &channel_impl_, layer_tree_host_.get(), | |
39 task_runner_provider_, nullptr); | |
40 } | |
41 } | |
42 | |
43 TestTaskGraphRunner task_graph_runner_; | |
44 LayerTreeSettings settings_; | |
45 FakeLayerTreeHostClient host_client_; | |
46 FakeChannelImpl channel_impl_; | |
47 TaskRunnerProvider* task_runner_provider_; | |
48 std::unique_ptr<ProxyImplForTest> proxy_impl_; | |
49 std::unique_ptr<FakeLayerTreeHost> layer_tree_host_; | |
50 }; | |
51 | |
52 // This is a regression test. See crbug/568120. | |
53 TEST_F(ProxyImplTest, NonZeroSmoothnessPriorityExpiration) { | |
54 Initialize(CompositorMode::THREADED); | |
55 DebugScopedSetImplThread impl_thread(task_runner_provider_); | |
56 EXPECT_FALSE( | |
57 proxy_impl_->smoothness_priority_expiration_notifier().delay().is_zero()); | |
58 } | |
59 | |
60 } // namespace cc | |
OLD | NEW |