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

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

Issue 23907006: cc: Allow sending BeginMainFrame before draw or activation (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedDeadline3
Patch Set: fix typo Created 6 years, 10 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 #include "cc/scheduler/scheduler.h" 4 #include "cc/scheduler/scheduler.h"
5 5
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 EXPECT_TRUE(client.needs_begin_impl_frame()); 326 EXPECT_TRUE(client.needs_begin_impl_frame());
327 client.Reset(); 327 client.Reset();
328 328
329 // Now SetNeedsCommit again. Calling here means we need a second commit. 329 // Now SetNeedsCommit again. Calling here means we need a second commit.
330 scheduler->SetNeedsCommit(); 330 scheduler->SetNeedsCommit();
331 EXPECT_EQ(client.num_actions_(), 0); 331 EXPECT_EQ(client.num_actions_(), 0);
332 client.Reset(); 332 client.Reset();
333 333
334 // Finish the first commit. 334 // Finish the first commit.
335 scheduler->FinishCommit(); 335 scheduler->FinishCommit();
336 EXPECT_ACTION("ScheduledActionCommit", client, 0, 2); 336 if (deadline_scheduling_enabled) {
337 EXPECT_ACTION("PostBeginImplFrameDeadlineTask", client, 1, 2); 337 EXPECT_ACTION("ScheduledActionCommit", client, 0, 2);
338 EXPECT_ACTION("PostBeginImplFrameDeadlineTask", client, 1, 2);
339 } else {
340 EXPECT_ACTION("ScheduledActionCommit", client, 0, 3);
341 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 3);
342 EXPECT_ACTION("PostBeginImplFrameDeadlineTask", client, 2, 3);
343 }
338 client.Reset(); 344 client.Reset();
339 scheduler->OnBeginImplFrameDeadline(); 345 scheduler->OnBeginImplFrameDeadline();
340 if (deadline_scheduling_enabled) { 346 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
341 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2); 347 EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
342 EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
343 } else {
344 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 3);
345 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 3);
346 EXPECT_ACTION("SetNeedsBeginImplFrame", client, 2, 3);
347 }
348 348
349 // Because we just swapped, the Scheduler should also request the next 349 // Because we just swapped, the Scheduler should also request the next
350 // BeginImplFrame from the OutputSurface. 350 // BeginImplFrame from the OutputSurface.
351 EXPECT_TRUE(client.needs_begin_impl_frame()); 351 EXPECT_TRUE(client.needs_begin_impl_frame());
352 client.Reset(); 352 client.Reset();
353 353
354 // Since another commit is needed, the next BeginImplFrame should initiate 354 // Since another commit is needed, the next BeginImplFrame should initiate
355 // the second commit. 355 // the second commit.
356 scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting()); 356 scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
357 if (deadline_scheduling_enabled) { 357 if (deadline_scheduling_enabled) {
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 SpinForMillis(interval * 2); 1338 SpinForMillis(interval * 2);
1339 EXPECT_GT(client.num_actions_(), actions_so_far); 1339 EXPECT_GT(client.num_actions_(), actions_so_far);
1340 EXPECT_STREQ(client.Action(client.num_actions_() - 1), 1340 EXPECT_STREQ(client.Action(client.num_actions_() - 1),
1341 "DidAnticipatedDrawTimeChange"); 1341 "DidAnticipatedDrawTimeChange");
1342 actions_so_far = client.num_actions_(); 1342 actions_so_far = client.num_actions_();
1343 } 1343 }
1344 } 1344 }
1345 1345
1346 } // namespace 1346 } // namespace
1347 } // namespace cc 1347 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698