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

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

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Early out in methods, pass raw pointers, updated tests 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
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 public: 154 public:
155 void runTestThreaded() 155 void runTestThreaded()
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*, RenderingStatsRecorder*);
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&) OVERRIDE;
169 virtual void drawLayers(FrameData&) OVERRIDE; 169 virtual void drawLayers(FrameData&) 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*, RenderingStatsRecorder*);
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

Powered by Google App Engine
This is Rietveld 408576698