Remove non-async content protection entry points in NativeDisplayDelegate
[chromium-blink-merge.git] / cc / trees / layer_tree_host_unittest_proxy.cc
blob313510371e7557fb26db7c14ff0e5bde3b5dce70
1 // Copyright 2014 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.
5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h"
7 #include "cc/test/layer_tree_test.h"
8 #include "cc/trees/thread_proxy.h"
10 #define THREAD_PROXY_NO_IMPL_TEST_F(TEST_FIXTURE_NAME) \
11 TEST_F(TEST_FIXTURE_NAME, Run_MainThreadPaint) { \
12 Run(true, false); \
15 #define THREAD_PROXY_TEST_F(TEST_FIXTURE_NAME) \
16 THREAD_PROXY_NO_IMPL_TEST_F(TEST_FIXTURE_NAME); \
17 TEST_F(TEST_FIXTURE_NAME, Run_ImplSidePaint) { \
18 Run(true, true); \
21 // Do common tests for single thread proxy and thread proxy.
22 // TODO(simonhong): Add SINGLE_THREAD_PROXY_TEST_F
23 #define PROXY_TEST_SCHEDULED_ACTION(TEST_FIXTURE_NAME) \
24 THREAD_PROXY_TEST_F(TEST_FIXTURE_NAME);
26 namespace cc {
28 class ProxyTest : public LayerTreeTest {
29 protected:
30 ProxyTest() {}
31 ~ProxyTest() override {}
33 void Run(bool threaded, bool impl_side_painting) {
34 // We don't need to care about delegating mode.
35 bool delegating_renderer = true;
37 RunTest(threaded, delegating_renderer, impl_side_painting);
40 void BeginTest() override {}
41 void AfterTest() override {}
43 private:
44 DISALLOW_COPY_AND_ASSIGN(ProxyTest);
47 class ProxyTestScheduledActionsBasic : public ProxyTest {
48 protected:
49 void BeginTest() override { proxy()->SetNeedsCommit(); }
51 void ScheduledActionBeginOutputSurfaceCreation() override {
52 EXPECT_EQ(0, action_phase_++);
55 void ScheduledActionSendBeginMainFrame() override {
56 EXPECT_EQ(1, action_phase_++);
59 void ScheduledActionCommit() override { EXPECT_EQ(2, action_phase_++); }
61 void ScheduledActionDrawAndSwapIfPossible() override {
62 EXPECT_EQ(3, action_phase_++);
63 EndTest();
66 void AfterTest() override { EXPECT_EQ(4, action_phase_); }
68 ProxyTestScheduledActionsBasic() : action_phase_(0) {
70 ~ProxyTestScheduledActionsBasic() override {}
72 private:
73 int action_phase_;
75 DISALLOW_COPY_AND_ASSIGN(ProxyTestScheduledActionsBasic);
78 PROXY_TEST_SCHEDULED_ACTION(ProxyTestScheduledActionsBasic);
80 class ThreadProxyTest : public ProxyTest {
81 protected:
82 ThreadProxyTest() {}
83 ~ThreadProxyTest() override {}
85 const ThreadProxy::MainThreadOnly& ThreadProxyMainOnly() const {
86 DCHECK(proxy());
87 DCHECK(proxy()->HasImplThread());
88 return static_cast<const ThreadProxy*>(proxy())->main();
91 const ThreadProxy::CompositorThreadOnly& ThreadProxyImplOnly() const {
92 DCHECK(proxy());
93 DCHECK(proxy()->HasImplThread());
94 return static_cast<const ThreadProxy*>(proxy())->impl();
97 private:
98 DISALLOW_COPY_AND_ASSIGN(ThreadProxyTest);
101 class ThreadProxyTestSetNeedsCommit : public ThreadProxyTest {
102 protected:
103 ThreadProxyTestSetNeedsCommit() {}
104 ~ThreadProxyTestSetNeedsCommit() override {}
106 void BeginTest() override {
107 EXPECT_FALSE(ThreadProxyMainOnly().commit_requested);
108 EXPECT_FALSE(ThreadProxyMainOnly().commit_request_sent_to_impl_thread);
110 proxy()->SetNeedsCommit();
112 EXPECT_TRUE(ThreadProxyMainOnly().commit_requested);
113 EXPECT_TRUE(ThreadProxyMainOnly().commit_request_sent_to_impl_thread);
116 void DidBeginMainFrame() override {
117 EXPECT_FALSE(ThreadProxyMainOnly().commit_requested);
118 EXPECT_FALSE(ThreadProxyMainOnly().commit_request_sent_to_impl_thread);
120 EndTest();
123 private:
124 DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestSetNeedsCommit);
127 THREAD_PROXY_TEST_F(ThreadProxyTestSetNeedsCommit);
129 } // namespace cc