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

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

Issue 1691153002: cc: Consider main thread making deadline upon abort. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reorder expectations Created 4 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
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 scheduler_settings_.use_external_begin_frame_source = true; 1474 scheduler_settings_.use_external_begin_frame_source = true;
1475 SetUpScheduler(true); 1475 SetUpScheduler(true);
1476 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); 1476 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
1477 fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration); 1477 fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration);
1478 1478
1479 bool expect_send_begin_main_frame = true; 1479 bool expect_send_begin_main_frame = true;
1480 EXPECT_SCOPED( 1480 EXPECT_SCOPED(
1481 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); 1481 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame));
1482 } 1482 }
1483 1483
1484 // If the BeginMainFrame aborts, it doesn't actually insert a frame into the
1485 // queue, which means there is no latency to recover.
1486 TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateAbort) {
1487 scheduler_settings_.use_external_begin_frame_source = true;
1488 SetUpScheduler(true);
1489
1490 // Use fast estimates so we think we can recover latency if needed.
1491 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
1492
1493 // Impl thread hits deadline before BeginMainFrame aborts.
1494 scheduler_->SetNeedsBeginMainFrame();
1495 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1496 EXPECT_SCOPED(AdvanceFrame());
1497 EXPECT_ACTION("AddObserver(this)", client_, 0, 3);
1498 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
1499 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3);
1500 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1501 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
1502 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
1503 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
1504 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
1505
1506 // After aborting the frame, make sure we don't skip the
1507 // next BeginMainFrame.
1508 client_->Reset();
1509 scheduler_->BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES);
1510 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1511 scheduler_->SetNeedsBeginMainFrame();
1512 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1513 EXPECT_SCOPED(AdvanceFrame());
1514 EXPECT_TRUE(client_->HasAction("WillBeginImplFrame"));
1515 EXPECT_TRUE(client_->HasAction("ScheduledActionSendBeginMainFrame"));
1516 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1517 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
1518 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
1519 }
1520
1484 void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( 1521 void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
1485 bool swap_ack_before_deadline) { 1522 bool swap_ack_before_deadline) {
1486 // To get into a high latency state, this test disables automatic swap acks. 1523 // To get into a high latency state, this test disables automatic swap acks.
1487 client_->SetAutomaticSwapAck(false); 1524 client_->SetAutomaticSwapAck(false);
1488 1525
1489 // Draw and swap for first BeginFrame 1526 // Draw and swap for first BeginFrame
1490 client_->Reset(); 1527 client_->Reset();
1491 scheduler_->SetNeedsBeginMainFrame(); 1528 scheduler_->SetNeedsBeginMainFrame();
1492 scheduler_->SetNeedsRedraw(); 1529 scheduler_->SetNeedsRedraw();
1493 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); 1530 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3588 } 3625 }
3589 3626
3590 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { 3627 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) {
3591 EXPECT_FALSE(BeginMainFrameOnCriticalPath( 3628 EXPECT_FALSE(BeginMainFrameOnCriticalPath(
3592 SMOOTHNESS_TAKES_PRIORITY, 3629 SMOOTHNESS_TAKES_PRIORITY,
3593 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); 3630 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration));
3594 } 3631 }
3595 3632
3596 } // namespace 3633 } // namespace
3597 } // namespace cc 3634 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698