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

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

Issue 12648005: cc: Chromify the LayerTreeHostImpl class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compl Created 7 years, 9 months 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
« no previous file with comments | « cc/test/fake_layer_tree_host_impl_client.cc ('k') | cc/test/layer_tree_test_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "cc/layer_tree_host.h" 10 #include "cc/layer_tree_host.h"
(...skipping 17 matching lines...) Expand all
28 class TestHooks : public WebKit::WebAnimationDelegate { 28 class TestHooks : public WebKit::WebAnimationDelegate {
29 public: 29 public:
30 TestHooks(); 30 TestHooks();
31 virtual ~TestHooks(); 31 virtual ~TestHooks();
32 32
33 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } 33 virtual void beginCommitOnThread(LayerTreeHostImpl*) { }
34 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } 34 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { }
35 virtual void treeActivatedOnThread(LayerTreeHostImpl*) { } 35 virtual void treeActivatedOnThread(LayerTreeHostImpl*) { }
36 virtual void initializedRendererOnThread(LayerTreeHostImpl*, bool success) { } 36 virtual void initializedRendererOnThread(LayerTreeHostImpl*, bool success) { }
37 virtual bool prepareToDrawOnThread( 37 virtual bool prepareToDrawOnThread(
38 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); 38 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData*, bool result);
39 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } 39 virtual void drawLayersOnThread(LayerTreeHostImpl*) { }
40 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime ) { } 40 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime ) { }
41 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim ation) { } 41 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim ation) { }
42 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic Time) { } 42 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic Time) { }
43 virtual void applyScrollAndScale(gfx::Vector2d, float) { } 43 virtual void applyScrollAndScale(gfx::Vector2d, float) { }
44 virtual void animate(base::TimeTicks monotonicTime) { } 44 virtual void animate(base::TimeTicks monotonicTime) { }
45 virtual void layout() { } 45 virtual void layout() { }
46 virtual void didRecreateOutputSurface(bool succeeded) { } 46 virtual void didRecreateOutputSurface(bool succeeded) { }
47 virtual void willRetryRecreateOutputSurface() { } 47 virtual void willRetryRecreateOutputSurface() { }
48 virtual void didAddAnimation() { } 48 virtual void didAddAnimation() { }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 { 156 {
157 ThreadedTest::runTest(true); 157 ThreadedTest::runTest(true);
158 } 158 }
159 }; 159 };
160 160
161 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. 161 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks.
162 class MockLayerTreeHostImpl : public LayerTreeHostImpl { 162 class MockLayerTreeHostImpl : public LayerTreeHostImpl {
163 public: 163 public:
164 static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const LayerTreeS ettings&, LayerTreeHostImplClient*, Proxy*); 164 static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const LayerTreeS ettings&, LayerTreeHostImplClient*, Proxy*);
165 165
166 virtual void beginCommit() OVERRIDE; 166 virtual void BeginCommit() OVERRIDE;
167 virtual void commitComplete() OVERRIDE; 167 virtual void CommitComplete() OVERRIDE;
168 virtual bool prepareToDraw(FrameData&) OVERRIDE; 168 virtual bool PrepareToDraw(FrameData* frame) OVERRIDE;
169 virtual void drawLayers(FrameData&) OVERRIDE; 169 virtual void DrawLayers(FrameData* frame) OVERRIDE;
170 virtual bool activatePendingTreeIfNeeded() OVERRIDE; 170 virtual bool ActivatePendingTreeIfNeeded() OVERRIDE;
171 virtual bool initializeRenderer(scoped_ptr<OutputSurface> outputSurface) OVE RRIDE; 171 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> outputSurface) OVE RRIDE;
172 virtual void setVisible(bool visible) OVERRIDE; 172 virtual void SetVisible(bool visible) OVERRIDE;
173 173
174 // Make these public. 174 // Make these public.
175 typedef std::vector<LayerImpl*> LayerList; 175 typedef std::vector<LayerImpl*> LayerList;
176 176
177 protected: 177 protected:
178 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo ckTime) OVERRIDE; 178 virtual void AnimateLayers(base::TimeTicks monotonicTime, base::Time wallClo ckTime) OVERRIDE;
179 virtual void updateAnimationState() OVERRIDE; 179 virtual void UpdateAnimationState() OVERRIDE;
180 virtual base::TimeDelta lowFrequencyAnimationInterval() const OVERRIDE; 180 virtual base::TimeDelta LowFrequencyAnimationInterval() const OVERRIDE;
181 181
182 private: 182 private:
183 MockLayerTreeHostImpl(TestHooks*, const LayerTreeSettings&, LayerTreeHostImp lClient*, Proxy*); 183 MockLayerTreeHostImpl(TestHooks*, const LayerTreeSettings&, LayerTreeHostImp lClient*, Proxy*);
184 184
185 TestHooks* m_testHooks; 185 TestHooks* m_testHooks;
186 }; 186 };
187 187
188 } // namespace cc 188 } // namespace cc
189 189
190 #define SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 190 #define SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \
191 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \ 191 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \
192 { \ 192 { \
193 runTest(false); \ 193 runTest(false); \
194 } 194 }
195 195
196 #define MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 196 #define MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
197 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ 197 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \
198 { \ 198 { \
199 runTest(true); \ 199 runTest(true); \
200 } 200 }
201 201
202 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 202 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
203 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 203 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \
204 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) 204 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME)
205 205
206 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ 206 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_impl_client.cc ('k') | cc/test/layer_tree_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698