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

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

Issue 22926024: cc: Control activation from the Scheduler (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedOutputSurface4
Patch Set: Fixes for tests Created 7 years, 4 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_H_ 5 #ifndef CC_TEST_LAYER_TREE_TEST_H_
6 #define CC_TEST_LAYER_TREE_TEST_H_ 6 #define CC_TEST_LAYER_TREE_TEST_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/animation/animation_delegate.h" 10 #include "cc/animation/animation_delegate.h"
(...skipping 13 matching lines...) Expand all
24 class TestContextProvider; 24 class TestContextProvider;
25 25
26 // Used by test stubs to notify the test when something interesting happens. 26 // Used by test stubs to notify the test when something interesting happens.
27 class TestHooks : public AnimationDelegate { 27 class TestHooks : public AnimationDelegate {
28 public: 28 public:
29 TestHooks(); 29 TestHooks();
30 virtual ~TestHooks(); 30 virtual ~TestHooks();
31 31
32 void ReadSettings(const LayerTreeSettings& settings); 32 void ReadSettings(const LayerTreeSettings& settings);
33 33
34 virtual void WillBeginFrameOnThread(LayerTreeHostImpl* host_impl,
35 const BeginFrameArgs& args) {}
34 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} 36 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {}
35 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} 37 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {}
38 virtual void BlockNotifyReadyToActivate(bool block) = 0;
36 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} 39 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {}
37 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} 40 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {}
38 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, 41 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
39 bool success) {} 42 bool success) {}
40 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 43 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
41 LayerTreeHostImpl::FrameData* frame_data, 44 LayerTreeHostImpl::FrameData* frame_data,
42 bool result); 45 bool result);
43 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) {} 46 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) {}
44 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) {} 47 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) {}
45 virtual void SwapBuffersCompleteOnThread(LayerTreeHostImpl* host_impl) {} 48 virtual void SwapBuffersCompleteOnThread(LayerTreeHostImpl* host_impl) {}
(...skipping 11 matching lines...) Expand all
57 virtual void Layout() {} 60 virtual void Layout() {}
58 virtual void DidInitializeOutputSurface(bool succeeded) {} 61 virtual void DidInitializeOutputSurface(bool succeeded) {}
59 virtual void DidFailToInitializeOutputSurface() {} 62 virtual void DidFailToInitializeOutputSurface() {}
60 virtual void DidAddAnimation() {} 63 virtual void DidAddAnimation() {}
61 virtual void WillCommit() {} 64 virtual void WillCommit() {}
62 virtual void DidCommit() {} 65 virtual void DidCommit() {}
63 virtual void DidCommitAndDrawFrame() {} 66 virtual void DidCommitAndDrawFrame() {}
64 virtual void DidCompleteSwapBuffers() {} 67 virtual void DidCompleteSwapBuffers() {}
65 virtual void ScheduleComposite() {} 68 virtual void ScheduleComposite() {}
66 virtual void DidDeferCommit() {} 69 virtual void DidDeferCommit() {}
67 virtual bool CanActivatePendingTree(LayerTreeHostImpl* host_impl);
68 virtual bool CanActivatePendingTreeIfNeeded(LayerTreeHostImpl* host_impl);
69 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl, 70 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
70 bool visible) {} 71 bool visible) {}
71 72
72 // Implementation of AnimationDelegate: 73 // Implementation of AnimationDelegate:
73 virtual void NotifyAnimationStarted(double time) OVERRIDE {} 74 virtual void NotifyAnimationStarted(double time) OVERRIDE {}
74 virtual void NotifyAnimationFinished(double time) OVERRIDE {} 75 virtual void NotifyAnimationFinished(double time) OVERRIDE {}
75 76
76 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) = 0; 77 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) = 0;
77 virtual scoped_refptr<cc::ContextProvider> 78 virtual scoped_refptr<cc::ContextProvider>
78 OffscreenContextProviderForMainThread() = 0; 79 OffscreenContextProviderForMainThread() = 0;
79 virtual scoped_refptr<cc::ContextProvider> 80 virtual scoped_refptr<cc::ContextProvider>
80 OffscreenContextProviderForCompositorThread() = 0; 81 OffscreenContextProviderForCompositorThread() = 0;
81 }; 82 };
82 83
83 class BeginTask; 84 class BeginTask;
84 class LayerTreeHostClientForTesting; 85 class LayerTreeHostClientForTesting;
86 class LayerTreeHostImplClientInterposer;
85 class TimeoutTask; 87 class TimeoutTask;
86 88
87 // The LayerTreeTests runs with the main loop running. It instantiates a single 89 // The LayerTreeTests runs with the main loop running. It instantiates a single
88 // LayerTreeHostForTesting and associated LayerTreeHostImplForTesting and 90 // LayerTreeHostForTesting and associated LayerTreeHostImplForTesting and
89 // LayerTreeHostClientForTesting. 91 // LayerTreeHostClientForTesting.
90 // 92 //
91 // BeginTest() is called once the main message loop is running and the layer 93 // BeginTest() is called once the main message loop is running and the layer
92 // tree host is initialized. 94 // tree host is initialized.
93 // 95 //
94 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to 96 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 Proxy* proxy() const { 151 Proxy* proxy() const {
150 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; 152 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL;
151 } 153 }
152 154
153 bool TestEnded() const { return ended_; } 155 bool TestEnded() const { return ended_; }
154 156
155 LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } 157 LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); }
156 bool delegating_renderer() const { return delegating_renderer_; } 158 bool delegating_renderer() const { return delegating_renderer_; }
157 FakeOutputSurface* output_surface() { return output_surface_; } 159 FakeOutputSurface* output_surface() { return output_surface_; }
158 160
161 virtual void BlockNotifyReadyToActivate(bool block) OVERRIDE;
159 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) OVERRIDE; 162 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) OVERRIDE;
160 virtual scoped_refptr<cc::ContextProvider> 163 virtual scoped_refptr<cc::ContextProvider>
161 OffscreenContextProviderForMainThread() OVERRIDE; 164 OffscreenContextProviderForMainThread() OVERRIDE;
162 virtual scoped_refptr<cc::ContextProvider> 165 virtual scoped_refptr<cc::ContextProvider>
163 OffscreenContextProviderForCompositorThread() OVERRIDE; 166 OffscreenContextProviderForCompositorThread() OVERRIDE;
164 167
165 private: 168 private:
166 LayerTreeSettings settings_; 169 LayerTreeSettings settings_;
167 scoped_ptr<LayerTreeHostClientForTesting> client_; 170 scoped_ptr<LayerTreeHostClientForTesting> client_;
168 scoped_ptr<LayerTreeHost> layer_tree_host_; 171 scoped_ptr<LayerTreeHost> layer_tree_host_;
172 scoped_ptr<LayerTreeHostImplClientInterposer> impl_client_;
169 FakeOutputSurface* output_surface_; 173 FakeOutputSurface* output_surface_;
170 174
171 bool beginning_; 175 bool beginning_;
172 bool end_when_begin_returns_; 176 bool end_when_begin_returns_;
173 bool timed_out_; 177 bool timed_out_;
174 bool scheduled_; 178 bool scheduled_;
175 bool schedule_when_set_visible_true_; 179 bool schedule_when_set_visible_true_;
176 bool started_; 180 bool started_;
177 bool ended_; 181 bool ended_;
178 bool delegating_renderer_; 182 bool delegating_renderer_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 240
237 #define SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ 241 #define SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \
238 SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ 242 SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
239 MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) 243 MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME)
240 244
241 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 245 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
242 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ 246 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \
243 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) 247 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME)
244 248
245 #endif // CC_TEST_LAYER_TREE_TEST_H_ 249 #endif // CC_TEST_LAYER_TREE_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698