summaryrefslogtreecommitdiffstats
path: root/cc/test/proxy_impl_for_test.h
blob: ce96154aba3660be52b2330f721d380801872c43 (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
// 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.

#ifndef CC_TEST_PROXY_IMPL_FOR_TEST_H_
#define CC_TEST_PROXY_IMPL_FOR_TEST_H_

#include "base/macros.h"
#include "cc/test/test_hooks.h"
#include "cc/trees/proxy_impl.h"

namespace cc {
// Creates a ProxyImpl that notifies the supplied |test_hooks| of various
// actions.
class ProxyImplForTest : public ProxyImpl {
 public:
  static scoped_ptr<ProxyImplForTest> Create(
      TestHooks* test_hooks,
      ChannelImpl* channel_impl,
      LayerTreeHost* layer_tree_host,
      TaskRunnerProvider* task_runner_provider,
      scoped_ptr<BeginFrameSource> external_begin_frame_source);

  using ProxyImpl::PostAnimationEventsToMainThreadOnImplThread;
  using ProxyImpl::DidLoseOutputSurfaceOnImplThread;
  using ProxyImpl::DidCompletePageScaleAnimationOnImplThread;
  using ProxyImpl::SendBeginMainFrameNotExpectedSoon;

  bool HasCommitCompletionEvent() const;
  bool GetNextCommitWaitsForActivation() const;
  const DelayedUniqueNotifier& smoothness_priority_expiration_notifier() const {
    return smoothness_priority_expiration_notifier_;
  }

  ProxyImplForTest(TestHooks* test_hooks,
                   ChannelImpl* channel_impl,
                   LayerTreeHost* layer_tree_host,
                   TaskRunnerProvider* task_runner_provider,
                   scoped_ptr<BeginFrameSource> external_begin_frame_source);

  void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override;
  DrawResult ScheduledActionDrawAndSwapIfPossible() override;
  void ScheduledActionCommit() override;
  void ScheduledActionBeginOutputSurfaceCreation() override;
  void ScheduledActionPrepareTiles() override;
  void ScheduledActionInvalidateOutputSurface() override;
  void SendBeginMainFrameNotExpectedSoon() override;
  void DidActivateSyncTree() override;
  void SetThrottleFrameProductionOnImpl(bool throttle) override;
  void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) override;
  void MainThreadHasStoppedFlingingOnImpl() override;
  void SetInputThrottledUntilCommitOnImpl(bool is_throttled) override;
  void UpdateTopControlsStateOnImpl(TopControlsState constraints,
                                    TopControlsState current,
                                    bool animate) override;
  void SetDeferCommitsOnImpl(bool defer_commits) const override;
  void BeginMainFrameAbortedOnImpl(
      CommitEarlyOutReason reason,
      base::TimeTicks main_thread_start_time) override;
  void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) override;
  void SetNeedsCommitOnImpl() override;
  void FinishAllRenderingOnImpl(CompletionEvent* completion) override;
  void SetVisibleOnImpl(bool visible) override;
  void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) override;
  void FinishGLOnImpl(CompletionEvent* completion) override;
  void StartCommitOnImpl(CompletionEvent* completion,
                         LayerTreeHost* layer_tree_host,
                         base::TimeTicks main_thread_start_time,
                         bool hold_commit_for_activation) override;

  TestHooks* test_hooks_;
};

}  // namespace cc

#endif  // CC_TEST_PROXY_IMPL_FOR_TEST_H_