Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: cc/test/layer_tree_test_common.h

Issue 11344004: Remove WebKit::Platform dependencies from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TEST_LAYER_TREE_TEST_COMMON_H_ 5 #ifndef CC_TEST_LAYER_TREE_TEST_COMMON_H_
6 #define CC_TEST_LAYER_TREE_TEST_COMMON_H_ 6 #define CC_TEST_LAYER_TREE_TEST_COMMON_H_
7 7
8 #include "cc/layer_tree_host.h" 8 #include "cc/layer_tree_host.h"
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/threading/thread.h"
10 #include "cc/layer_tree_host_impl.h" 11 #include "cc/layer_tree_host_impl.h"
11 #include "cc/scoped_thread_proxy.h" 12 #include "cc/scoped_thread_proxy.h"
12 #include "cc/test/compositor_fake_web_graphics_context_3d.h" 13 #include "cc/test/compositor_fake_web_graphics_context_3d.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include <public/WebAnimationDelegate.h> 15 #include <public/WebAnimationDelegate.h>
15 #include <public/WebThread.h>
16 16
17 namespace cc { 17 namespace cc {
18 class LayerImpl; 18 class LayerImpl;
19 class LayerTreeHost; 19 class LayerTreeHost;
20 class LayerTreeHostClient; 20 class LayerTreeHostClient;
21 class LayerTreeHostImpl; 21 class LayerTreeHostImpl;
22 class Thread;
22 } 23 }
23 24
24 namespace WebKitTests { 25 namespace WebKitTests {
25 26
26 // Used by test stubs to notify the test when something interesting happens. 27 // Used by test stubs to notify the test when something interesting happens.
27 class TestHooks : public WebKit::WebAnimationDelegate { 28 class TestHooks : public WebKit::WebAnimationDelegate {
28 public: 29 public:
29 virtual void beginCommitOnThread(cc::LayerTreeHostImpl*) { } 30 virtual void beginCommitOnThread(cc::LayerTreeHostImpl*) { }
30 virtual void commitCompleteOnThread(cc::LayerTreeHostImpl*) { } 31 virtual void commitCompleteOnThread(cc::LayerTreeHostImpl*) { }
31 virtual bool prepareToDrawOnThread(cc::LayerTreeHostImpl*); 32 virtual bool prepareToDrawOnThread(cc::LayerTreeHostImpl*);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void postSetNeedsCommitToMainThread(); 82 void postSetNeedsCommitToMainThread();
82 void postAcquireLayerTextures(); 83 void postAcquireLayerTextures();
83 void postSetNeedsRedrawToMainThread(); 84 void postSetNeedsRedrawToMainThread();
84 void postSetNeedsAnimateAndCommitToMainThread(); 85 void postSetNeedsAnimateAndCommitToMainThread();
85 void postSetVisibleToMainThread(bool visible); 86 void postSetVisibleToMainThread(bool visible);
86 void postDidAddAnimationToMainThread(); 87 void postDidAddAnimationToMainThread();
87 88
88 void doBeginTest(); 89 void doBeginTest();
89 void timeout(); 90 void timeout();
90 91
91 void clearTimeout() { m_timeoutTask = 0; }
92
93 cc::LayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } 92 cc::LayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); }
94 93
95 protected: 94 protected:
96 ThreadedTest(); 95 ThreadedTest();
97 96
98 virtual void initializeSettings(cc::LayerTreeSettings&) { } 97 virtual void initializeSettings(cc::LayerTreeSettings&) { }
99 98
100 virtual void scheduleComposite() OVERRIDE; 99 virtual void scheduleComposite() OVERRIDE;
101 100
102 void realEndTest(); 101 void realEndTest();
103 102
104 void dispatchSetNeedsAnimate(); 103 void dispatchSetNeedsAnimate();
105 void dispatchAddInstantAnimation(); 104 void dispatchAddInstantAnimation();
106 void dispatchAddAnimation(); 105 void dispatchAddAnimation();
107 void dispatchSetNeedsAnimateAndCommit(); 106 void dispatchSetNeedsAnimateAndCommit();
108 void dispatchSetNeedsCommit(); 107 void dispatchSetNeedsCommit();
109 void dispatchAcquireLayerTextures(); 108 void dispatchAcquireLayerTextures();
110 void dispatchSetNeedsRedraw(); 109 void dispatchSetNeedsRedraw();
111 void dispatchSetVisible(bool); 110 void dispatchSetVisible(bool);
112 void dispatchComposite(); 111 void dispatchComposite();
113 void dispatchDidAddAnimation(); 112 void dispatchDidAddAnimation();
114 113
115 virtual void runTest(bool threaded); 114 virtual void runTest(bool threaded);
116 WebKit::WebThread* webThread() const { return m_webThread.get(); } 115
116 cc::Thread* implThread() { return m_implCCThread.get(); }
117 117
118 cc::LayerTreeSettings m_settings; 118 cc::LayerTreeSettings m_settings;
119 scoped_ptr<MockLayerImplTreeHostClient> m_client; 119 scoped_ptr<MockLayerImplTreeHostClient> m_client;
120 scoped_ptr<cc::LayerTreeHost> m_layerTreeHost; 120 scoped_ptr<cc::LayerTreeHost> m_layerTreeHost;
121 121
122 protected: 122 protected:
123 RefPtr<cc::ScopedThreadProxy> m_mainThreadProxy; 123 scoped_refptr<cc::ScopedThreadProxy> m_mainThreadProxy;
124 124
125 private: 125 private:
126 bool m_beginning; 126 bool m_beginning;
127 bool m_endWhenBeginReturns; 127 bool m_endWhenBeginReturns;
128 bool m_timedOut; 128 bool m_timedOut;
129 bool m_finished; 129 bool m_finished;
130 bool m_scheduled; 130 bool m_scheduled;
131 bool m_started; 131 bool m_started;
132 132
133 scoped_ptr<WebKit::WebThread> m_webThread; 133 scoped_ptr<cc::Thread> m_mainCCThread;
134 TimeoutTask* m_timeoutTask; 134 scoped_ptr<cc::Thread> m_implCCThread;
135 BeginTask* m_beginTask; 135 scoped_ptr<base::Thread> m_implThread;
136 base::CancelableClosure m_timeout;
136 }; 137 };
137 138
138 class ThreadedTestThreadOnly : public ThreadedTest { 139 class ThreadedTestThreadOnly : public ThreadedTest {
139 public: 140 public:
140 void runTestThreaded() 141 void runTestThreaded()
141 { 142 {
142 ThreadedTest::runTest(true); 143 ThreadedTest::runTest(true);
143 } 144 }
144 }; 145 };
145 146
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \ 200 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \
200 { \ 201 { \
201 runTest(false); \ 202 runTest(false); \
202 } \ 203 } \
203 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ 204 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \
204 { \ 205 { \
205 runTest(true); \ 206 runTest(true); \
206 } 207 }
207 208
208 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ 209 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698