| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 TRACE_EVENT0("cc", | 282 TRACE_EVENT0("cc", |
| 283 "SchedulerUnitTest::InitializeOutputSurfaceAndFirstCommit"); | 283 "SchedulerUnitTest::InitializeOutputSurfaceAndFirstCommit"); |
| 284 DCHECK(scheduler_); | 284 DCHECK(scheduler_); |
| 285 | 285 |
| 286 // Check the client doesn't have any actions queued when calling this | 286 // Check the client doesn't have any actions queued when calling this |
| 287 // function. | 287 // function. |
| 288 EXPECT_NO_ACTION(client_); | 288 EXPECT_NO_ACTION(client_); |
| 289 EXPECT_FALSE(client_->needs_begin_frames()); | 289 EXPECT_FALSE(client_->needs_begin_frames()); |
| 290 | 290 |
| 291 // Start the initial output surface creation. | 291 // Start the initial output surface creation. |
| 292 EXPECT_FALSE(scheduler_->CanStart()); | |
| 293 scheduler_->SetCanStart(); | |
| 294 scheduler_->SetVisible(true); | 292 scheduler_->SetVisible(true); |
| 295 scheduler_->SetCanDraw(true); | 293 scheduler_->SetCanDraw(true); |
| 296 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 294 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); |
| 297 | 295 |
| 298 client_->Reset(); | 296 client_->Reset(); |
| 299 | 297 |
| 300 // We don't see anything happening until the first impl frame. | 298 // We don't see anything happening until the first impl frame. |
| 301 scheduler_->DidCreateAndInitializeOutputSurface(); | 299 scheduler_->DidCreateAndInitializeOutputSurface(); |
| 302 scheduler_->SetNeedsBeginMainFrame(); | 300 scheduler_->SetNeedsBeginMainFrame(); |
| 303 EXPECT_TRUE(client_->needs_begin_frames()); | 301 EXPECT_TRUE(client_->needs_begin_frames()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source_; | 402 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source_; |
| 405 SchedulerSettings scheduler_settings_; | 403 SchedulerSettings scheduler_settings_; |
| 406 scoped_ptr<FakeSchedulerClient> client_; | 404 scoped_ptr<FakeSchedulerClient> client_; |
| 407 scoped_ptr<TestScheduler> scheduler_; | 405 scoped_ptr<TestScheduler> scheduler_; |
| 408 FakeCompositorTimingHistory* fake_compositor_timing_history_; | 406 FakeCompositorTimingHistory* fake_compositor_timing_history_; |
| 409 }; | 407 }; |
| 410 | 408 |
| 411 TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { | 409 TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { |
| 412 scheduler_settings_.use_external_begin_frame_source = true; | 410 scheduler_settings_.use_external_begin_frame_source = true; |
| 413 SetUpScheduler(false); | 411 SetUpScheduler(false); |
| 414 scheduler_->SetCanStart(); | |
| 415 scheduler_->SetVisible(true); | 412 scheduler_->SetVisible(true); |
| 416 scheduler_->SetCanDraw(true); | 413 scheduler_->SetCanDraw(true); |
| 417 | 414 |
| 418 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 415 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); |
| 419 client_->Reset(); | 416 client_->Reset(); |
| 420 scheduler_->DidCreateAndInitializeOutputSurface(); | 417 scheduler_->DidCreateAndInitializeOutputSurface(); |
| 421 EXPECT_NO_ACTION(client_); | 418 EXPECT_NO_ACTION(client_); |
| 422 } | 419 } |
| 423 | 420 |
| 424 TEST_F(SchedulerTest, SendBeginFramesToChildren) { | 421 TEST_F(SchedulerTest, SendBeginFramesToChildren) { |
| (...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 bool use_external_begin_frame_source = false; | 2589 bool use_external_begin_frame_source = false; |
| 2593 bool throttle_frame_production = false; | 2590 bool throttle_frame_production = false; |
| 2594 BeginFramesNotFromClient_SwapThrottled(use_external_begin_frame_source, | 2591 BeginFramesNotFromClient_SwapThrottled(use_external_begin_frame_source, |
| 2595 throttle_frame_production); | 2592 throttle_frame_production); |
| 2596 } | 2593 } |
| 2597 | 2594 |
| 2598 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterOutputSurfaceIsInitialized) { | 2595 TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterOutputSurfaceIsInitialized) { |
| 2599 scheduler_settings_.use_external_begin_frame_source = true; | 2596 scheduler_settings_.use_external_begin_frame_source = true; |
| 2600 SetUpScheduler(false); | 2597 SetUpScheduler(false); |
| 2601 | 2598 |
| 2602 scheduler_->SetCanStart(); | |
| 2603 scheduler_->SetVisible(true); | 2599 scheduler_->SetVisible(true); |
| 2604 scheduler_->SetCanDraw(true); | 2600 scheduler_->SetCanDraw(true); |
| 2605 | 2601 |
| 2606 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 2602 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); |
| 2607 client_->Reset(); | 2603 client_->Reset(); |
| 2608 scheduler_->DidCreateAndInitializeOutputSurface(); | 2604 scheduler_->DidCreateAndInitializeOutputSurface(); |
| 2609 EXPECT_NO_ACTION(client_); | 2605 EXPECT_NO_ACTION(client_); |
| 2610 | 2606 |
| 2611 scheduler_->DidLoseOutputSurface(); | 2607 scheduler_->DidLoseOutputSurface(); |
| 2612 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 2608 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3511 scheduler_->SetImplLatencyTakesPriority(true); | 3507 scheduler_->SetImplLatencyTakesPriority(true); |
| 3512 scheduler_->SetChildrenNeedBeginFrames(true); | 3508 scheduler_->SetChildrenNeedBeginFrames(true); |
| 3513 | 3509 |
| 3514 EXPECT_SCOPED(AdvanceFrame()); | 3510 EXPECT_SCOPED(AdvanceFrame()); |
| 3515 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 3511 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
| 3516 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); | 3512 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); |
| 3517 } | 3513 } |
| 3518 | 3514 |
| 3519 } // namespace | 3515 } // namespace |
| 3520 } // namespace cc | 3516 } // namespace cc |
| OLD | NEW |