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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 2753843003: Create a new action triggered when a BeginMainFrame is not expected before vsync (Closed)
Patch Set: Respond to Sami's comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 72e31f537359a3315308a014740cababa0e09afd..547103a469513db02c710a8231ea49dc060f9369 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -179,6 +179,11 @@ class FakeSchedulerClient : public SchedulerClient,
PushAction("SendBeginMainFrameNotExpectedSoon");
}
+ void ScheduledActionBeginMainFrameNotExpectedUntil(
+ base::TimeTicks frame_time) override {
+ PushAction("ScheduledActionBeginMainFrameNotExpectedUntil");
+ }
+
bool IsInsideBeginImplFrame() const { return inside_begin_impl_frame_; }
base::Callback<bool(void)> InsideBeginImplFrame(bool state) {
@@ -481,12 +486,14 @@ TEST_F(SchedulerTest, VideoNeedsBeginFrames) {
EXPECT_SCOPED(AdvanceFrame());
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
// WillBeginImplFrame is responsible for sending BeginFrames to video.
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
client_->Reset();
scheduler_->SetVideoNeedsBeginFrames(false);
@@ -537,7 +544,8 @@ TEST_F(SchedulerTest, RequestCommit) {
// BeginImplFrame should prepare the draw.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->begin_frames_expected());
client_->Reset();
@@ -552,7 +560,8 @@ TEST_F(SchedulerTest, RequestCommit) {
// The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
// to avoid excessive toggles.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -972,7 +981,8 @@ TEST_F(SchedulerTest, PrepareTiles) {
// the deadline task.
client->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
// On the deadline, the actions should have occured in the right order.
@@ -999,7 +1009,8 @@ TEST_F(SchedulerTest, PrepareTiles) {
// the deadline task.
client->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
// Draw. The draw will trigger SetNeedsPrepareTiles, and
@@ -1019,7 +1030,8 @@ TEST_F(SchedulerTest, PrepareTiles) {
// We need a BeginImplFrame where we don't swap to go idle.
client->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
+ EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client->Reset();
task_runner().RunPendingTasks(); // Run posted deadline.
@@ -1040,7 +1052,8 @@ TEST_F(SchedulerTest, PrepareTiles) {
// BeginImplFrame. There will be no draw, only PrepareTiles.
client->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
+ EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client->Reset();
task_runner().RunPendingTasks(); // Run posted deadline.
@@ -1061,7 +1074,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
scheduler_->SetNeedsRedraw();
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->PrepareTilesPending());
@@ -1083,7 +1097,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
scheduler_->SetNeedsRedraw();
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -1105,7 +1120,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
scheduler_->SetNeedsRedraw();
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->PrepareTilesPending());
@@ -1129,7 +1145,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
scheduler_->SetNeedsRedraw();
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->PrepareTilesPending());
@@ -1147,7 +1164,8 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
scheduler_->SetNeedsRedraw();
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -1184,7 +1202,8 @@ TEST_F(SchedulerTest, PrepareTilesFunnelResetOnVisibilityChange) {
client_->Reset();
AdvanceFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -1671,8 +1690,9 @@ TEST_F(SchedulerTest,
scheduler_->SetNeedsRedraw();
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
SendNextBeginFrame();
- EXPECT_ACTION("AddObserver(this)", client_, 0, 2);
- EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2);
+ EXPECT_ACTION("AddObserver(this)", client_, 0, 3);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
client_->Reset();
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
@@ -1704,7 +1724,9 @@ TEST_F(SchedulerTest,
client_->Reset();
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
SendNextBeginFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1,
+ 2);
client_->Reset();
// Deadline should be immediate.
@@ -2082,7 +2104,8 @@ void SchedulerTest::BeginFramesNotFromClient(BeginFrameSourceType bfs_type) {
// NotifyReadyToCommit should trigger the commit.
scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
- EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
+ EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
client_->Reset();
// NotifyReadyToActivate should trigger the activation.
@@ -2093,8 +2116,9 @@ void SchedulerTest::BeginFramesNotFromClient(BeginFrameSourceType bfs_type) {
// BeginImplFrame deadline should draw. The following BeginImplFrame deadline
// should SetNeedsBeginFrame(false) to avoid excessive toggles.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2);
- EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2);
+ EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 3);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
client_->Reset();
// Make sure SetNeedsBeginFrame isn't called on the client
@@ -2345,7 +2369,8 @@ TEST_F(SchedulerTest, DidLoseCompositorFrameSinkAfterSetNeedsPrepareTiles) {
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2506,7 +2531,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->begin_frames_expected());
client_->Reset();
@@ -2520,7 +2546,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
// Unthrottled frame source will immediately begin a new frame.
task_runner().RunPendingTasks(); // Run posted BeginFrame.
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2542,7 +2569,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
// Switch to an unthrottled frame source before the frame deadline is hit.
scheduler_->SetBeginFrameSource(unthrottled_frame_source_.get());
@@ -2553,9 +2581,10 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
client_->Reset();
task_runner().RunPendingTasks(); // Run posted deadline.
- EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 3);
// Unthrottled frame source will immediately begin a new frame.
- EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
scheduler_->SetNeedsRedraw();
client_->Reset();
@@ -2575,7 +2604,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
client_->Reset();
task_runner().RunPendingTasks(); // Run posted BeginFrame.
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2595,7 +2625,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->begin_frames_expected());
client_->Reset();
@@ -2611,7 +2642,8 @@ TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) {
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
client_->Reset();
// Switch to a null frame source.
@@ -2708,6 +2740,23 @@ TEST_F(SchedulerTest, SwitchFrameSourceWhenNotObserving) {
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
}
+// Tests to ensure that we send a ScheduledActionBeginMainFrameNotExpectedUntil
+// when expected.
+TEST_F(SchedulerTest, ScheduledActionBeginMainFrameNotExpectedUntil) {
+ SetUpScheduler(EXTERNAL_BFS);
+
+ scheduler_->SetNeedsRedraw();
+ EXPECT_ACTION("AddObserver(this)", client_, 0, 1);
+ client_->Reset();
+
+ EXPECT_SCOPED(AdvanceFrame());
+ task_runner().RunPendingTasks();
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3);
+ client_->Reset();
+}
+
// Tests to ensure that we send a BeginMainFrameNotExpectedSoon when expected.
TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
SetUpScheduler(EXTERNAL_BFS);
@@ -2733,7 +2782,8 @@ TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
// The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
// and send a SendBeginMainFrameNotExpectedSoon.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2758,8 +2808,9 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
// Next vsync.
AdvanceFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
- EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+ EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 2, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 3);
EXPECT_FALSE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2777,8 +2828,9 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
// Next vsync.
AdvanceFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
- EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+ EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
EXPECT_FALSE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2791,9 +2843,10 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
// Idle on next vsync, as the animation has completed.
AdvanceFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
- EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
- EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
+ EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
+ EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
EXPECT_FALSE(client_->IsInsideBeginImplFrame());
client_->Reset();
}
@@ -2812,9 +2865,10 @@ TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) {
// Idle on next vsync.
AdvanceFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
- EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
- EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
+ EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
+ EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
EXPECT_FALSE(client_->IsInsideBeginImplFrame());
client_->Reset();
}
@@ -2834,7 +2888,8 @@ TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
// Next vsync, the first requested frame happens.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2843,7 +2898,8 @@ TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
// Next vsync, the second requested frame happens (the one requested inside
// the previous frame's begin impl frame step).
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2904,7 +2960,8 @@ TEST_F(SchedulerTest, SynchronousCompositorCommitAndVerifyBeginFrameAcks) {
fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get()));
scheduler_->NotifyReadyToCommit();
- EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
+ EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
client_->Reset();
scheduler_->NotifyReadyToActivate();
@@ -2913,8 +2970,9 @@ TEST_F(SchedulerTest, SynchronousCompositorCommitAndVerifyBeginFrameAcks) {
// Next vsync.
args = SendNextBeginFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
- EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+ EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
EXPECT_FALSE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -2938,9 +2996,10 @@ TEST_F(SchedulerTest, SynchronousCompositorCommitAndVerifyBeginFrameAcks) {
// Idle on next vsync.
args = SendNextBeginFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
- EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
- EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
+ EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
+ EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
EXPECT_FALSE(client_->IsInsideBeginImplFrame());
client_->Reset();
@@ -3021,8 +3080,9 @@ TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {
// Next vsync.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
- EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+ EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
client_->Reset();
// Android onDraw.
@@ -3047,9 +3107,10 @@ TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {
// Next vsync.
EXPECT_SCOPED(AdvanceFrame());
EXPECT_FALSE(scheduler_->PrepareTilesPending());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
- EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
- EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
+ EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
+ EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
EXPECT_FALSE(scheduler_->begin_frames_expected());
client_->Reset();
}
@@ -3064,8 +3125,9 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
// Next vsync.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
- EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+ EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
client_->Reset();
// Android onDraw.
@@ -3093,8 +3155,9 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
// Next vsync.
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
- EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+ EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
client_->Reset();
// Android onDraw.
@@ -3229,7 +3292,8 @@ TEST_F(SchedulerTest, ImplSideInvalidationsInDeadline) {
scheduler_->SetNeedsImplSideInvalidation();
client_->Reset();
EXPECT_SCOPED(AdvanceFrame());
- EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
// Deadline.
client_->Reset();
@@ -3395,7 +3459,8 @@ TEST_F(SchedulerTest, BeginFrameAckForFinishedImplFrame) {
BeginFrameArgs args = SendNextBeginFrame();
EXPECT_LT(latest_confirmed_sequence_number, args.sequence_number);
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->begin_frames_expected());
client_->Reset();
@@ -3421,7 +3486,8 @@ TEST_F(SchedulerTest, BeginFrameAckForFinishedImplFrame) {
args = SendNextBeginFrame();
EXPECT_LT(latest_confirmed_sequence_number, args.sequence_number);
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->begin_frames_expected());
client_->Reset();
@@ -3456,7 +3522,8 @@ TEST_F(SchedulerTest, BeginFrameAckForSkippedImplFrame) {
client_->Reset();
BeginFrameArgs args = SendNextBeginFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->begin_frames_expected());
client_->Reset();
@@ -3503,7 +3570,8 @@ TEST_F(SchedulerTest, BeginFrameAckForBeginFrameBeforeLastDeadline) {
client_->Reset();
SendNextBeginFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
// Until tiles were prepared, further proactive BeginFrames are expected.
EXPECT_TRUE(scheduler_->begin_frames_expected());
@@ -3546,7 +3614,8 @@ TEST_F(SchedulerTest, BeginFrameAckForDroppedBeginFrame) {
// First BeginFrame is handled by StateMachine.
BeginFrameArgs first_args = SendNextBeginFrame();
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
// State machine is no longer interested in BeginFrames, but scheduler is
// still observing the source.
@@ -3627,7 +3696,8 @@ TEST_F(SchedulerTest, BeginFrameAckForFinishedBeginFrameWithNewSourceId) {
source_id, 1, now_src());
fake_external_begin_frame_source_->TestOnBeginFrame(args);
- EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
+ EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
EXPECT_TRUE(client_->IsInsideBeginImplFrame());
EXPECT_TRUE(scheduler_->begin_frames_expected());
client_->Reset();

Powered by Google App Engine
This is Rietveld 408576698