OLD | NEW |
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 scheduler_->SetCanDraw(true); | 400 scheduler_->SetCanDraw(true); |
401 | 401 |
402 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 402 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); |
403 client_->Reset(); | 403 client_->Reset(); |
404 scheduler_->DidCreateAndInitializeOutputSurface(); | 404 scheduler_->DidCreateAndInitializeOutputSurface(); |
405 EXPECT_NO_ACTION(client_); | 405 EXPECT_NO_ACTION(client_); |
406 } | 406 } |
407 | 407 |
408 TEST_F(SchedulerTest, SendBeginFramesToChildren) { | 408 TEST_F(SchedulerTest, SendBeginFramesToChildren) { |
409 scheduler_settings_.use_external_begin_frame_source = true; | 409 scheduler_settings_.use_external_begin_frame_source = true; |
410 scheduler_settings_.forward_begin_frames_to_children = true; | |
411 SetUpScheduler(true); | 410 SetUpScheduler(true); |
412 | 411 |
413 EXPECT_FALSE(client_->begin_frame_is_sent_to_children()); | 412 EXPECT_FALSE(client_->begin_frame_is_sent_to_children()); |
414 scheduler_->SetNeedsCommit(); | 413 scheduler_->SetNeedsCommit(); |
415 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 414 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
416 EXPECT_TRUE(client_->needs_begin_frames()); | 415 EXPECT_TRUE(client_->needs_begin_frames()); |
417 | 416 |
418 scheduler_->SetChildrenNeedBeginFrames(true); | 417 scheduler_->SetChildrenNeedBeginFrames(true); |
419 | 418 |
420 client_->Reset(); | 419 client_->Reset(); |
421 EXPECT_SCOPED(AdvanceFrame()); | 420 EXPECT_SCOPED(AdvanceFrame()); |
422 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 421 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
423 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 422 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
424 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 423 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
425 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 424 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
426 EXPECT_TRUE(client_->needs_begin_frames()); | 425 EXPECT_TRUE(client_->needs_begin_frames()); |
427 } | 426 } |
428 | 427 |
429 TEST_F(SchedulerTest, SendBeginFramesToChildrenWithoutCommit) { | 428 TEST_F(SchedulerTest, SendBeginFramesToChildrenWithoutCommit) { |
430 scheduler_settings_.use_external_begin_frame_source = true; | 429 scheduler_settings_.use_external_begin_frame_source = true; |
431 scheduler_settings_.forward_begin_frames_to_children = true; | |
432 SetUpScheduler(true); | 430 SetUpScheduler(true); |
433 | 431 |
434 EXPECT_FALSE(client_->needs_begin_frames()); | 432 EXPECT_FALSE(client_->needs_begin_frames()); |
435 scheduler_->SetChildrenNeedBeginFrames(true); | 433 scheduler_->SetChildrenNeedBeginFrames(true); |
436 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 434 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
437 EXPECT_TRUE(client_->needs_begin_frames()); | 435 EXPECT_TRUE(client_->needs_begin_frames()); |
438 | 436 |
439 client_->Reset(); | 437 client_->Reset(); |
440 EXPECT_SCOPED(AdvanceFrame()); | 438 EXPECT_SCOPED(AdvanceFrame()); |
441 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 439 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 client_->Reset(); | 2237 client_->Reset(); |
2240 | 2238 |
2241 task_runner().RunPendingTasks(); // Run posted deadline. | 2239 task_runner().RunPendingTasks(); // Run posted deadline. |
2242 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 2240 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
2243 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | 2241 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
2244 client_->Reset(); | 2242 client_->Reset(); |
2245 } | 2243 } |
2246 | 2244 |
2247 } // namespace | 2245 } // namespace |
2248 } // namespace cc | 2246 } // namespace cc |
OLD | NEW |