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

Side by Side Diff: trunk/src/cc/scheduler/scheduler_unittest.cc

Issue 17125004: Revert 206020 "cc: Emulate BeginFrame in OutputSurfaces that don..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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
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 #include "cc/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 } while (false) 23 } while (false)
24 24
25 #define EXPECT_SINGLE_ACTION(action, client) \ 25 #define EXPECT_SINGLE_ACTION(action, client) \
26 EXPECT_ACTION(action, client, 0, 1) 26 EXPECT_ACTION(action, client, 0, 1)
27 27
28 namespace cc { 28 namespace cc {
29 namespace { 29 namespace {
30 30
31 class FakeSchedulerClient : public SchedulerClient { 31 class FakeSchedulerClient : public SchedulerClient {
32 public: 32 public:
33 FakeSchedulerClient() 33 FakeSchedulerClient() { Reset(); }
34 : needs_begin_frame_(false) {
35 Reset();
36 }
37
38 void Reset() { 34 void Reset() {
39 actions_.clear(); 35 actions_.clear();
40 states_.clear(); 36 states_.clear();
41 draw_will_happen_ = true; 37 draw_will_happen_ = true;
42 swap_will_happen_if_draw_happens_ = true; 38 swap_will_happen_if_draw_happens_ = true;
43 num_draws_ = 0; 39 num_draws_ = 0;
44 } 40 }
45 41
46 Scheduler* CreateScheduler(const SchedulerSettings& settings) { 42 Scheduler* CreateScheduler(
47 scheduler_ = Scheduler::Create(this, settings); 43 scoped_ptr<FrameRateController> frame_rate_controller,
44 const SchedulerSettings& settings) {
45 scheduler_ =
46 Scheduler::Create(this, frame_rate_controller.Pass(), settings);
48 return scheduler_.get(); 47 return scheduler_.get();
49 } 48 }
50 49
51 bool needs_begin_frame() { return needs_begin_frame_; } 50
52 int num_draws() const { return num_draws_; } 51 int num_draws() const { return num_draws_; }
53 int num_actions_() const { return static_cast<int>(actions_.size()); } 52 int num_actions_() const { return static_cast<int>(actions_.size()); }
54 const char* Action(int i) const { return actions_[i]; } 53 const char* Action(int i) const { return actions_[i]; }
55 std::string StateForAction(int i) const { return states_[i]; } 54 std::string StateForAction(int i) const { return states_[i]; }
56 55
57 bool HasAction(const char* action) const { 56 bool HasAction(const char* action) const {
58 for (size_t i = 0; i < actions_.size(); i++) 57 for (size_t i = 0; i < actions_.size(); i++)
59 if (!strcmp(actions_[i], action)) 58 if (!strcmp(actions_[i], action))
60 return true; 59 return true;
61 return false; 60 return false;
62 } 61 }
63 62
64 void SetDrawWillHappen(bool draw_will_happen) { 63 void SetDrawWillHappen(bool draw_will_happen) {
65 draw_will_happen_ = draw_will_happen; 64 draw_will_happen_ = draw_will_happen;
66 } 65 }
67 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) { 66 void SetSwapWillHappenIfDrawHappens(bool swap_will_happen_if_draw_happens) {
68 swap_will_happen_if_draw_happens_ = swap_will_happen_if_draw_happens; 67 swap_will_happen_if_draw_happens_ = swap_will_happen_if_draw_happens;
69 } 68 }
70 69
71 // Scheduler Implementation. 70 // Scheduler Implementation.
72 virtual void SetNeedsBeginFrameOnImplThread(bool enable) OVERRIDE {
73 actions_.push_back("SetNeedsBeginFrameOnImplThread");
74 states_.push_back(scheduler_->StateAsStringForTesting());
75 needs_begin_frame_ = enable;
76 }
77 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE { 71 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE {
78 actions_.push_back("ScheduledActionSendBeginFrameToMainThread"); 72 actions_.push_back("ScheduledActionSendBeginFrameToMainThread");
79 states_.push_back(scheduler_->StateAsStringForTesting()); 73 states_.push_back(scheduler_->StateAsStringForTesting());
80 } 74 }
81 virtual ScheduledActionDrawAndSwapResult 75 virtual ScheduledActionDrawAndSwapResult
82 ScheduledActionDrawAndSwapIfPossible() OVERRIDE { 76 ScheduledActionDrawAndSwapIfPossible() OVERRIDE {
83 actions_.push_back("ScheduledActionDrawAndSwapIfPossible"); 77 actions_.push_back("ScheduledActionDrawAndSwapIfPossible");
84 states_.push_back(scheduler_->StateAsStringForTesting()); 78 states_.push_back(scheduler_->StateAsStringForTesting());
85 num_draws_++; 79 num_draws_++;
86 return ScheduledActionDrawAndSwapResult(draw_will_happen_, 80 return ScheduledActionDrawAndSwapResult(draw_will_happen_,
(...skipping 23 matching lines...) Expand all
110 actions_.push_back("ScheduledActionBeginOutputSurfaceCreation"); 104 actions_.push_back("ScheduledActionBeginOutputSurfaceCreation");
111 states_.push_back(scheduler_->StateAsStringForTesting()); 105 states_.push_back(scheduler_->StateAsStringForTesting());
112 } 106 }
113 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE { 107 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE {
114 actions_.push_back("ScheduledActionAcquireLayerTexturesForMainThread"); 108 actions_.push_back("ScheduledActionAcquireLayerTexturesForMainThread");
115 states_.push_back(scheduler_->StateAsStringForTesting()); 109 states_.push_back(scheduler_->StateAsStringForTesting());
116 } 110 }
117 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE {} 111 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE {}
118 112
119 protected: 113 protected:
120 bool needs_begin_frame_;
121 bool draw_will_happen_; 114 bool draw_will_happen_;
122 bool swap_will_happen_if_draw_happens_; 115 bool swap_will_happen_if_draw_happens_;
123 int num_draws_; 116 int num_draws_;
124 std::vector<const char*> actions_; 117 std::vector<const char*> actions_;
125 std::vector<std::string> states_; 118 std::vector<std::string> states_;
126 scoped_ptr<Scheduler> scheduler_; 119 scoped_ptr<Scheduler> scheduler_;
127 }; 120 };
128 121
129 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginFrame) { 122 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginFrame) {
130 FakeSchedulerClient client; 123 FakeSchedulerClient client;
124 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
131 SchedulerSettings default_scheduler_settings; 125 SchedulerSettings default_scheduler_settings;
132 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 126 Scheduler* scheduler = client.CreateScheduler(
127 make_scoped_ptr(new FrameRateController(time_source)),
128 default_scheduler_settings);
133 scheduler->SetCanStart(); 129 scheduler->SetCanStart();
134 scheduler->SetVisible(true); 130 scheduler->SetVisible(true);
135 scheduler->SetCanDraw(true); 131 scheduler->SetCanDraw(true);
136 132
137 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 133 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
138 client.Reset(); 134 client.Reset();
139 scheduler->DidCreateAndInitializeOutputSurface(); 135 scheduler->DidCreateAndInitializeOutputSurface();
140 EXPECT_EQ(0, client.num_actions_()); 136 EXPECT_EQ(0, client.num_actions_());
141 } 137 }
142 138
143 TEST(SchedulerTest, RequestCommit) { 139 TEST(SchedulerTest, RequestCommit) {
144 FakeSchedulerClient client; 140 FakeSchedulerClient client;
141 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
145 SchedulerSettings default_scheduler_settings; 142 SchedulerSettings default_scheduler_settings;
146 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 143 Scheduler* scheduler = client.CreateScheduler(
144 make_scoped_ptr(new FrameRateController(time_source)),
145 default_scheduler_settings);
147 scheduler->SetCanStart(); 146 scheduler->SetCanStart();
148 scheduler->SetVisible(true); 147 scheduler->SetVisible(true);
149 scheduler->SetCanDraw(true); 148 scheduler->SetCanDraw(true);
150 149
151 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 150 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
152 client.Reset(); 151 client.Reset();
153 scheduler->DidCreateAndInitializeOutputSurface(); 152 scheduler->DidCreateAndInitializeOutputSurface();
154 153
155 // SetNeedsCommit should begin the frame. 154 // SetNeedsCommit should begin the frame.
156 scheduler->SetNeedsCommit(); 155 scheduler->SetNeedsCommit();
157 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 0, 2); 156 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginFrameToMainThread", client);
158 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2); 157 EXPECT_FALSE(time_source->Active());
159 EXPECT_TRUE(client.needs_begin_frame());
160 client.Reset(); 158 client.Reset();
161 159
162 // FinishCommit should commit 160 // FinishCommit should commit
163 scheduler->FinishCommit(); 161 scheduler->FinishCommit();
164 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 162 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
165 EXPECT_TRUE(client.needs_begin_frame()); 163 EXPECT_TRUE(time_source->Active());
166 client.Reset(); 164 client.Reset();
167 165
168 // BeginFrame should draw. 166 // Tick should draw.
169 scheduler->BeginFrame(base::TimeTicks::Now()); 167 time_source->Tick();
170 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2); 168 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client);
171 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2); 169 EXPECT_FALSE(time_source->Active());
172 EXPECT_FALSE(client.needs_begin_frame());
173 client.Reset(); 170 client.Reset();
171
172 // Timer should be off.
173 EXPECT_FALSE(time_source->Active());
174 } 174 }
175 175
176 TEST(SchedulerTest, RequestCommitAfterBeginFrameSentToMainThread) { 176 TEST(SchedulerTest, RequestCommitAfterBeginFrameSentToMainThread) {
177 FakeSchedulerClient client; 177 FakeSchedulerClient client;
178 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
178 SchedulerSettings default_scheduler_settings; 179 SchedulerSettings default_scheduler_settings;
179 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 180 Scheduler* scheduler = client.CreateScheduler(
181 make_scoped_ptr(new FrameRateController(time_source)),
182 default_scheduler_settings);
180 scheduler->SetCanStart(); 183 scheduler->SetCanStart();
181 scheduler->SetVisible(true); 184 scheduler->SetVisible(true);
182 scheduler->SetCanDraw(true); 185 scheduler->SetCanDraw(true);
183 186
184 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 187 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
185 client.Reset(); 188 client.Reset();
186 scheduler->DidCreateAndInitializeOutputSurface(); 189 scheduler->DidCreateAndInitializeOutputSurface();
187 190
188 // SetNedsCommit should begin the frame. 191 // SetNedsCommit should begin the frame.
189 scheduler->SetNeedsCommit(); 192 scheduler->SetNeedsCommit();
190 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 0, 2); 193 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginFrameToMainThread", client);
191 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2);
192 client.Reset(); 194 client.Reset();
193 195
194 // Now SetNeedsCommit again. Calling here means we need a second frame. 196 // Now SetNeedsCommit again. Calling here means we need a second frame.
195 scheduler->SetNeedsCommit(); 197 scheduler->SetNeedsCommit();
196 198
197 // Since another commit is needed, FinishCommit should commit, 199 // Since another commit is needed, FinishCommit should commit,
198 // then begin another frame. 200 // then begin another frame.
199 scheduler->FinishCommit(); 201 scheduler->FinishCommit();
200 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); 202 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
201 client.Reset(); 203 client.Reset();
202 204
203 // Tick should draw but then begin another frame. 205 // Tick should draw but then begin another frame.
204 scheduler->BeginFrame(base::TimeTicks::Now()); 206 time_source->Tick();
205 EXPECT_TRUE(client.needs_begin_frame()); 207 EXPECT_FALSE(time_source->Active());
206 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2); 208 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
207 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 1, 2); 209 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 1, 2);
208 client.Reset(); 210 client.Reset();
209
210 // Go back to quiescent state and verify we no longer request BeginFrames.
211 scheduler->FinishCommit();
212 scheduler->BeginFrame(base::TimeTicks::Now());
213 EXPECT_FALSE(client.needs_begin_frame());
214 } 211 }
215 212
216 TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) { 213 TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
217 FakeSchedulerClient client; 214 FakeSchedulerClient client;
215 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
218 SchedulerSettings default_scheduler_settings; 216 SchedulerSettings default_scheduler_settings;
219 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 217 Scheduler* scheduler = client.CreateScheduler(
218 make_scoped_ptr(new FrameRateController(time_source)),
219 default_scheduler_settings);
220 scheduler->SetCanStart(); 220 scheduler->SetCanStart();
221 scheduler->SetVisible(true); 221 scheduler->SetVisible(true);
222 scheduler->SetCanDraw(true); 222 scheduler->SetCanDraw(true);
223
223 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 224 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
224
225 client.Reset(); 225 client.Reset();
226 scheduler->DidCreateAndInitializeOutputSurface(); 226 scheduler->DidCreateAndInitializeOutputSurface();
227
227 scheduler->SetNeedsRedraw(); 228 scheduler->SetNeedsRedraw();
228 EXPECT_TRUE(scheduler->RedrawPending()); 229 EXPECT_TRUE(scheduler->RedrawPending());
229 EXPECT_SINGLE_ACTION("SetNeedsBeginFrameOnImplThread", client); 230 EXPECT_TRUE(time_source->Active());
230 EXPECT_TRUE(client.needs_begin_frame());
231 231
232 time_source->Tick();
233 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
234 EXPECT_FALSE(scheduler->RedrawPending());
235 EXPECT_FALSE(time_source->Active());
232 client.Reset(); 236 client.Reset();
233 scheduler->BeginFrame(base::TimeTicks::Now());
234 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
235 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2);
236 EXPECT_FALSE(scheduler->RedrawPending());
237 EXPECT_FALSE(client.needs_begin_frame());
238 237
239 client.Reset();
240 scheduler->SetMainThreadNeedsLayerTextures(); 238 scheduler->SetMainThreadNeedsLayerTextures();
241 EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread", 239 EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread",
242 client, 240 client,
243 0, 241 0,
244 3); 242 2);
245 // A commit was started by SetMainThreadNeedsLayerTextures(). 243 // A commit was started by SetMainThreadNeedsLayerTextures().
246 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 1, 3); 244 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 1, 2);
247 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 2, 3); 245 client.Reset();
248 246
249 // We should request a BeginFrame in anticipation of a draw.
250 client.Reset();
251 scheduler->SetNeedsRedraw(); 247 scheduler->SetNeedsRedraw();
252 EXPECT_TRUE(scheduler->RedrawPending()); 248 EXPECT_TRUE(scheduler->RedrawPending());
253 EXPECT_TRUE(client.needs_begin_frame()); 249 EXPECT_TRUE(time_source->Active());
254 250
255 // No draw happens since the textures are acquired by the main thread. 251 // No draw happens since the textures are acquired by the main thread.
252 time_source->Tick();
253 EXPECT_EQ(0, client.num_actions_());
254 EXPECT_TRUE(scheduler->RedrawPending());
255 EXPECT_TRUE(time_source->Active());
256
257 scheduler->FinishCommit();
258 EXPECT_ACTION("ScheduledActionCommit", client, 0, 1);
259 EXPECT_TRUE(scheduler->RedrawPending());
260 EXPECT_TRUE(time_source->Active());
256 client.Reset(); 261 client.Reset();
257 scheduler->BeginFrame(base::TimeTicks::Now());
258 EXPECT_SINGLE_ACTION("SetNeedsBeginFrameOnImplThread", client);
259 EXPECT_TRUE(scheduler->RedrawPending());
260 EXPECT_TRUE(client.needs_begin_frame());
261
262 // Commit will release the texture.
263 client.Reset();
264 scheduler->FinishCommit();
265 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
266 EXPECT_TRUE(scheduler->RedrawPending());
267 EXPECT_TRUE(client.needs_begin_frame());
268 262
269 // Now we can draw again after the commit happens. 263 // Now we can draw again after the commit happens.
270 client.Reset(); 264 time_source->Tick();
271 scheduler->BeginFrame(base::TimeTicks::Now()); 265 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
272 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
273 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2);
274 EXPECT_FALSE(scheduler->RedrawPending()); 266 EXPECT_FALSE(scheduler->RedrawPending());
275 EXPECT_FALSE(client.needs_begin_frame()); 267 EXPECT_FALSE(time_source->Active());
276 client.Reset(); 268 client.Reset();
277 } 269 }
278 270
279 TEST(SchedulerTest, TextureAcquisitionCollision) { 271 TEST(SchedulerTest, TextureAcquisitionCollision) {
280 FakeSchedulerClient client; 272 FakeSchedulerClient client;
273 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
281 SchedulerSettings default_scheduler_settings; 274 SchedulerSettings default_scheduler_settings;
282 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 275 Scheduler* scheduler = client.CreateScheduler(
276 make_scoped_ptr(new FrameRateController(time_source)),
277 default_scheduler_settings);
283 scheduler->SetCanStart(); 278 scheduler->SetCanStart();
284 scheduler->SetVisible(true); 279 scheduler->SetVisible(true);
285 scheduler->SetCanDraw(true); 280 scheduler->SetCanDraw(true);
286 281
287 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 282 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
288 client.Reset(); 283 client.Reset();
289 scheduler->DidCreateAndInitializeOutputSurface(); 284 scheduler->DidCreateAndInitializeOutputSurface();
290 285
291 scheduler->SetNeedsCommit(); 286 scheduler->SetNeedsCommit();
292 scheduler->SetMainThreadNeedsLayerTextures(); 287 scheduler->SetMainThreadNeedsLayerTextures();
293 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 0, 3); 288 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 0, 2);
294 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 3);
295 EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread", 289 EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread",
296 client, 290 client,
297 2, 291 1,
298 3); 292 2);
299 client.Reset(); 293 client.Reset();
300 294
301 // Although the compositor cannot draw because textures are locked by main 295 // Compositor not scheduled to draw because textures are locked by main thread
302 // thread, we continue requesting SetNeedsBeginFrame in anticipation of the 296 EXPECT_FALSE(time_source->Active());
303 // unlock.
304 EXPECT_TRUE(client.needs_begin_frame());
305 297
306 // Trigger the commit 298 // Trigger the commit
307 scheduler->FinishCommit(); 299 scheduler->FinishCommit();
308 EXPECT_TRUE(client.needs_begin_frame()); 300 EXPECT_TRUE(time_source->Active());
309 client.Reset(); 301 client.Reset();
310 302
311 // Between commit and draw, texture acquisition for main thread delayed, 303 // Between commit and draw, texture acquisition for main thread delayed,
312 // and main thread blocks. 304 // and main thread blocks.
313 scheduler->SetMainThreadNeedsLayerTextures(); 305 scheduler->SetMainThreadNeedsLayerTextures();
314 EXPECT_EQ(0, client.num_actions_()); 306 EXPECT_EQ(0, client.num_actions_());
315 client.Reset(); 307 client.Reset();
316 308
317 // Once compositor draw complete, the delayed texture acquisition fires. 309 // Once compositor draw complete, the delayed texture acquisition fires.
318 scheduler->BeginFrame(base::TimeTicks::Now()); 310 time_source->Tick();
319 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 3); 311 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 3);
320 EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread", 312 EXPECT_ACTION("ScheduledActionAcquireLayerTexturesForMainThread",
321 client, 313 client,
322 1, 314 1,
323 3); 315 3);
324 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 2, 3); 316 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 2, 3);
325 client.Reset(); 317 client.Reset();
326 } 318 }
327 319
328 TEST(SchedulerTest, VisibilitySwitchWithTextureAcquisition) { 320 TEST(SchedulerTest, VisibilitySwitchWithTextureAcquisition) {
329 FakeSchedulerClient client; 321 FakeSchedulerClient client;
322 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
330 SchedulerSettings default_scheduler_settings; 323 SchedulerSettings default_scheduler_settings;
331 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 324 Scheduler* scheduler = client.CreateScheduler(
325 make_scoped_ptr(new FrameRateController(time_source)),
326 default_scheduler_settings);
332 scheduler->SetCanStart(); 327 scheduler->SetCanStart();
333 scheduler->SetVisible(true); 328 scheduler->SetVisible(true);
334 scheduler->SetCanDraw(true); 329 scheduler->SetCanDraw(true);
335 330
336 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 331 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
337 client.Reset(); 332 client.Reset();
338 scheduler->DidCreateAndInitializeOutputSurface(); 333 scheduler->DidCreateAndInitializeOutputSurface();
339 334
340 scheduler->SetNeedsCommit(); 335 scheduler->SetNeedsCommit();
341 scheduler->FinishCommit(); 336 scheduler->FinishCommit();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE {} 372 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE {}
378 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE {} 373 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE {}
379 }; 374 };
380 375
381 // Tests for two different situations: 376 // Tests for two different situations:
382 // 1. the scheduler dropping SetNeedsRedraw requests that happen inside 377 // 1. the scheduler dropping SetNeedsRedraw requests that happen inside
383 // a ScheduledActionDrawAndSwap 378 // a ScheduledActionDrawAndSwap
384 // 2. the scheduler drawing twice inside a single tick 379 // 2. the scheduler drawing twice inside a single tick
385 TEST(SchedulerTest, RequestRedrawInsideDraw) { 380 TEST(SchedulerTest, RequestRedrawInsideDraw) {
386 SchedulerClientThatsetNeedsDrawInsideDraw client; 381 SchedulerClientThatsetNeedsDrawInsideDraw client;
382 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
387 SchedulerSettings default_scheduler_settings; 383 SchedulerSettings default_scheduler_settings;
388 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 384 Scheduler* scheduler = client.CreateScheduler(
385 make_scoped_ptr(new FrameRateController(time_source)),
386 default_scheduler_settings);
389 scheduler->SetCanStart(); 387 scheduler->SetCanStart();
390 scheduler->SetVisible(true); 388 scheduler->SetVisible(true);
391 scheduler->SetCanDraw(true); 389 scheduler->SetCanDraw(true);
392 scheduler->DidCreateAndInitializeOutputSurface(); 390 scheduler->DidCreateAndInitializeOutputSurface();
393 391
394 scheduler->SetNeedsRedraw(); 392 scheduler->SetNeedsRedraw();
395 EXPECT_TRUE(scheduler->RedrawPending()); 393 EXPECT_TRUE(scheduler->RedrawPending());
396 EXPECT_TRUE(client.needs_begin_frame()); 394 EXPECT_TRUE(time_source->Active());
397 EXPECT_EQ(0, client.num_draws()); 395 EXPECT_EQ(0, client.num_draws());
398 396
399 scheduler->BeginFrame(base::TimeTicks::Now()); 397 time_source->Tick();
400 EXPECT_EQ(1, client.num_draws()); 398 EXPECT_EQ(1, client.num_draws());
401 EXPECT_TRUE(scheduler->RedrawPending()); 399 EXPECT_TRUE(scheduler->RedrawPending());
402 EXPECT_TRUE(client.needs_begin_frame()); 400 EXPECT_TRUE(time_source->Active());
403 401
404 scheduler->BeginFrame(base::TimeTicks::Now()); 402 time_source->Tick();
405 EXPECT_EQ(2, client.num_draws()); 403 EXPECT_EQ(2, client.num_draws());
406 EXPECT_FALSE(scheduler->RedrawPending()); 404 EXPECT_FALSE(scheduler->RedrawPending());
407 EXPECT_FALSE(client.needs_begin_frame()); 405 EXPECT_FALSE(time_source->Active());
408 } 406 }
409 407
410 // Test that requesting redraw inside a failed draw doesn't lose the request. 408 // Test that requesting redraw inside a failed draw doesn't lose the request.
411 TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { 409 TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
412 SchedulerClientThatsetNeedsDrawInsideDraw client; 410 SchedulerClientThatsetNeedsDrawInsideDraw client;
411 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
413 SchedulerSettings default_scheduler_settings; 412 SchedulerSettings default_scheduler_settings;
414 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 413 Scheduler* scheduler = client.CreateScheduler(
414 make_scoped_ptr(new FrameRateController(time_source)),
415 default_scheduler_settings);
415 scheduler->SetCanStart(); 416 scheduler->SetCanStart();
416 scheduler->SetVisible(true); 417 scheduler->SetVisible(true);
417 scheduler->SetCanDraw(true); 418 scheduler->SetCanDraw(true);
418 scheduler->DidCreateAndInitializeOutputSurface(); 419 scheduler->DidCreateAndInitializeOutputSurface();
419 420
420 client.SetDrawWillHappen(false); 421 client.SetDrawWillHappen(false);
421 422
422 scheduler->SetNeedsRedraw(); 423 scheduler->SetNeedsRedraw();
423 EXPECT_TRUE(scheduler->RedrawPending()); 424 EXPECT_TRUE(scheduler->RedrawPending());
424 EXPECT_TRUE(client.needs_begin_frame()); 425 EXPECT_TRUE(time_source->Active());
425 EXPECT_EQ(0, client.num_draws()); 426 EXPECT_EQ(0, client.num_draws());
426 427
427 // Fail the draw. 428 // Fail the draw.
428 scheduler->BeginFrame(base::TimeTicks::Now()); 429 time_source->Tick();
429 EXPECT_EQ(1, client.num_draws()); 430 EXPECT_EQ(1, client.num_draws());
430 431
431 // We have a commit pending and the draw failed, and we didn't lose the redraw 432 // We have a commit pending and the draw failed, and we didn't lose the redraw
432 // request. 433 // request.
433 EXPECT_TRUE(scheduler->CommitPending()); 434 EXPECT_TRUE(scheduler->CommitPending());
434 EXPECT_TRUE(scheduler->RedrawPending()); 435 EXPECT_TRUE(scheduler->RedrawPending());
435 EXPECT_TRUE(client.needs_begin_frame()); 436 EXPECT_TRUE(time_source->Active());
436 437
437 // Fail the draw again. 438 // Fail the draw again.
438 scheduler->BeginFrame(base::TimeTicks::Now()); 439 time_source->Tick();
439 EXPECT_EQ(2, client.num_draws()); 440 EXPECT_EQ(2, client.num_draws());
440 EXPECT_TRUE(scheduler->CommitPending()); 441 EXPECT_TRUE(scheduler->CommitPending());
441 EXPECT_TRUE(scheduler->RedrawPending()); 442 EXPECT_TRUE(scheduler->RedrawPending());
442 EXPECT_TRUE(client.needs_begin_frame()); 443 EXPECT_TRUE(time_source->Active());
443 444
444 // Draw successfully. 445 // Draw successfully.
445 client.SetDrawWillHappen(true); 446 client.SetDrawWillHappen(true);
446 scheduler->BeginFrame(base::TimeTicks::Now()); 447 time_source->Tick();
447 EXPECT_EQ(3, client.num_draws()); 448 EXPECT_EQ(3, client.num_draws());
448 EXPECT_TRUE(scheduler->CommitPending()); 449 EXPECT_TRUE(scheduler->CommitPending());
449 EXPECT_FALSE(scheduler->RedrawPending()); 450 EXPECT_FALSE(scheduler->RedrawPending());
450 EXPECT_TRUE(client.needs_begin_frame()); 451 EXPECT_FALSE(time_source->Active());
451 } 452 }
452 453
453 class SchedulerClientThatsetNeedsCommitInsideDraw : public FakeSchedulerClient { 454 class SchedulerClientThatsetNeedsCommitInsideDraw : public FakeSchedulerClient {
454 public: 455 public:
455 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE {} 456 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE {}
456 virtual ScheduledActionDrawAndSwapResult 457 virtual ScheduledActionDrawAndSwapResult
457 ScheduledActionDrawAndSwapIfPossible() OVERRIDE { 458 ScheduledActionDrawAndSwapIfPossible() OVERRIDE {
458 // Only SetNeedsCommit the first time this is called 459 // Only SetNeedsCommit the first time this is called
459 if (!num_draws_) 460 if (!num_draws_)
460 scheduler_->SetNeedsCommit(); 461 scheduler_->SetNeedsCommit();
461 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible(); 462 return FakeSchedulerClient::ScheduledActionDrawAndSwapIfPossible();
462 } 463 }
463 464
464 virtual ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapForced() 465 virtual ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapForced()
465 OVERRIDE { 466 OVERRIDE {
466 NOTREACHED(); 467 NOTREACHED();
467 return ScheduledActionDrawAndSwapResult(true, true); 468 return ScheduledActionDrawAndSwapResult(true, true);
468 } 469 }
469 470
470 virtual void ScheduledActionCommit() OVERRIDE {} 471 virtual void ScheduledActionCommit() OVERRIDE {}
471 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE {} 472 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE {}
472 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE {} 473 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE {}
473 }; 474 };
474 475
475 // Tests for the scheduler infinite-looping on SetNeedsCommit requests that 476 // Tests for the scheduler infinite-looping on SetNeedsCommit requests that
476 // happen inside a ScheduledActionDrawAndSwap 477 // happen inside a ScheduledActionDrawAndSwap
477 TEST(SchedulerTest, RequestCommitInsideDraw) { 478 TEST(SchedulerTest, RequestCommitInsideDraw) {
478 SchedulerClientThatsetNeedsCommitInsideDraw client; 479 SchedulerClientThatsetNeedsCommitInsideDraw client;
480 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
479 SchedulerSettings default_scheduler_settings; 481 SchedulerSettings default_scheduler_settings;
480 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 482 Scheduler* scheduler = client.CreateScheduler(
483 make_scoped_ptr(new FrameRateController(time_source)),
484 default_scheduler_settings);
481 scheduler->SetCanStart(); 485 scheduler->SetCanStart();
482 scheduler->SetVisible(true); 486 scheduler->SetVisible(true);
483 scheduler->SetCanDraw(true); 487 scheduler->SetCanDraw(true);
484 scheduler->DidCreateAndInitializeOutputSurface(); 488 scheduler->DidCreateAndInitializeOutputSurface();
485 489
486 scheduler->SetNeedsRedraw(); 490 scheduler->SetNeedsRedraw();
487 EXPECT_TRUE(scheduler->RedrawPending()); 491 EXPECT_TRUE(scheduler->RedrawPending());
488 EXPECT_EQ(0, client.num_draws()); 492 EXPECT_EQ(0, client.num_draws());
489 EXPECT_TRUE(client.needs_begin_frame()); 493 EXPECT_TRUE(time_source->Active());
490 494
491 scheduler->BeginFrame(base::TimeTicks::Now()); 495 time_source->Tick();
496 EXPECT_FALSE(time_source->Active());
492 EXPECT_EQ(1, client.num_draws()); 497 EXPECT_EQ(1, client.num_draws());
493 EXPECT_TRUE(scheduler->CommitPending()); 498 EXPECT_TRUE(scheduler->CommitPending());
494 EXPECT_TRUE(client.needs_begin_frame());
495 scheduler->FinishCommit(); 499 scheduler->FinishCommit();
496 500
497 scheduler->BeginFrame(base::TimeTicks::Now()); 501 time_source->Tick();
498 EXPECT_EQ(2, client.num_draws());; 502 EXPECT_EQ(2, client.num_draws());
503 EXPECT_FALSE(time_source->Active());
499 EXPECT_FALSE(scheduler->RedrawPending()); 504 EXPECT_FALSE(scheduler->RedrawPending());
500 EXPECT_FALSE(scheduler->CommitPending());
501 EXPECT_FALSE(client.needs_begin_frame());
502 } 505 }
503 506
504 // Tests that when a draw fails then the pending commit should not be dropped. 507 // Tests that when a draw fails then the pending commit should not be dropped.
505 TEST(SchedulerTest, RequestCommitInsideFailedDraw) { 508 TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
506 SchedulerClientThatsetNeedsDrawInsideDraw client; 509 SchedulerClientThatsetNeedsDrawInsideDraw client;
510 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
507 SchedulerSettings default_scheduler_settings; 511 SchedulerSettings default_scheduler_settings;
508 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 512 Scheduler* scheduler = client.CreateScheduler(
513 make_scoped_ptr(new FrameRateController(time_source)),
514 default_scheduler_settings);
509 scheduler->SetCanStart(); 515 scheduler->SetCanStart();
510 scheduler->SetVisible(true); 516 scheduler->SetVisible(true);
511 scheduler->SetCanDraw(true); 517 scheduler->SetCanDraw(true);
512 scheduler->DidCreateAndInitializeOutputSurface(); 518 scheduler->DidCreateAndInitializeOutputSurface();
513 519
514 client.SetDrawWillHappen(false); 520 client.SetDrawWillHappen(false);
515 521
516 scheduler->SetNeedsRedraw(); 522 scheduler->SetNeedsRedraw();
517 EXPECT_TRUE(scheduler->RedrawPending()); 523 EXPECT_TRUE(scheduler->RedrawPending());
518 EXPECT_TRUE(client.needs_begin_frame()); 524 EXPECT_TRUE(time_source->Active());
519 EXPECT_EQ(0, client.num_draws()); 525 EXPECT_EQ(0, client.num_draws());
520 526
521 // Fail the draw. 527 // Fail the draw.
522 scheduler->BeginFrame(base::TimeTicks::Now()); 528 time_source->Tick();
523 EXPECT_EQ(1, client.num_draws()); 529 EXPECT_EQ(1, client.num_draws());
524 530
525 // We have a commit pending and the draw failed, and we didn't lose the commit 531 // We have a commit pending and the draw failed, and we didn't lose the commit
526 // request. 532 // request.
527 EXPECT_TRUE(scheduler->CommitPending()); 533 EXPECT_TRUE(scheduler->CommitPending());
528 EXPECT_TRUE(scheduler->RedrawPending()); 534 EXPECT_TRUE(scheduler->RedrawPending());
529 EXPECT_TRUE(client.needs_begin_frame()); 535 EXPECT_TRUE(time_source->Active());
530 536
531 // Fail the draw again. 537 // Fail the draw again.
532 scheduler->BeginFrame(base::TimeTicks::Now()); 538 time_source->Tick();
533 EXPECT_EQ(2, client.num_draws()); 539 EXPECT_EQ(2, client.num_draws());
534 EXPECT_TRUE(scheduler->CommitPending()); 540 EXPECT_TRUE(scheduler->CommitPending());
535 EXPECT_TRUE(scheduler->RedrawPending()); 541 EXPECT_TRUE(scheduler->RedrawPending());
536 EXPECT_TRUE(client.needs_begin_frame()); 542 EXPECT_TRUE(time_source->Active());
537 543
538 // Draw successfully. 544 // Draw successfully.
539 client.SetDrawWillHappen(true); 545 client.SetDrawWillHappen(true);
540 scheduler->BeginFrame(base::TimeTicks::Now()); 546 time_source->Tick();
541 EXPECT_EQ(3, client.num_draws()); 547 EXPECT_EQ(3, client.num_draws());
542 EXPECT_TRUE(scheduler->CommitPending()); 548 EXPECT_TRUE(scheduler->CommitPending());
543 EXPECT_FALSE(scheduler->RedrawPending()); 549 EXPECT_FALSE(scheduler->RedrawPending());
544 EXPECT_TRUE(client.needs_begin_frame()); 550 EXPECT_FALSE(time_source->Active());
545 } 551 }
546 552
547 TEST(SchedulerTest, NoSwapWhenDrawFails) { 553 TEST(SchedulerTest, NoSwapWhenDrawFails) {
554 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
548 SchedulerClientThatsetNeedsCommitInsideDraw client; 555 SchedulerClientThatsetNeedsCommitInsideDraw client;
556 scoped_ptr<FakeFrameRateController> controller(
557 new FakeFrameRateController(time_source));
558 FakeFrameRateController* controller_ptr = controller.get();
549 SchedulerSettings default_scheduler_settings; 559 SchedulerSettings default_scheduler_settings;
550 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 560 Scheduler* scheduler = client.CreateScheduler(
561 controller.PassAs<FrameRateController>(),
562 default_scheduler_settings);
551 scheduler->SetCanStart(); 563 scheduler->SetCanStart();
552 scheduler->SetVisible(true); 564 scheduler->SetVisible(true);
553 scheduler->SetCanDraw(true); 565 scheduler->SetCanDraw(true);
554 scheduler->DidCreateAndInitializeOutputSurface(); 566 scheduler->DidCreateAndInitializeOutputSurface();
555 567
568 EXPECT_EQ(0, controller_ptr->NumFramesPending());
569
556 scheduler->SetNeedsRedraw(); 570 scheduler->SetNeedsRedraw();
557 EXPECT_TRUE(scheduler->RedrawPending()); 571 EXPECT_TRUE(scheduler->RedrawPending());
558 EXPECT_TRUE(client.needs_begin_frame()); 572 EXPECT_TRUE(time_source->Active());
559 EXPECT_EQ(0, client.num_draws()); 573 EXPECT_EQ(0, client.num_draws());
560 574
561 // Draw successfully, this starts a new frame. 575 // Draw successfully, this starts a new frame.
562 scheduler->BeginFrame(base::TimeTicks::Now()); 576 time_source->Tick();
563 EXPECT_EQ(1, client.num_draws()); 577 EXPECT_EQ(1, client.num_draws());
578 EXPECT_EQ(1, controller_ptr->NumFramesPending());
579 scheduler->DidSwapBuffersComplete();
580 EXPECT_EQ(0, controller_ptr->NumFramesPending());
564 581
565 scheduler->SetNeedsRedraw(); 582 scheduler->SetNeedsRedraw();
566 EXPECT_TRUE(scheduler->RedrawPending()); 583 EXPECT_TRUE(scheduler->RedrawPending());
567 EXPECT_TRUE(client.needs_begin_frame()); 584 EXPECT_TRUE(time_source->Active());
568 585
569 // Fail to draw, this should not start a frame. 586 // Fail to draw, this should not start a frame.
570 client.SetDrawWillHappen(false); 587 client.SetDrawWillHappen(false);
571 scheduler->BeginFrame(base::TimeTicks::Now()); 588 time_source->Tick();
572 EXPECT_EQ(2, client.num_draws()); 589 EXPECT_EQ(2, client.num_draws());
590 EXPECT_EQ(0, controller_ptr->NumFramesPending());
573 } 591 }
574 592
575 TEST(SchedulerTest, NoSwapWhenSwapFailsDuringForcedCommit) { 593 TEST(SchedulerTest, NoSwapWhenSwapFailsDuringForcedCommit) {
594 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
576 FakeSchedulerClient client; 595 FakeSchedulerClient client;
596 scoped_ptr<FakeFrameRateController> controller(
597 new FakeFrameRateController(time_source));
598 FakeFrameRateController* controller_ptr = controller.get();
577 SchedulerSettings default_scheduler_settings; 599 SchedulerSettings default_scheduler_settings;
578 Scheduler* scheduler = client.CreateScheduler(default_scheduler_settings); 600 Scheduler* scheduler = client.CreateScheduler(
601 controller.PassAs<FrameRateController>(),
602 default_scheduler_settings);
603
604 EXPECT_EQ(0, controller_ptr->NumFramesPending());
579 605
580 // Tell the client that it will fail to swap. 606 // Tell the client that it will fail to swap.
581 client.SetDrawWillHappen(true); 607 client.SetDrawWillHappen(true);
582 client.SetSwapWillHappenIfDrawHappens(false); 608 client.SetSwapWillHappenIfDrawHappens(false);
583 609
584 // Get the compositor to do a ScheduledActionDrawAndSwapForced. 610 // Get the compositor to do a ScheduledActionDrawAndSwapForced.
585 scheduler->SetCanDraw(true);
586 scheduler->SetNeedsRedraw(); 611 scheduler->SetNeedsRedraw();
587 scheduler->SetNeedsForcedRedraw(); 612 scheduler->SetNeedsForcedRedraw();
588 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapForced")); 613 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapForced"));
614
615 // We should not have told the frame rate controller that we began a frame.
616 EXPECT_EQ(0, controller_ptr->NumFramesPending());
617 }
618
619 TEST(SchedulerTest, RecreateOutputSurfaceClearsPendingDrawCount) {
620 scoped_refptr<FakeTimeSource> time_source(new FakeTimeSource());
621 FakeSchedulerClient client;
622 scoped_ptr<FakeFrameRateController> controller(
623 new FakeFrameRateController(time_source));
624 FakeFrameRateController* controller_ptr = controller.get();
625 SchedulerSettings default_scheduler_settings;
626 Scheduler* scheduler = client.CreateScheduler(
627 controller.PassAs<FrameRateController>(),
628 default_scheduler_settings);
629
630 scheduler->SetCanStart();
631 scheduler->SetVisible(true);
632 scheduler->SetCanDraw(true);
633 scheduler->DidCreateAndInitializeOutputSurface();
634
635 // Draw successfully, this starts a new frame.
636 scheduler->SetNeedsRedraw();
637 time_source->Tick();
638 EXPECT_EQ(1, controller_ptr->NumFramesPending());
639
640 scheduler->DidLoseOutputSurface();
641 // Verifying that it's 1 so that we know that it's reset on recreate.
642 EXPECT_EQ(1, controller_ptr->NumFramesPending());
643
644 scheduler->DidCreateAndInitializeOutputSurface();
645 EXPECT_EQ(0, controller_ptr->NumFramesPending());
589 } 646 }
590 647
591 } // namespace 648 } // namespace
592 } // namespace cc 649 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/scheduler/scheduler_state_machine_unittest.cc ('k') | trunk/src/cc/scheduler/vsync_time_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698