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/proxy_main_for_test.h" | |
6 | |
7 #include "cc/animation/animation_events.h" | |
8 #include "cc/test/threaded_channel_for_test.h" | |
9 #include "cc/trees/remote_channel_main.h" | |
10 | |
11 namespace cc { | |
12 | |
13 std::unique_ptr<ProxyMainForTest> ProxyMainForTest::CreateThreaded( | |
14 TestHooks* test_hooks, | |
15 LayerTreeHost* host, | |
16 TaskRunnerProvider* task_runner_provider) { | |
17 std::unique_ptr<ProxyMainForTest> proxy_main( | |
18 new ProxyMainForTest(test_hooks, host, task_runner_provider)); | |
19 std::unique_ptr<ThreadedChannelForTest> channel = | |
20 ThreadedChannelForTest::Create(test_hooks, proxy_main.get(), | |
21 task_runner_provider); | |
22 proxy_main->threaded_channel_for_test_ = channel.get(); | |
23 proxy_main->SetChannel(std::move(channel)); | |
24 return proxy_main; | |
25 } | |
26 | |
27 std::unique_ptr<ProxyMainForTest> ProxyMainForTest::CreateRemote( | |
28 TestHooks* test_hooks, | |
29 RemoteProtoChannel* remote_proto_channel, | |
30 LayerTreeHost* host, | |
31 TaskRunnerProvider* task_runner_provider) { | |
32 std::unique_ptr<ProxyMainForTest> proxy_main( | |
33 new ProxyMainForTest(test_hooks, host, task_runner_provider)); | |
34 proxy_main->SetChannel(RemoteChannelMain::Create( | |
35 remote_proto_channel, proxy_main.get(), task_runner_provider)); | |
36 return proxy_main; | |
37 } | |
38 | |
39 ProxyMainForTest::~ProxyMainForTest() {} | |
40 | |
41 ProxyMainForTest::ProxyMainForTest(TestHooks* test_hooks, | |
42 LayerTreeHost* host, | |
43 TaskRunnerProvider* task_runner_provider) | |
44 : ProxyMain(host, task_runner_provider), | |
45 test_hooks_(test_hooks), | |
46 threaded_channel_for_test_(nullptr) {} | |
47 | |
48 void ProxyMainForTest::SetNeedsUpdateLayers() { | |
49 ProxyMain::SetNeedsUpdateLayers(); | |
50 test_hooks_->DidSetNeedsUpdateLayers(); | |
51 } | |
52 | |
53 void ProxyMainForTest::DidCompleteSwapBuffers() { | |
54 test_hooks_->ReceivedDidCompleteSwapBuffers(); | |
55 ProxyMain::DidCompleteSwapBuffers(); | |
56 } | |
57 | |
58 void ProxyMainForTest::SetRendererCapabilities( | |
59 const RendererCapabilities& capabilities) { | |
60 test_hooks_->ReceivedSetRendererCapabilitiesMainCopy(capabilities); | |
61 ProxyMain::SetRendererCapabilities(capabilities); | |
62 } | |
63 | |
64 void ProxyMainForTest::BeginMainFrameNotExpectedSoon() { | |
65 test_hooks_->ReceivedBeginMainFrameNotExpectedSoon(); | |
66 ProxyMain::BeginMainFrameNotExpectedSoon(); | |
67 } | |
68 | |
69 void ProxyMainForTest::DidCommitAndDrawFrame() { | |
70 test_hooks_->ReceivedDidCommitAndDrawFrame(); | |
71 ProxyMain::DidCommitAndDrawFrame(); | |
72 } | |
73 | |
74 void ProxyMainForTest::SetAnimationEvents( | |
75 std::unique_ptr<AnimationEvents> events) { | |
76 test_hooks_->ReceivedSetAnimationEvents(); | |
77 ProxyMain::SetAnimationEvents(std::move(events)); | |
78 } | |
79 | |
80 void ProxyMainForTest::DidLoseOutputSurface() { | |
81 test_hooks_->ReceivedDidLoseOutputSurface(); | |
82 ProxyMain::DidLoseOutputSurface(); | |
83 } | |
84 | |
85 void ProxyMainForTest::RequestNewOutputSurface() { | |
86 test_hooks_->ReceivedRequestNewOutputSurface(); | |
87 ProxyMain::RequestNewOutputSurface(); | |
88 } | |
89 | |
90 void ProxyMainForTest::DidInitializeOutputSurface( | |
91 bool success, | |
92 const RendererCapabilities& capabilities) { | |
93 test_hooks_->ReceivedDidInitializeOutputSurface(success, capabilities); | |
94 ProxyMain::DidInitializeOutputSurface(success, capabilities); | |
95 } | |
96 | |
97 void ProxyMainForTest::DidCompletePageScaleAnimation() { | |
98 test_hooks_->ReceivedDidCompletePageScaleAnimation(); | |
99 ProxyMain::DidCompletePageScaleAnimation(); | |
100 } | |
101 | |
102 void ProxyMainForTest::BeginMainFrame( | |
103 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | |
104 test_hooks_->ReceivedBeginMainFrame(); | |
105 ProxyMain::BeginMainFrame(std::move(begin_main_frame_state)); | |
106 } | |
107 | |
108 } // namespace cc | |
OLD | NEW |