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_impl_for_test.h" | |
6 | |
7 namespace cc { | |
8 scoped_ptr<ProxyImpl> ProxyImplForTest::Create( | |
9 TestHooks* test_hooks, | |
10 ChannelImpl* channel_impl, | |
11 LayerTreeHost* layer_tree_host, | |
12 TaskRunnerProvider* task_runner_provider, | |
13 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | |
14 return make_scoped_ptr(new ProxyImplForTest( | |
15 test_hooks, channel_impl, layer_tree_host, task_runner_provider, | |
16 std::move(external_begin_frame_source))); | |
17 } | |
18 | |
19 bool ProxyImplForTest::HasCommitCompletionEvent() const { | |
20 return commit_completion_event_ != nullptr; | |
21 } | |
22 | |
23 bool ProxyImplForTest::GetNextCommitWaitsForActivation() const { | |
24 return next_commit_waits_for_activation_; | |
25 } | |
26 | |
27 ProxyImplForTest::ProxyImplForTest( | |
28 TestHooks* test_hooks, | |
29 ChannelImpl* channel_impl, | |
30 LayerTreeHost* layer_tree_host, | |
31 TaskRunnerProvider* task_runner_provider, | |
32 scoped_ptr<BeginFrameSource> external_begin_frame_source) | |
33 : ProxyImpl(channel_impl, | |
34 layer_tree_host, | |
35 task_runner_provider, | |
36 std::move(external_begin_frame_source)), | |
37 test_hooks_(test_hooks) {} | |
38 | |
39 void ProxyImplForTest::ScheduledActionSendBeginMainFrame( | |
40 const BeginFrameArgs& args) { | |
41 test_hooks_->ScheduledActionWillSendBeginMainFrame(); | |
42 ProxyImpl::ScheduledActionSendBeginMainFrame(args); | |
43 test_hooks_->ScheduledActionSendBeginMainFrame(); | |
44 } | |
45 | |
46 DrawResult ProxyImplForTest::ScheduledActionDrawAndSwapIfPossible() { | |
47 DrawResult result = ProxyImpl::ScheduledActionDrawAndSwapIfPossible(); | |
48 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); | |
49 return result; | |
50 } | |
51 | |
52 void ProxyImplForTest::ScheduledActionCommit() { | |
53 ProxyImpl::ScheduledActionCommit(); | |
54 test_hooks_->ScheduledActionCommit(); | |
55 } | |
56 | |
57 void ProxyImplForTest::ScheduledActionBeginOutputSurfaceCreation() { | |
58 ProxyImpl::ScheduledActionBeginOutputSurfaceCreation(); | |
59 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); | |
60 } | |
61 | |
62 void ProxyImplForTest::ScheduledActionPrepareTiles() { | |
63 ProxyImpl::ScheduledActionPrepareTiles(); | |
64 test_hooks_->ScheduledActionPrepareTiles(); | |
65 } | |
66 | |
67 void ProxyImplForTest::ScheduledActionInvalidateOutputSurface() { | |
68 ProxyImpl::ScheduledActionInvalidateOutputSurface(); | |
69 test_hooks_->ScheduledActionInvalidateOutputSurface(); | |
70 } | |
71 | |
72 void ProxyImplForTest::SendBeginMainFrameNotExpectedSoon() { | |
73 ProxyImpl::SendBeginMainFrameNotExpectedSoon(); | |
74 test_hooks_->SendBeginMainFrameNotExpectedSoon(); | |
75 } | |
76 | |
77 void ProxyImplForTest::DidActivateSyncTree() { | |
78 ProxyImpl::DidActivateSyncTree(); | |
79 test_hooks_->DidActivateSyncTree(); | |
80 } | |
81 | |
82 void ProxyImplForTest::SetThrottleFrameProductionOnImpl(bool throttle) { | |
83 test_hooks_->SetThrottleFrameProductionOnImpl(throttle); | |
84 ProxyImpl::SetThrottleFrameProductionOnImpl(throttle); | |
85 } | |
86 | |
87 void ProxyImplForTest::InitializeOutputSurfaceOnImpl( | |
88 OutputSurface* output_surface) { | |
89 test_hooks_->InitializeOutputSurfaceOnImpl(output_surface); | |
90 ProxyImpl::InitializeOutputSurfaceOnImpl(output_surface); | |
91 } | |
92 | |
93 void ProxyImplForTest::MainThreadHasStoppedFlingingOnImpl() { | |
94 test_hooks_->MainThreadHasStoppedFlingingOnImpl(); | |
95 ProxyImpl::MainThreadHasStoppedFlingingOnImpl(); | |
96 } | |
97 | |
98 void ProxyImplForTest::SetInputThrottledUntilCommitOnImpl(bool is_throttled) { | |
99 test_hooks_->SetInputThrottledUntilCommitOnImpl(is_throttled); | |
100 ProxyImpl::SetInputThrottledUntilCommitOnImpl(is_throttled); | |
101 } | |
102 | |
103 void ProxyImplForTest::UpdateTopControlsStateOnImpl( | |
104 TopControlsState constraints, | |
105 TopControlsState current, | |
106 bool animate) { | |
107 test_hooks_->UpdateTopControlsStateOnImpl(constraints, current, animate); | |
108 ProxyImpl::UpdateTopControlsStateOnImpl(constraints, current, animate); | |
109 } | |
110 | |
111 void ProxyImplForTest::SetDeferCommitsOnImpl(bool defer_commits) const { | |
112 test_hooks_->SetDeferCommitsOnImpl(defer_commits); | |
113 ProxyImpl::SetDeferCommitsOnImpl(defer_commits); | |
114 } | |
115 | |
116 void ProxyImplForTest::BeginMainFrameAbortedOnImpl( | |
117 CommitEarlyOutReason reason, | |
118 base::TimeTicks main_thread_start_time) { | |
119 test_hooks_->BeginMainFrameAbortedOnImpl(reason); | |
120 ProxyImpl::BeginMainFrameAbortedOnImpl(reason, main_thread_start_time); | |
121 } | |
122 | |
123 void ProxyImplForTest::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) { | |
124 test_hooks_->SetNeedsRedrawOnImpl(damage_rect); | |
125 ProxyImpl::SetNeedsRedrawOnImpl(damage_rect); | |
126 } | |
127 | |
128 void ProxyImplForTest::SetNeedsCommitOnImpl() { | |
129 test_hooks_->SetNeedsCommitOnImpl(); | |
130 ProxyImpl::SetNeedsCommitOnImpl(); | |
131 } | |
132 | |
133 void ProxyImplForTest::FinishAllRenderingOnImpl(CompletionEvent* completion) { | |
134 test_hooks_->FinishAllRenderingOnImpl(); | |
135 ProxyImpl::FinishAllRenderingOnImpl(completion); | |
136 } | |
137 | |
138 void ProxyImplForTest::SetVisibleOnImpl(bool visible) { | |
139 test_hooks_->SetVisibleOnImpl(visible); | |
140 ProxyImpl::SetVisibleOnImpl(visible); | |
141 } | |
142 | |
143 void ProxyImplForTest::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) { | |
144 test_hooks_->ReleaseOutputSurfaceOnImpl(); | |
145 ProxyImpl::ReleaseOutputSurfaceOnImpl(completion); | |
146 } | |
147 | |
148 void ProxyImplForTest::FinishGLOnImpl(CompletionEvent* completion) { | |
149 test_hooks_->FinishGLOnImpl(); | |
150 ProxyImpl::FinishGLOnImpl(completion); | |
151 } | |
152 | |
153 void ProxyImplForTest::StartCommitOnImpl(CompletionEvent* completion, | |
154 LayerTreeHost* layer_tree_host, | |
155 base::TimeTicks main_thread_start_time, | |
156 bool hold_commit_for_activation) { | |
157 test_hooks_->StartCommitOnImpl(); | |
158 ProxyImpl::StartCommitOnImpl(completion, layer_tree_host, | |
159 main_thread_start_time, | |
160 hold_commit_for_activation); | |
161 } | |
162 | |
163 } // namespace cc | |
OLD | NEW |