summaryrefslogtreecommitdiffstats
path: root/cc/test/proxy_impl_for_test.cc
blob: da0848ba3bb5e4fa1ae9749f83cf5d51bec7a206 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/test/proxy_impl_for_test.h"

namespace cc {
scoped_ptr<ProxyImplForTest> ProxyImplForTest::Create(
    TestHooks* test_hooks,
    ChannelImpl* channel_impl,
    LayerTreeHost* layer_tree_host,
    TaskRunnerProvider* task_runner_provider,
    scoped_ptr<BeginFrameSource> external_begin_frame_source) {
  return make_scoped_ptr(new ProxyImplForTest(
      test_hooks, channel_impl, layer_tree_host, task_runner_provider,
      std::move(external_begin_frame_source)));
}

bool ProxyImplForTest::HasCommitCompletionEvent() const {
  return commit_completion_event_ != nullptr;
}

bool ProxyImplForTest::GetNextCommitWaitsForActivation() const {
  return next_commit_waits_for_activation_;
}

ProxyImplForTest::ProxyImplForTest(
    TestHooks* test_hooks,
    ChannelImpl* channel_impl,
    LayerTreeHost* layer_tree_host,
    TaskRunnerProvider* task_runner_provider,
    scoped_ptr<BeginFrameSource> external_begin_frame_source)
    : ProxyImpl(channel_impl,
                layer_tree_host,
                task_runner_provider,
                std::move(external_begin_frame_source)),
      test_hooks_(test_hooks) {}

void ProxyImplForTest::ScheduledActionSendBeginMainFrame(
    const BeginFrameArgs& args) {
  test_hooks_->ScheduledActionWillSendBeginMainFrame();
  ProxyImpl::ScheduledActionSendBeginMainFrame(args);
  test_hooks_->ScheduledActionSendBeginMainFrame();
}

DrawResult ProxyImplForTest::ScheduledActionDrawAndSwapIfPossible() {
  DrawResult result = ProxyImpl::ScheduledActionDrawAndSwapIfPossible();
  test_hooks_->ScheduledActionDrawAndSwapIfPossible();
  return result;
}

void ProxyImplForTest::ScheduledActionCommit() {
  ProxyImpl::ScheduledActionCommit();
  test_hooks_->ScheduledActionCommit();
}

void ProxyImplForTest::ScheduledActionBeginOutputSurfaceCreation() {
  ProxyImpl::ScheduledActionBeginOutputSurfaceCreation();
  test_hooks_->ScheduledActionBeginOutputSurfaceCreation();
}

void ProxyImplForTest::ScheduledActionPrepareTiles() {
  ProxyImpl::ScheduledActionPrepareTiles();
  test_hooks_->ScheduledActionPrepareTiles();
}

void ProxyImplForTest::ScheduledActionInvalidateOutputSurface() {
  ProxyImpl::ScheduledActionInvalidateOutputSurface();
  test_hooks_->ScheduledActionInvalidateOutputSurface();
}

void ProxyImplForTest::SendBeginMainFrameNotExpectedSoon() {
  ProxyImpl::SendBeginMainFrameNotExpectedSoon();
  test_hooks_->SendBeginMainFrameNotExpectedSoon();
}

void ProxyImplForTest::DidActivateSyncTree() {
  ProxyImpl::DidActivateSyncTree();
  test_hooks_->DidActivateSyncTree();
}

void ProxyImplForTest::InitializeOutputSurfaceOnImpl(
    OutputSurface* output_surface) {
  test_hooks_->InitializeOutputSurfaceOnImpl(output_surface);
  ProxyImpl::InitializeOutputSurfaceOnImpl(output_surface);
}

void ProxyImplForTest::MainThreadHasStoppedFlingingOnImpl() {
  test_hooks_->MainThreadHasStoppedFlingingOnImpl();
  ProxyImpl::MainThreadHasStoppedFlingingOnImpl();
}

void ProxyImplForTest::SetInputThrottledUntilCommitOnImpl(bool is_throttled) {
  test_hooks_->SetInputThrottledUntilCommitOnImpl(is_throttled);
  ProxyImpl::SetInputThrottledUntilCommitOnImpl(is_throttled);
}

void ProxyImplForTest::UpdateTopControlsStateOnImpl(
    TopControlsState constraints,
    TopControlsState current,
    bool animate) {
  test_hooks_->UpdateTopControlsStateOnImpl(constraints, current, animate);
  ProxyImpl::UpdateTopControlsStateOnImpl(constraints, current, animate);
}

void ProxyImplForTest::SetDeferCommitsOnImpl(bool defer_commits) const {
  test_hooks_->SetDeferCommitsOnImpl(defer_commits);
  ProxyImpl::SetDeferCommitsOnImpl(defer_commits);
}

void ProxyImplForTest::BeginMainFrameAbortedOnImpl(
    CommitEarlyOutReason reason,
    base::TimeTicks main_thread_start_time) {
  test_hooks_->BeginMainFrameAbortedOnImpl(reason);
  ProxyImpl::BeginMainFrameAbortedOnImpl(reason, main_thread_start_time);
}

void ProxyImplForTest::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {
  test_hooks_->SetNeedsRedrawOnImpl(damage_rect);
  ProxyImpl::SetNeedsRedrawOnImpl(damage_rect);
}

void ProxyImplForTest::SetNeedsCommitOnImpl() {
  test_hooks_->SetNeedsCommitOnImpl();
  ProxyImpl::SetNeedsCommitOnImpl();
}

void ProxyImplForTest::FinishAllRenderingOnImpl(CompletionEvent* completion) {
  test_hooks_->FinishAllRenderingOnImpl();
  ProxyImpl::FinishAllRenderingOnImpl(completion);
}

void ProxyImplForTest::SetVisibleOnImpl(bool visible) {
  test_hooks_->SetVisibleOnImpl(visible);
  ProxyImpl::SetVisibleOnImpl(visible);
}

void ProxyImplForTest::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) {
  test_hooks_->ReleaseOutputSurfaceOnImpl();
  ProxyImpl::ReleaseOutputSurfaceOnImpl(completion);
}

void ProxyImplForTest::FinishGLOnImpl(CompletionEvent* completion) {
  test_hooks_->FinishGLOnImpl();
  ProxyImpl::FinishGLOnImpl(completion);
}

void ProxyImplForTest::StartCommitOnImpl(CompletionEvent* completion,
                                         LayerTreeHost* layer_tree_host,
                                         base::TimeTicks main_thread_start_time,
                                         bool hold_commit_for_activation) {
  test_hooks_->StartCommitOnImpl();
  ProxyImpl::StartCommitOnImpl(completion, layer_tree_host,
                               main_thread_start_time,
                               hold_commit_for_activation);
}

}  // namespace cc