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

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

Issue 2753843003: Create a new action triggered when a BeginMainFrame is not expected before vsync (Closed)
Patch Set: Add BeginMainFrameNotExpectedUntil to content::CompositorImpl for Android. Created 3 years, 7 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_unittest.cc ('k') | cc/test/layer_tree_test.cc » ('j') | 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 states_.push_back(scheduler_->AsValue()); 172 states_.push_back(scheduler_->AsValue());
173 } 173 }
174 void ScheduledActionPerformImplSideInvalidation() override { 174 void ScheduledActionPerformImplSideInvalidation() override {
175 PushAction("ScheduledActionPerformImplSideInvalidation"); 175 PushAction("ScheduledActionPerformImplSideInvalidation");
176 } 176 }
177 177
178 void SendBeginMainFrameNotExpectedSoon() override { 178 void SendBeginMainFrameNotExpectedSoon() override {
179 PushAction("SendBeginMainFrameNotExpectedSoon"); 179 PushAction("SendBeginMainFrameNotExpectedSoon");
180 } 180 }
181 181
182 void ScheduledActionBeginMainFrameNotExpectedUntil(
183 base::TimeTicks time) override {
184 PushAction("ScheduledActionBeginMainFrameNotExpectedUntil");
185 }
186
182 bool IsInsideBeginImplFrame() const { return inside_begin_impl_frame_; } 187 bool IsInsideBeginImplFrame() const { return inside_begin_impl_frame_; }
183 188
184 base::Callback<bool(void)> InsideBeginImplFrame(bool state) { 189 base::Callback<bool(void)> InsideBeginImplFrame(bool state) {
185 return base::Bind(&FakeSchedulerClient::InsideBeginImplFrameCallback, 190 return base::Bind(&FakeSchedulerClient::InsideBeginImplFrameCallback,
186 base::Unretained(this), state); 191 base::Unretained(this), state);
187 } 192 }
188 193
189 bool IsCurrentFrame(int last_frame_number) const { 194 bool IsCurrentFrame(int last_frame_number) const {
190 return scheduler_->current_frame_number() == last_frame_number; 195 return scheduler_->current_frame_number() == last_frame_number;
191 } 196 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 SetUpScheduler(EXTERNAL_BFS); 483 SetUpScheduler(EXTERNAL_BFS);
479 484
480 scheduler_->SetVideoNeedsBeginFrames(true); 485 scheduler_->SetVideoNeedsBeginFrames(true);
481 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 486 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
482 EXPECT_TRUE(scheduler_->begin_frames_expected()); 487 EXPECT_TRUE(scheduler_->begin_frames_expected());
483 488
484 client_->Reset(); 489 client_->Reset();
485 EXPECT_SCOPED(AdvanceFrame()); 490 EXPECT_SCOPED(AdvanceFrame());
486 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 491 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
487 // WillBeginImplFrame is responsible for sending BeginFrames to video. 492 // WillBeginImplFrame is responsible for sending BeginFrames to video.
488 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 493 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
494 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
489 495
490 client_->Reset(); 496 client_->Reset();
491 EXPECT_SCOPED(AdvanceFrame()); 497 EXPECT_SCOPED(AdvanceFrame());
492 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 498 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
493 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 499 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
500 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
494 501
495 client_->Reset(); 502 client_->Reset();
496 scheduler_->SetVideoNeedsBeginFrames(false); 503 scheduler_->SetVideoNeedsBeginFrames(false);
497 EXPECT_NO_ACTION(client_); 504 EXPECT_NO_ACTION(client_);
498 505
499 client_->Reset(); 506 client_->Reset();
500 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); 507 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
501 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 508 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
502 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2); 509 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
503 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); 510 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
(...skipping 30 matching lines...) Expand all
534 client_->Reset(); 541 client_->Reset();
535 542
536 // NotifyReadyToActivate should trigger the activation. 543 // NotifyReadyToActivate should trigger the activation.
537 scheduler_->NotifyReadyToActivate(); 544 scheduler_->NotifyReadyToActivate();
538 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); 545 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
539 EXPECT_TRUE(scheduler_->begin_frames_expected()); 546 EXPECT_TRUE(scheduler_->begin_frames_expected());
540 client_->Reset(); 547 client_->Reset();
541 548
542 // BeginImplFrame should prepare the draw. 549 // BeginImplFrame should prepare the draw.
543 EXPECT_SCOPED(AdvanceFrame()); 550 EXPECT_SCOPED(AdvanceFrame());
544 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 551 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
552 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
545 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 553 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
546 EXPECT_TRUE(scheduler_->begin_frames_expected()); 554 EXPECT_TRUE(scheduler_->begin_frames_expected());
547 client_->Reset(); 555 client_->Reset();
548 556
549 // BeginImplFrame deadline should draw. 557 // BeginImplFrame deadline should draw.
550 task_runner().RunPendingTasks(); // Run posted deadline. 558 task_runner().RunPendingTasks(); // Run posted deadline.
551 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 559 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
552 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 560 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
553 EXPECT_TRUE(scheduler_->begin_frames_expected()); 561 EXPECT_TRUE(scheduler_->begin_frames_expected());
554 client_->Reset(); 562 client_->Reset();
555 563
556 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) 564 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
557 // to avoid excessive toggles. 565 // to avoid excessive toggles.
558 EXPECT_SCOPED(AdvanceFrame()); 566 EXPECT_SCOPED(AdvanceFrame());
559 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 567 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
568 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
560 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 569 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
561 client_->Reset(); 570 client_->Reset();
562 571
563 task_runner().RunPendingTasks(); // Run posted deadline. 572 task_runner().RunPendingTasks(); // Run posted deadline.
564 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2); 573 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
565 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); 574 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
566 client_->Reset(); 575 client_->Reset();
567 } 576 }
568 577
569 TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) { 578 TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 EXPECT_TRUE(scheduler_->PrepareTilesPending()); 978 EXPECT_TRUE(scheduler_->PrepareTilesPending());
970 EXPECT_TRUE(client->needs_begin_frames()); 979 EXPECT_TRUE(client->needs_begin_frames());
971 EXPECT_EQ(0, client->num_draws()); 980 EXPECT_EQ(0, client->num_draws());
972 EXPECT_FALSE(client->HasAction("ScheduledActionPrepareTiles")); 981 EXPECT_FALSE(client->HasAction("ScheduledActionPrepareTiles"));
973 EXPECT_FALSE(client->HasAction("ScheduledActionDrawIfPossible")); 982 EXPECT_FALSE(client->HasAction("ScheduledActionDrawIfPossible"));
974 983
975 // We have no immediate actions to perform, so the BeginImplFrame should post 984 // We have no immediate actions to perform, so the BeginImplFrame should post
976 // the deadline task. 985 // the deadline task.
977 client->Reset(); 986 client->Reset();
978 EXPECT_SCOPED(AdvanceFrame()); 987 EXPECT_SCOPED(AdvanceFrame());
979 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); 988 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
989 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
980 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 990 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
981 991
982 // On the deadline, the actions should have occured in the right order. 992 // On the deadline, the actions should have occured in the right order.
983 client->Reset(); 993 client->Reset();
984 task_runner().RunPendingTasks(); // Run posted deadline. 994 task_runner().RunPendingTasks(); // Run posted deadline.
985 EXPECT_EQ(1, client->num_draws()); 995 EXPECT_EQ(1, client->num_draws());
986 EXPECT_TRUE(client->HasAction("ScheduledActionDrawIfPossible")); 996 EXPECT_TRUE(client->HasAction("ScheduledActionDrawIfPossible"));
987 EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles")); 997 EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles"));
988 EXPECT_LT(client->ActionIndex("ScheduledActionDrawIfPossible"), 998 EXPECT_LT(client->ActionIndex("ScheduledActionDrawIfPossible"),
989 client->ActionIndex("ScheduledActionPrepareTiles")); 999 client->ActionIndex("ScheduledActionPrepareTiles"));
990 EXPECT_FALSE(scheduler_->RedrawPending()); 1000 EXPECT_FALSE(scheduler_->RedrawPending());
991 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1001 EXPECT_FALSE(scheduler_->PrepareTilesPending());
992 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1002 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
993 1003
994 // Request a draw. We don't need a PrepareTiles yet. 1004 // Request a draw. We don't need a PrepareTiles yet.
995 client->Reset(); 1005 client->Reset();
996 scheduler_->SetNeedsRedraw(); 1006 scheduler_->SetNeedsRedraw();
997 EXPECT_TRUE(scheduler_->RedrawPending()); 1007 EXPECT_TRUE(scheduler_->RedrawPending());
998 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1008 EXPECT_FALSE(scheduler_->PrepareTilesPending());
999 EXPECT_TRUE(client->needs_begin_frames()); 1009 EXPECT_TRUE(client->needs_begin_frames());
1000 EXPECT_EQ(0, client->num_draws()); 1010 EXPECT_EQ(0, client->num_draws());
1001 1011
1002 // We have no immediate actions to perform, so the BeginImplFrame should post 1012 // We have no immediate actions to perform, so the BeginImplFrame should post
1003 // the deadline task. 1013 // the deadline task.
1004 client->Reset(); 1014 client->Reset();
1005 EXPECT_SCOPED(AdvanceFrame()); 1015 EXPECT_SCOPED(AdvanceFrame());
1006 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); 1016 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1017 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
1007 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1018 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1008 1019
1009 // Draw. The draw will trigger SetNeedsPrepareTiles, and 1020 // Draw. The draw will trigger SetNeedsPrepareTiles, and
1010 // then the PrepareTiles action will be triggered after the Draw. 1021 // then the PrepareTiles action will be triggered after the Draw.
1011 // Afterwards, neither a draw nor PrepareTiles are pending. 1022 // Afterwards, neither a draw nor PrepareTiles are pending.
1012 client->Reset(); 1023 client->Reset();
1013 task_runner().RunPendingTasks(); // Run posted deadline. 1024 task_runner().RunPendingTasks(); // Run posted deadline.
1014 EXPECT_EQ(1, client->num_draws()); 1025 EXPECT_EQ(1, client->num_draws());
1015 EXPECT_TRUE(client->HasAction("ScheduledActionDrawIfPossible")); 1026 EXPECT_TRUE(client->HasAction("ScheduledActionDrawIfPossible"));
1016 EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles")); 1027 EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles"));
1017 EXPECT_LT(client->ActionIndex("ScheduledActionDrawIfPossible"), 1028 EXPECT_LT(client->ActionIndex("ScheduledActionDrawIfPossible"),
1018 client->ActionIndex("ScheduledActionPrepareTiles")); 1029 client->ActionIndex("ScheduledActionPrepareTiles"));
1019 EXPECT_FALSE(scheduler_->RedrawPending()); 1030 EXPECT_FALSE(scheduler_->RedrawPending());
1020 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1031 EXPECT_FALSE(scheduler_->PrepareTilesPending());
1021 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1032 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1022 1033
1023 // We need a BeginImplFrame where we don't swap to go idle. 1034 // We need a BeginImplFrame where we don't swap to go idle.
1024 client->Reset(); 1035 client->Reset();
1025 EXPECT_SCOPED(AdvanceFrame()); 1036 EXPECT_SCOPED(AdvanceFrame());
1026 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); 1037 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1038 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
1027 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1039 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1028 client->Reset(); 1040 client->Reset();
1029 task_runner().RunPendingTasks(); // Run posted deadline. 1041 task_runner().RunPendingTasks(); // Run posted deadline.
1030 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2); 1042 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
1031 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); 1043 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
1032 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1044 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1033 EXPECT_EQ(0, client->num_draws()); 1045 EXPECT_EQ(0, client->num_draws());
1034 1046
1035 // Now trigger a PrepareTiles outside of a draw. We will then need 1047 // Now trigger a PrepareTiles outside of a draw. We will then need
1036 // a begin-frame for the PrepareTiles, but we don't need a draw. 1048 // a begin-frame for the PrepareTiles, but we don't need a draw.
1037 client->Reset(); 1049 client->Reset();
1038 EXPECT_FALSE(client->needs_begin_frames()); 1050 EXPECT_FALSE(client->needs_begin_frames());
1039 scheduler_->SetNeedsPrepareTiles(); 1051 scheduler_->SetNeedsPrepareTiles();
1040 EXPECT_TRUE(client->needs_begin_frames()); 1052 EXPECT_TRUE(client->needs_begin_frames());
1041 EXPECT_TRUE(scheduler_->PrepareTilesPending()); 1053 EXPECT_TRUE(scheduler_->PrepareTilesPending());
1042 EXPECT_FALSE(scheduler_->RedrawPending()); 1054 EXPECT_FALSE(scheduler_->RedrawPending());
1043 1055
1044 // BeginImplFrame. There will be no draw, only PrepareTiles. 1056 // BeginImplFrame. There will be no draw, only PrepareTiles.
1045 client->Reset(); 1057 client->Reset();
1046 EXPECT_SCOPED(AdvanceFrame()); 1058 EXPECT_SCOPED(AdvanceFrame());
1047 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client); 1059 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
1060 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client, 1, 2);
1048 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1061 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1049 client->Reset(); 1062 client->Reset();
1050 task_runner().RunPendingTasks(); // Run posted deadline. 1063 task_runner().RunPendingTasks(); // Run posted deadline.
1051 EXPECT_EQ(0, client->num_draws()); 1064 EXPECT_EQ(0, client->num_draws());
1052 EXPECT_FALSE(client->HasAction("ScheduledActionDrawIfPossible")); 1065 EXPECT_FALSE(client->HasAction("ScheduledActionDrawIfPossible"));
1053 EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles")); 1066 EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles"));
1054 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1067 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1055 } 1068 }
1056 1069
1057 // Test that PrepareTiles only happens once per frame. If an external caller 1070 // Test that PrepareTiles only happens once per frame. If an external caller
1058 // initiates it, then the state machine should not PrepareTiles on that frame. 1071 // initiates it, then the state machine should not PrepareTiles on that frame.
1059 TEST_F(SchedulerTest, PrepareTilesOncePerFrame) { 1072 TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
1060 SetUpScheduler(EXTERNAL_BFS); 1073 SetUpScheduler(EXTERNAL_BFS);
1061 1074
1062 // If DidPrepareTiles during a frame, then PrepareTiles should not occur 1075 // If DidPrepareTiles during a frame, then PrepareTiles should not occur
1063 // again. 1076 // again.
1064 scheduler_->SetNeedsPrepareTiles(); 1077 scheduler_->SetNeedsPrepareTiles();
1065 scheduler_->SetNeedsRedraw(); 1078 scheduler_->SetNeedsRedraw();
1066 client_->Reset(); 1079 client_->Reset();
1067 EXPECT_SCOPED(AdvanceFrame()); 1080 EXPECT_SCOPED(AdvanceFrame());
1068 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 1081 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1082 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1069 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1083 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1070 1084
1071 EXPECT_TRUE(scheduler_->PrepareTilesPending()); 1085 EXPECT_TRUE(scheduler_->PrepareTilesPending());
1072 scheduler_->WillPrepareTiles(); 1086 scheduler_->WillPrepareTiles();
1073 scheduler_->DidPrepareTiles(); // An explicit PrepareTiles. 1087 scheduler_->DidPrepareTiles(); // An explicit PrepareTiles.
1074 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1088 EXPECT_FALSE(scheduler_->PrepareTilesPending());
1075 1089
1076 client_->Reset(); 1090 client_->Reset();
1077 task_runner().RunPendingTasks(); // Run posted deadline. 1091 task_runner().RunPendingTasks(); // Run posted deadline.
1078 EXPECT_EQ(1, client_->num_draws()); 1092 EXPECT_EQ(1, client_->num_draws());
1079 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible")); 1093 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible"));
1080 EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles")); 1094 EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles"));
1081 EXPECT_FALSE(scheduler_->RedrawPending()); 1095 EXPECT_FALSE(scheduler_->RedrawPending());
1082 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1096 EXPECT_FALSE(scheduler_->PrepareTilesPending());
1083 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1097 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1084 1098
1085 // Next frame without DidPrepareTiles should PrepareTiles with draw. 1099 // Next frame without DidPrepareTiles should PrepareTiles with draw.
1086 scheduler_->SetNeedsPrepareTiles(); 1100 scheduler_->SetNeedsPrepareTiles();
1087 scheduler_->SetNeedsRedraw(); 1101 scheduler_->SetNeedsRedraw();
1088 client_->Reset(); 1102 client_->Reset();
1089 EXPECT_SCOPED(AdvanceFrame()); 1103 EXPECT_SCOPED(AdvanceFrame());
1090 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 1104 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1105 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1091 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1106 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1092 1107
1093 client_->Reset(); 1108 client_->Reset();
1094 task_runner().RunPendingTasks(); // Run posted deadline. 1109 task_runner().RunPendingTasks(); // Run posted deadline.
1095 EXPECT_EQ(1, client_->num_draws()); 1110 EXPECT_EQ(1, client_->num_draws());
1096 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible")); 1111 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible"));
1097 EXPECT_TRUE(client_->HasAction("ScheduledActionPrepareTiles")); 1112 EXPECT_TRUE(client_->HasAction("ScheduledActionPrepareTiles"));
1098 EXPECT_LT(client_->ActionIndex("ScheduledActionDrawIfPossible"), 1113 EXPECT_LT(client_->ActionIndex("ScheduledActionDrawIfPossible"),
1099 client_->ActionIndex("ScheduledActionPrepareTiles")); 1114 client_->ActionIndex("ScheduledActionPrepareTiles"));
1100 EXPECT_FALSE(scheduler_->RedrawPending()); 1115 EXPECT_FALSE(scheduler_->RedrawPending());
1101 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1116 EXPECT_FALSE(scheduler_->PrepareTilesPending());
1102 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1117 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1103 1118
1104 // If we get another DidPrepareTiles within the same frame, we should 1119 // If we get another DidPrepareTiles within the same frame, we should
1105 // not PrepareTiles on the next frame. 1120 // not PrepareTiles on the next frame.
1106 scheduler_->WillPrepareTiles(); 1121 scheduler_->WillPrepareTiles();
1107 scheduler_->DidPrepareTiles(); // An explicit PrepareTiles. 1122 scheduler_->DidPrepareTiles(); // An explicit PrepareTiles.
1108 scheduler_->SetNeedsPrepareTiles(); 1123 scheduler_->SetNeedsPrepareTiles();
1109 scheduler_->SetNeedsRedraw(); 1124 scheduler_->SetNeedsRedraw();
1110 client_->Reset(); 1125 client_->Reset();
1111 EXPECT_SCOPED(AdvanceFrame()); 1126 EXPECT_SCOPED(AdvanceFrame());
1112 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 1127 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1128 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1113 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1129 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1114 1130
1115 EXPECT_TRUE(scheduler_->PrepareTilesPending()); 1131 EXPECT_TRUE(scheduler_->PrepareTilesPending());
1116 1132
1117 client_->Reset(); 1133 client_->Reset();
1118 task_runner().RunPendingTasks(); // Run posted deadline. 1134 task_runner().RunPendingTasks(); // Run posted deadline.
1119 EXPECT_EQ(1, client_->num_draws()); 1135 EXPECT_EQ(1, client_->num_draws());
1120 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible")); 1136 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible"));
1121 EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles")); 1137 EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles"));
1122 EXPECT_FALSE(scheduler_->RedrawPending()); 1138 EXPECT_FALSE(scheduler_->RedrawPending());
1123 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1139 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1124 1140
1125 // If we get another DidPrepareTiles, we should not PrepareTiles on the next 1141 // If we get another DidPrepareTiles, we should not PrepareTiles on the next
1126 // frame. This verifies we don't alternate calling PrepareTiles once and 1142 // frame. This verifies we don't alternate calling PrepareTiles once and
1127 // twice. 1143 // twice.
1128 EXPECT_TRUE(scheduler_->PrepareTilesPending()); 1144 EXPECT_TRUE(scheduler_->PrepareTilesPending());
1129 scheduler_->WillPrepareTiles(); 1145 scheduler_->WillPrepareTiles();
1130 scheduler_->DidPrepareTiles(); // An explicit PrepareTiles. 1146 scheduler_->DidPrepareTiles(); // An explicit PrepareTiles.
1131 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1147 EXPECT_FALSE(scheduler_->PrepareTilesPending());
1132 scheduler_->SetNeedsPrepareTiles(); 1148 scheduler_->SetNeedsPrepareTiles();
1133 scheduler_->SetNeedsRedraw(); 1149 scheduler_->SetNeedsRedraw();
1134 client_->Reset(); 1150 client_->Reset();
1135 EXPECT_SCOPED(AdvanceFrame()); 1151 EXPECT_SCOPED(AdvanceFrame());
1136 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 1152 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1153 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1137 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1154 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1138 1155
1139 EXPECT_TRUE(scheduler_->PrepareTilesPending()); 1156 EXPECT_TRUE(scheduler_->PrepareTilesPending());
1140 1157
1141 client_->Reset(); 1158 client_->Reset();
1142 task_runner().RunPendingTasks(); // Run posted deadline. 1159 task_runner().RunPendingTasks(); // Run posted deadline.
1143 EXPECT_EQ(1, client_->num_draws()); 1160 EXPECT_EQ(1, client_->num_draws());
1144 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible")); 1161 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible"));
1145 EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles")); 1162 EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles"));
1146 EXPECT_FALSE(scheduler_->RedrawPending()); 1163 EXPECT_FALSE(scheduler_->RedrawPending());
1147 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1164 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1148 1165
1149 // Next frame without DidPrepareTiles should PrepareTiles with draw. 1166 // Next frame without DidPrepareTiles should PrepareTiles with draw.
1150 scheduler_->SetNeedsPrepareTiles(); 1167 scheduler_->SetNeedsPrepareTiles();
1151 scheduler_->SetNeedsRedraw(); 1168 scheduler_->SetNeedsRedraw();
1152 client_->Reset(); 1169 client_->Reset();
1153 EXPECT_SCOPED(AdvanceFrame()); 1170 EXPECT_SCOPED(AdvanceFrame());
1154 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 1171 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1172 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1155 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1173 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1156 1174
1157 client_->Reset(); 1175 client_->Reset();
1158 task_runner().RunPendingTasks(); // Run posted deadline. 1176 task_runner().RunPendingTasks(); // Run posted deadline.
1159 EXPECT_EQ(1, client_->num_draws()); 1177 EXPECT_EQ(1, client_->num_draws());
1160 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible")); 1178 EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible"));
1161 EXPECT_TRUE(client_->HasAction("ScheduledActionPrepareTiles")); 1179 EXPECT_TRUE(client_->HasAction("ScheduledActionPrepareTiles"));
1162 EXPECT_LT(client_->ActionIndex("ScheduledActionDrawIfPossible"), 1180 EXPECT_LT(client_->ActionIndex("ScheduledActionDrawIfPossible"),
1163 client_->ActionIndex("ScheduledActionPrepareTiles")); 1181 client_->ActionIndex("ScheduledActionPrepareTiles"));
1164 EXPECT_FALSE(scheduler_->RedrawPending()); 1182 EXPECT_FALSE(scheduler_->RedrawPending());
1165 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 1183 EXPECT_FALSE(scheduler_->PrepareTilesPending());
1166 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1184 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1167 } 1185 }
1168 1186
1169 TEST_F(SchedulerTest, DidPrepareTilesPreventsPrepareTilesForOneFrame) { 1187 TEST_F(SchedulerTest, DidPrepareTilesPreventsPrepareTilesForOneFrame) {
1170 std::unique_ptr<SchedulerClientNeedsPrepareTilesInDraw> client = 1188 std::unique_ptr<SchedulerClientNeedsPrepareTilesInDraw> client =
1171 base::WrapUnique(new SchedulerClientNeedsPrepareTilesInDraw); 1189 base::WrapUnique(new SchedulerClientNeedsPrepareTilesInDraw);
1172 SetUpScheduler(EXTERNAL_BFS, std::move(client)); 1190 SetUpScheduler(EXTERNAL_BFS, std::move(client));
1173 1191
1174 client_->Reset(); 1192 client_->Reset();
1175 scheduler_->SetNeedsRedraw(); 1193 scheduler_->SetNeedsRedraw();
1176 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 1194 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
1177 1195
1178 client_->Reset(); 1196 client_->Reset();
1179 EXPECT_SCOPED(AdvanceFrame()); 1197 EXPECT_SCOPED(AdvanceFrame());
1180 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 1198 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1199 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1181 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1200 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1182 1201
1183 client_->Reset(); 1202 client_->Reset();
1184 task_runner().RunPendingTasks(); // Run posted deadline. 1203 task_runner().RunPendingTasks(); // Run posted deadline.
1185 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1204 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1186 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); 1205 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2);
1187 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2); 1206 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2);
1188 1207
1189 // We don't want to hinder scheduled prepare tiles for more than one frame 1208 // We don't want to hinder scheduled prepare tiles for more than one frame
1190 // even if we call unscheduled prepare tiles many times. 1209 // even if we call unscheduled prepare tiles many times.
1191 for (int i = 0; i < 10; i++) { 1210 for (int i = 0; i < 10; i++) {
1192 scheduler_->WillPrepareTiles(); 1211 scheduler_->WillPrepareTiles();
1193 scheduler_->DidPrepareTiles(); 1212 scheduler_->DidPrepareTiles();
1194 } 1213 }
1195 1214
1196 client_->Reset(); 1215 client_->Reset();
1197 scheduler_->SetNeedsRedraw(); 1216 scheduler_->SetNeedsRedraw();
1198 EXPECT_SCOPED(AdvanceFrame()); 1217 EXPECT_SCOPED(AdvanceFrame());
1199 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 1218 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1219 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1200 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1220 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1201 1221
1202 // No scheduled prepare tiles because we've already counted a prepare tiles in 1222 // No scheduled prepare tiles because we've already counted a prepare tiles in
1203 // between frames. 1223 // between frames.
1204 client_->Reset(); 1224 client_->Reset();
1205 task_runner().RunPendingTasks(); // Run posted deadline. 1225 task_runner().RunPendingTasks(); // Run posted deadline.
1206 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1226 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1207 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 1227 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
1208 1228
1209 client_->Reset(); 1229 client_->Reset();
1210 scheduler_->SetNeedsRedraw(); 1230 scheduler_->SetNeedsRedraw();
1211 EXPECT_SCOPED(AdvanceFrame()); 1231 EXPECT_SCOPED(AdvanceFrame());
1212 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 1232 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1233 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
1213 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1234 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1214 1235
1215 // Resume scheduled prepare tiles. 1236 // Resume scheduled prepare tiles.
1216 client_->Reset(); 1237 client_->Reset();
1217 task_runner().RunPendingTasks(); // Run posted deadline. 1238 task_runner().RunPendingTasks(); // Run posted deadline.
1218 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1239 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1219 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); 1240 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2);
1220 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2); 1241 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2);
1221 } 1242 }
1222 1243
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 // still expect to recover impl thread latency if there are no commits from 1711 // still expect to recover impl thread latency if there are no commits from
1691 // the main thread. 1712 // the main thread.
1692 fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); 1713 fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration);
1693 fake_compositor_timing_history_->SetDrawDurationEstimate(kFastDuration); 1714 fake_compositor_timing_history_->SetDrawDurationEstimate(kFastDuration);
1694 1715
1695 // Draw and swap for first BeginFrame 1716 // Draw and swap for first BeginFrame
1696 client_->Reset(); 1717 client_->Reset();
1697 scheduler_->SetNeedsRedraw(); 1718 scheduler_->SetNeedsRedraw();
1698 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); 1719 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1699 SendNextBeginFrame(); 1720 SendNextBeginFrame();
1700 EXPECT_ACTION("AddObserver(this)", client_, 0, 2); 1721 EXPECT_ACTION("AddObserver(this)", client_, 0, 3);
1701 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2); 1722 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
1723 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
1702 1724
1703 client_->Reset(); 1725 client_->Reset();
1704 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); 1726 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1705 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); 1727 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
1706 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 1728 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
1707 1729
1708 // Verify we skip every other frame if the swap ack consistently 1730 // Verify we skip every other frame if the swap ack consistently
1709 // comes back late. 1731 // comes back late.
1710 for (int i = 0; i < 10; i++) { 1732 for (int i = 0; i < 10; i++) {
1711 // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next 1733 // Not calling scheduler_->DidReceiveCompositorFrameAck() until after next
(...skipping 11 matching lines...) Expand all
1723 // swap throttled. 1745 // swap throttled.
1724 client_->Reset(); 1746 client_->Reset();
1725 scheduler_->DidReceiveCompositorFrameAck(); 1747 scheduler_->DidReceiveCompositorFrameAck();
1726 EXPECT_NO_ACTION(client_); 1748 EXPECT_NO_ACTION(client_);
1727 1749
1728 // Verify that we start the next BeginImplFrame and continue normally 1750 // Verify that we start the next BeginImplFrame and continue normally
1729 // after having just skipped a BeginImplFrame. 1751 // after having just skipped a BeginImplFrame.
1730 client_->Reset(); 1752 client_->Reset();
1731 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); 1753 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
1732 SendNextBeginFrame(); 1754 SendNextBeginFrame();
1733 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 1755 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
1756 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1,
1757 2);
1734 1758
1735 client_->Reset(); 1759 client_->Reset();
1736 // Deadline should be immediate. 1760 // Deadline should be immediate.
1737 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 1761 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
1738 task_runner().RunUntilTime(now_src_->NowTicks()); 1762 task_runner().RunUntilTime(now_src_->NowTicks());
1739 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 1763 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
1740 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 1764 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
1741 } 1765 }
1742 } 1766 }
1743 1767
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 // Can't run the deadline task because it can race with begin frame for the 2125 // Can't run the deadline task because it can race with begin frame for the
2102 // SyntheticBFS case. 2126 // SyntheticBFS case.
2103 EXPECT_SCOPED(AdvanceFrame()); 2127 EXPECT_SCOPED(AdvanceFrame());
2104 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2128 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
2105 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2129 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2106 client_->Reset(); 2130 client_->Reset();
2107 2131
2108 // NotifyReadyToCommit should trigger the commit. 2132 // NotifyReadyToCommit should trigger the commit.
2109 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); 2133 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
2110 scheduler_->NotifyReadyToCommit(); 2134 scheduler_->NotifyReadyToCommit();
2111 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); 2135 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 1);
2112 client_->Reset(); 2136 client_->Reset();
2113 2137
2114 // NotifyReadyToActivate should trigger the activation. 2138 // NotifyReadyToActivate should trigger the activation.
2115 scheduler_->NotifyReadyToActivate(); 2139 scheduler_->NotifyReadyToActivate();
2116 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); 2140 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
2117 client_->Reset(); 2141 client_->Reset();
2118 2142
2119 // BeginImplFrame deadline should draw. The following BeginImplFrame deadline 2143 // BeginImplFrame deadline should draw. The following BeginImplFrame deadline
2120 // should SetNeedsBeginFrame(false) to avoid excessive toggles. 2144 // should SetNeedsBeginFrame(false) to avoid excessive toggles.
2121 EXPECT_SCOPED(AdvanceFrame()); 2145 EXPECT_SCOPED(AdvanceFrame());
2122 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); 2146 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 3);
2123 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2); 2147 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
2148 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
2124 client_->Reset(); 2149 client_->Reset();
2125 2150
2126 // Make sure SetNeedsBeginFrame isn't called on the client 2151 // Make sure SetNeedsBeginFrame isn't called on the client
2127 // when the BeginFrame is no longer needed. 2152 // when the BeginFrame is no longer needed.
2128 task_runner().RunPendingTasks(); // Run posted deadline. 2153 task_runner().RunPendingTasks(); // Run posted deadline.
2129 EXPECT_SINGLE_ACTION("SendBeginMainFrameNotExpectedSoon", client_); 2154 EXPECT_SINGLE_ACTION("SendBeginMainFrameNotExpectedSoon", client_);
2130 client_->Reset(); 2155 client_->Reset();
2131 } 2156 }
2132 2157
2133 TEST_F(SchedulerTest, SyntheticBeginFrames) { 2158 TEST_F(SchedulerTest, SyntheticBeginFrames) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 2389
2365 TEST_F(SchedulerTest, DidLoseCompositorFrameSinkAfterSetNeedsPrepareTiles) { 2390 TEST_F(SchedulerTest, DidLoseCompositorFrameSinkAfterSetNeedsPrepareTiles) {
2366 SetUpScheduler(EXTERNAL_BFS); 2391 SetUpScheduler(EXTERNAL_BFS);
2367 2392
2368 scheduler_->SetNeedsPrepareTiles(); 2393 scheduler_->SetNeedsPrepareTiles();
2369 scheduler_->SetNeedsRedraw(); 2394 scheduler_->SetNeedsRedraw();
2370 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 2395 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
2371 2396
2372 client_->Reset(); 2397 client_->Reset();
2373 EXPECT_SCOPED(AdvanceFrame()); 2398 EXPECT_SCOPED(AdvanceFrame());
2374 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2399 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2400 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2375 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2401 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2376 2402
2377 client_->Reset(); 2403 client_->Reset();
2378 scheduler_->DidLoseCompositorFrameSink(); 2404 scheduler_->DidLoseCompositorFrameSink();
2379 // RemoveObserver(this) is not called until the end of the frame. 2405 // RemoveObserver(this) is not called until the end of the frame.
2380 EXPECT_NO_ACTION(client_); 2406 EXPECT_NO_ACTION(client_);
2381 2407
2382 client_->Reset(); 2408 client_->Reset();
2383 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); 2409 task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
2384 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 0, 4); 2410 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 0, 4);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 // Tests to ensure frame sources can be successfully changed while drawing. 2551 // Tests to ensure frame sources can be successfully changed while drawing.
2526 TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) { 2552 TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
2527 SetUpScheduler(EXTERNAL_BFS); 2553 SetUpScheduler(EXTERNAL_BFS);
2528 2554
2529 // SetNeedsRedraw should begin the frame on the next BeginImplFrame. 2555 // SetNeedsRedraw should begin the frame on the next BeginImplFrame.
2530 scheduler_->SetNeedsRedraw(); 2556 scheduler_->SetNeedsRedraw();
2531 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 2557 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
2532 client_->Reset(); 2558 client_->Reset();
2533 2559
2534 EXPECT_SCOPED(AdvanceFrame()); 2560 EXPECT_SCOPED(AdvanceFrame());
2535 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2561 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2562 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2536 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2563 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2537 EXPECT_TRUE(scheduler_->begin_frames_expected()); 2564 EXPECT_TRUE(scheduler_->begin_frames_expected());
2538 client_->Reset(); 2565 client_->Reset();
2539 task_runner().RunPendingTasks(); // Run posted deadline. 2566 task_runner().RunPendingTasks(); // Run posted deadline.
2540 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 2567 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
2541 scheduler_->SetNeedsRedraw(); 2568 scheduler_->SetNeedsRedraw();
2542 2569
2543 // Switch to an unthrottled frame source. 2570 // Switch to an unthrottled frame source.
2544 scheduler_->SetBeginFrameSource(unthrottled_frame_source_.get()); 2571 scheduler_->SetBeginFrameSource(unthrottled_frame_source_.get());
2545 client_->Reset(); 2572 client_->Reset();
2546 2573
2547 // Unthrottled frame source will immediately begin a new frame. 2574 // Unthrottled frame source will immediately begin a new frame.
2548 task_runner().RunPendingTasks(); // Run posted BeginFrame. 2575 task_runner().RunPendingTasks(); // Run posted BeginFrame.
2549 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2576 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2577 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2550 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2578 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2551 client_->Reset(); 2579 client_->Reset();
2552 2580
2553 // If we don't swap on the deadline, we wait for the next BeginFrame. 2581 // If we don't swap on the deadline, we wait for the next BeginFrame.
2554 task_runner().RunPendingTasks(); // Run posted deadline. 2582 task_runner().RunPendingTasks(); // Run posted deadline.
2555 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 2583 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
2556 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2584 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2557 client_->Reset(); 2585 client_->Reset();
2558 } 2586 }
2559 2587
2560 // Tests to ensure frame sources can be successfully changed while a frame 2588 // Tests to ensure frame sources can be successfully changed while a frame
2561 // deadline is pending. 2589 // deadline is pending.
2562 TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) { 2590 TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
2563 SetUpScheduler(EXTERNAL_BFS); 2591 SetUpScheduler(EXTERNAL_BFS);
2564 2592
2565 // SetNeedsRedraw should begin the frame on the next BeginImplFrame. 2593 // SetNeedsRedraw should begin the frame on the next BeginImplFrame.
2566 scheduler_->SetNeedsRedraw(); 2594 scheduler_->SetNeedsRedraw();
2567 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 2595 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
2568 client_->Reset(); 2596 client_->Reset();
2569 2597
2570 EXPECT_SCOPED(AdvanceFrame()); 2598 EXPECT_SCOPED(AdvanceFrame());
2571 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 2599 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2600 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2572 2601
2573 // Switch to an unthrottled frame source before the frame deadline is hit. 2602 // Switch to an unthrottled frame source before the frame deadline is hit.
2574 scheduler_->SetBeginFrameSource(unthrottled_frame_source_.get()); 2603 scheduler_->SetBeginFrameSource(unthrottled_frame_source_.get());
2575 client_->Reset(); 2604 client_->Reset();
2576 2605
2577 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2606 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2578 EXPECT_TRUE(scheduler_->begin_frames_expected()); 2607 EXPECT_TRUE(scheduler_->begin_frames_expected());
2579 client_->Reset(); 2608 client_->Reset();
2580 2609
2581 task_runner().RunPendingTasks(); // Run posted deadline. 2610 task_runner().RunPendingTasks(); // Run posted deadline.
2582 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); 2611 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 3);
2583 // Unthrottled frame source will immediately begin a new frame. 2612 // Unthrottled frame source will immediately begin a new frame.
2584 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2); 2613 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
2614 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
2585 scheduler_->SetNeedsRedraw(); 2615 scheduler_->SetNeedsRedraw();
2586 client_->Reset(); 2616 client_->Reset();
2587 2617
2588 task_runner().RunPendingTasks(); // Run posted deadline. 2618 task_runner().RunPendingTasks(); // Run posted deadline.
2589 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 2619 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
2590 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2620 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2591 client_->Reset(); 2621 client_->Reset();
2592 } 2622 }
2593 2623
2594 // Tests to ensure that the active frame source can successfully be changed from 2624 // Tests to ensure that the active frame source can successfully be changed from
2595 // unthrottled to throttled. 2625 // unthrottled to throttled.
2596 TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) { 2626 TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
2597 SetUpScheduler(UNTHROTTLED_BFS); 2627 SetUpScheduler(UNTHROTTLED_BFS);
2598 2628
2599 scheduler_->SetNeedsRedraw(); 2629 scheduler_->SetNeedsRedraw();
2600 EXPECT_NO_ACTION(client_); 2630 EXPECT_NO_ACTION(client_);
2601 client_->Reset(); 2631 client_->Reset();
2602 2632
2603 task_runner().RunPendingTasks(); // Run posted BeginFrame. 2633 task_runner().RunPendingTasks(); // Run posted BeginFrame.
2604 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2634 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2635 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2605 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2636 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2606 client_->Reset(); 2637 client_->Reset();
2607 2638
2608 task_runner().RunPendingTasks(); // Run posted deadline. 2639 task_runner().RunPendingTasks(); // Run posted deadline.
2609 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 2640 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
2610 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2641 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2611 client_->Reset(); 2642 client_->Reset();
2612 2643
2613 // Switch to a throttled frame source. 2644 // Switch to a throttled frame source.
2614 scheduler_->SetBeginFrameSource(fake_external_begin_frame_source_.get()); 2645 scheduler_->SetBeginFrameSource(fake_external_begin_frame_source_.get());
2615 client_->Reset(); 2646 client_->Reset();
2616 2647
2617 // SetNeedsRedraw should begin the frame on the next BeginImplFrame. 2648 // SetNeedsRedraw should begin the frame on the next BeginImplFrame.
2618 scheduler_->SetNeedsRedraw(); 2649 scheduler_->SetNeedsRedraw();
2619 task_runner().RunPendingTasks(); 2650 task_runner().RunPendingTasks();
2620 EXPECT_NO_ACTION(client_); 2651 EXPECT_NO_ACTION(client_);
2621 client_->Reset(); 2652 client_->Reset();
2622 2653
2623 EXPECT_SCOPED(AdvanceFrame()); 2654 EXPECT_SCOPED(AdvanceFrame());
2624 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2655 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2656 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2625 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2657 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2626 EXPECT_TRUE(scheduler_->begin_frames_expected()); 2658 EXPECT_TRUE(scheduler_->begin_frames_expected());
2627 client_->Reset(); 2659 client_->Reset();
2628 task_runner().RunPendingTasks(); // Run posted deadline. 2660 task_runner().RunPendingTasks(); // Run posted deadline.
2629 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 2661 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
2630 } 2662 }
2631 2663
2632 TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) { 2664 TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) {
2633 SetUpScheduler(EXTERNAL_BFS); 2665 SetUpScheduler(EXTERNAL_BFS);
2634 2666
2635 scheduler_->SetNeedsRedraw(); 2667 scheduler_->SetNeedsRedraw();
2636 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 2668 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
2637 client_->Reset(); 2669 client_->Reset();
2638 2670
2639 EXPECT_SCOPED(AdvanceFrame()); 2671 EXPECT_SCOPED(AdvanceFrame());
2640 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 2672 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2673 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2641 client_->Reset(); 2674 client_->Reset();
2642 2675
2643 // Switch to a null frame source. 2676 // Switch to a null frame source.
2644 scheduler_->SetBeginFrameSource(nullptr); 2677 scheduler_->SetBeginFrameSource(nullptr);
2645 EXPECT_SINGLE_ACTION("RemoveObserver(this)", client_); 2678 EXPECT_SINGLE_ACTION("RemoveObserver(this)", client_);
2646 client_->Reset(); 2679 client_->Reset();
2647 2680
2648 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2681 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2649 task_runner().RunPendingTasks(); // Run posted deadline. 2682 task_runner().RunPendingTasks(); // Run posted deadline.
2650 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 2683 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 client_->Reset(); 2760 client_->Reset();
2728 scheduler_->SetNeedsBeginMainFrame(); 2761 scheduler_->SetNeedsBeginMainFrame();
2729 EXPECT_NO_ACTION(client_); 2762 EXPECT_NO_ACTION(client_);
2730 2763
2731 client_->Reset(); 2764 client_->Reset();
2732 EXPECT_SCOPED(AdvanceFrame()); 2765 EXPECT_SCOPED(AdvanceFrame());
2733 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 2766 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2734 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); 2767 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
2735 } 2768 }
2736 2769
2770 // Tests to ensure that we send a ScheduledActionBeginMainFrameNotExpectedUntil
2771 // when expected.
2772 TEST_F(SchedulerTest, ScheduledActionBeginMainFrameNotExpectedUntil) {
2773 SetUpScheduler(EXTERNAL_BFS);
2774
2775 scheduler_->SetNeedsRedraw();
2776 EXPECT_ACTION("AddObserver(this)", client_, 0, 1);
2777 client_->Reset();
2778
2779 EXPECT_SCOPED(AdvanceFrame());
2780 task_runner().RunPendingTasks();
2781 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
2782 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 3);
2783 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3);
2784 client_->Reset();
2785 }
2786
2737 // Tests to ensure that we send a BeginMainFrameNotExpectedSoon when expected. 2787 // Tests to ensure that we send a BeginMainFrameNotExpectedSoon when expected.
2738 TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) { 2788 TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
2739 SetUpScheduler(EXTERNAL_BFS); 2789 SetUpScheduler(EXTERNAL_BFS);
2740 2790
2741 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. 2791 // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
2742 scheduler_->SetNeedsBeginMainFrame(); 2792 scheduler_->SetNeedsBeginMainFrame();
2743 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 2793 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
2744 client_->Reset(); 2794 client_->Reset();
2745 2795
2746 // Trigger a frame draw. 2796 // Trigger a frame draw.
2747 EXPECT_SCOPED(AdvanceFrame()); 2797 EXPECT_SCOPED(AdvanceFrame());
2748 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); 2798 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
2749 scheduler_->NotifyReadyToCommit(); 2799 scheduler_->NotifyReadyToCommit();
2750 scheduler_->NotifyReadyToActivate(); 2800 scheduler_->NotifyReadyToActivate();
2751 task_runner().RunPendingTasks(); 2801 task_runner().RunPendingTasks();
2752 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5); 2802 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 5);
2753 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5); 2803 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 5);
2754 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5); 2804 EXPECT_ACTION("ScheduledActionCommit", client_, 2, 5);
2755 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5); 2805 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 3, 5);
2756 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 4, 5); 2806 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 4, 5);
2757 client_->Reset(); 2807 client_->Reset();
2758 2808
2759 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false) 2809 // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
2760 // and send a SendBeginMainFrameNotExpectedSoon. 2810 // and send a SendBeginMainFrameNotExpectedSoon.
2761 EXPECT_SCOPED(AdvanceFrame()); 2811 EXPECT_SCOPED(AdvanceFrame());
2762 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 2812 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2813 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2763 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2814 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2764 client_->Reset(); 2815 client_->Reset();
2765 2816
2766 task_runner().RunPendingTasks(); // Run posted deadline. 2817 task_runner().RunPendingTasks(); // Run posted deadline.
2767 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2); 2818 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
2768 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); 2819 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
2769 client_->Reset(); 2820 client_->Reset();
2770 } 2821 }
2771 2822
2772 TEST_F(SchedulerTest, SynchronousCompositorAnimation) { 2823 TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
2773 scheduler_settings_.using_synchronous_renderer_compositor = true; 2824 scheduler_settings_.using_synchronous_renderer_compositor = true;
2774 SetUpScheduler(EXTERNAL_BFS); 2825 SetUpScheduler(EXTERNAL_BFS);
2775 2826
2776 scheduler_->SetNeedsOneBeginImplFrame(); 2827 scheduler_->SetNeedsOneBeginImplFrame();
2777 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 2828 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
2778 client_->Reset(); 2829 client_->Reset();
2779 2830
2780 // Testing the case where animation ticks a fling scroll. 2831 // Testing the case where animation ticks a fling scroll.
2781 client_->SetWillBeginImplFrameCausesRedraw(true); 2832 client_->SetWillBeginImplFrameCausesRedraw(true);
2782 // The animation isn't done so it'll cause another tick in the future. 2833 // The animation isn't done so it'll cause another tick in the future.
2783 client_->SetWillBeginImplFrameRequestsOneBeginImplFrame(true); 2834 client_->SetWillBeginImplFrameRequestsOneBeginImplFrame(true);
2784 2835
2785 // Next vsync. 2836 // Next vsync.
2786 AdvanceFrame(); 2837 AdvanceFrame();
2787 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 2838 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
2788 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); 2839 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 2, 3);
2840 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 3);
2789 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2841 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2790 client_->Reset(); 2842 client_->Reset();
2791 2843
2792 // Android onDraw. This doesn't consume the single begin frame request. 2844 // Android onDraw. This doesn't consume the single begin frame request.
2793 scheduler_->SetNeedsRedraw(); 2845 scheduler_->SetNeedsRedraw();
2794 bool resourceless_software_draw = false; 2846 bool resourceless_software_draw = false;
2795 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 2847 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
2796 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 2848 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
2797 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2849 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2798 client_->Reset(); 2850 client_->Reset();
2799 2851
2800 // The animation inside of WillBeginImplFrame changes stuff on the screen, but 2852 // The animation inside of WillBeginImplFrame changes stuff on the screen, but
2801 // ends here, so does not cause another frame to happen. 2853 // ends here, so does not cause another frame to happen.
2802 client_->SetWillBeginImplFrameCausesRedraw(true); 2854 client_->SetWillBeginImplFrameCausesRedraw(true);
2803 2855
2804 // Next vsync. 2856 // Next vsync.
2805 AdvanceFrame(); 2857 AdvanceFrame();
2806 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 2858 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
2807 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); 2859 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
2860 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
2808 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2861 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2809 client_->Reset(); 2862 client_->Reset();
2810 2863
2811 // Android onDraw. 2864 // Android onDraw.
2812 scheduler_->SetNeedsRedraw(); 2865 scheduler_->SetNeedsRedraw();
2813 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 2866 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
2814 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 2867 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
2815 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2868 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2816 client_->Reset(); 2869 client_->Reset();
2817 2870
2818 // Idle on next vsync, as the animation has completed. 2871 // Idle on next vsync, as the animation has completed.
2819 AdvanceFrame(); 2872 AdvanceFrame();
2820 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); 2873 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
2821 EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3); 2874 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
2822 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); 2875 EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
2876 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
2823 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2877 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2824 client_->Reset(); 2878 client_->Reset();
2825 } 2879 }
2826 2880
2827 TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) { 2881 TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) {
2828 scheduler_settings_.using_synchronous_renderer_compositor = true; 2882 scheduler_settings_.using_synchronous_renderer_compositor = true;
2829 SetUpScheduler(EXTERNAL_BFS); 2883 SetUpScheduler(EXTERNAL_BFS);
2830 2884
2831 scheduler_->SetNeedsRedraw(); 2885 scheduler_->SetNeedsRedraw();
2832 bool resourceless_software_draw = false; 2886 bool resourceless_software_draw = false;
2833 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 2887 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
2834 EXPECT_ACTION("AddObserver(this)", client_, 0, 2); 2888 EXPECT_ACTION("AddObserver(this)", client_, 0, 2);
2835 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 1, 2); 2889 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 1, 2);
2836 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2890 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2837 client_->Reset(); 2891 client_->Reset();
2838 2892
2839 // Idle on next vsync. 2893 // Idle on next vsync.
2840 AdvanceFrame(); 2894 AdvanceFrame();
2841 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); 2895 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
2842 EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3); 2896 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
2843 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); 2897 EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
2898 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
2844 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2899 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2845 client_->Reset(); 2900 client_->Reset();
2846 } 2901 }
2847 2902
2848 TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) { 2903 TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
2849 SetUpScheduler(EXTERNAL_BFS); 2904 SetUpScheduler(EXTERNAL_BFS);
2850 2905
2851 EXPECT_FALSE(scheduler_->begin_frames_expected()); 2906 EXPECT_FALSE(scheduler_->begin_frames_expected());
2852 2907
2853 // Request a frame, should kick the source. 2908 // Request a frame, should kick the source.
2854 scheduler_->SetNeedsOneBeginImplFrame(); 2909 scheduler_->SetNeedsOneBeginImplFrame();
2855 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 2910 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
2856 client_->Reset(); 2911 client_->Reset();
2857 2912
2858 // The incoming WillBeginImplFrame will request another one. 2913 // The incoming WillBeginImplFrame will request another one.
2859 client_->SetWillBeginImplFrameRequestsOneBeginImplFrame(true); 2914 client_->SetWillBeginImplFrameRequestsOneBeginImplFrame(true);
2860 2915
2861 // Next vsync, the first requested frame happens. 2916 // Next vsync, the first requested frame happens.
2862 EXPECT_SCOPED(AdvanceFrame()); 2917 EXPECT_SCOPED(AdvanceFrame());
2863 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2918 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2919 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2864 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2920 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2865 client_->Reset(); 2921 client_->Reset();
2866 2922
2867 // We don't request another frame here. 2923 // We don't request another frame here.
2868 2924
2869 // Next vsync, the second requested frame happens (the one requested inside 2925 // Next vsync, the second requested frame happens (the one requested inside
2870 // the previous frame's begin impl frame step). 2926 // the previous frame's begin impl frame step).
2871 EXPECT_SCOPED(AdvanceFrame()); 2927 EXPECT_SCOPED(AdvanceFrame());
2872 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 2928 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
2929 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
2873 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 2930 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
2874 client_->Reset(); 2931 client_->Reset();
2875 2932
2876 // End that frame's deadline. 2933 // End that frame's deadline.
2877 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); 2934 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
2878 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2935 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2879 2936
2880 // Scheduler shuts down the source now that no begin frame is requested. 2937 // Scheduler shuts down the source now that no begin frame is requested.
2881 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2); 2938 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
2882 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); 2939 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 2980 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2924 client_->Reset(); 2981 client_->Reset();
2925 2982
2926 has_damage = false; 2983 has_damage = false;
2927 EXPECT_EQ( 2984 EXPECT_EQ(
2928 BeginFrameAck(args.source_id, args.sequence_number, 2985 BeginFrameAck(args.source_id, args.sequence_number,
2929 latest_confirmed_sequence_number, has_damage), 2986 latest_confirmed_sequence_number, has_damage),
2930 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); 2987 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get()));
2931 2988
2932 scheduler_->NotifyReadyToCommit(); 2989 scheduler_->NotifyReadyToCommit();
2933 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); 2990 EXPECT_ACTION("ScheduledActionCommit", client_, 0, 1);
2934 client_->Reset(); 2991 client_->Reset();
2935 2992
2936 scheduler_->NotifyReadyToActivate(); 2993 scheduler_->NotifyReadyToActivate();
2937 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); 2994 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
2938 client_->Reset(); 2995 client_->Reset();
2939 2996
2940 // Next vsync. 2997 // Next vsync.
2941 args = SendNextBeginFrame(); 2998 args = SendNextBeginFrame();
2942 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 2999 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
2943 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); 3000 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
3001 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
2944 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3002 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2945 client_->Reset(); 3003 client_->Reset();
2946 3004
2947 // Not confirmed yet and no damage, since not drawn yet. 3005 // Not confirmed yet and no damage, since not drawn yet.
2948 // TODO(eseckler): In the future, |has_damage = false| will prevent us from 3006 // TODO(eseckler): In the future, |has_damage = false| will prevent us from
2949 // filtering this ack (in CompositorExternalBeginFrameSource) and instead 3007 // filtering this ack (in CompositorExternalBeginFrameSource) and instead
2950 // forwarding the one attached to the later submitted CompositorFrame. 3008 // forwarding the one attached to the later submitted CompositorFrame.
2951 has_damage = false; 3009 has_damage = false;
2952 EXPECT_EQ( 3010 EXPECT_EQ(
2953 BeginFrameAck(args.source_id, args.sequence_number, 3011 BeginFrameAck(args.source_id, args.sequence_number,
2954 latest_confirmed_sequence_number, has_damage), 3012 latest_confirmed_sequence_number, has_damage),
2955 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); 3013 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get()));
2956 3014
2957 // Android onDraw. 3015 // Android onDraw.
2958 scheduler_->SetNeedsRedraw(); 3016 scheduler_->SetNeedsRedraw();
2959 bool resourceless_software_draw = false; 3017 bool resourceless_software_draw = false;
2960 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 3018 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
2961 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 3019 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
2962 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3020 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2963 client_->Reset(); 3021 client_->Reset();
2964 3022
2965 // Idle on next vsync. 3023 // Idle on next vsync.
2966 args = SendNextBeginFrame(); 3024 args = SendNextBeginFrame();
2967 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); 3025 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
2968 EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3); 3026 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
2969 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); 3027 EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
3028 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
2970 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3029 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
2971 client_->Reset(); 3030 client_->Reset();
2972 3031
2973 latest_confirmed_sequence_number = args.sequence_number; 3032 latest_confirmed_sequence_number = args.sequence_number;
2974 has_damage = false; 3033 has_damage = false;
2975 EXPECT_EQ( 3034 EXPECT_EQ(
2976 BeginFrameAck(args.source_id, args.sequence_number, 3035 BeginFrameAck(args.source_id, args.sequence_number,
2977 latest_confirmed_sequence_number, has_damage), 3036 latest_confirmed_sequence_number, has_damage),
2978 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); 3037 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get()));
2979 } 3038 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 std::unique_ptr<FakeSchedulerClient> client = 3099 std::unique_ptr<FakeSchedulerClient> client =
3041 base::WrapUnique(new SchedulerClientSetNeedsPrepareTilesOnDraw); 3100 base::WrapUnique(new SchedulerClientSetNeedsPrepareTilesOnDraw);
3042 SetUpScheduler(EXTERNAL_BFS, std::move(client)); 3101 SetUpScheduler(EXTERNAL_BFS, std::move(client));
3043 3102
3044 scheduler_->SetNeedsRedraw(); 3103 scheduler_->SetNeedsRedraw();
3045 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 3104 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
3046 client_->Reset(); 3105 client_->Reset();
3047 3106
3048 // Next vsync. 3107 // Next vsync.
3049 EXPECT_SCOPED(AdvanceFrame()); 3108 EXPECT_SCOPED(AdvanceFrame());
3050 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 3109 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
3051 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); 3110 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
3111 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
3052 client_->Reset(); 3112 client_->Reset();
3053 3113
3054 // Android onDraw. 3114 // Android onDraw.
3055 scheduler_->SetNeedsRedraw(); 3115 scheduler_->SetNeedsRedraw();
3056 bool resourceless_software_draw = false; 3116 bool resourceless_software_draw = false;
3057 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 3117 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
3058 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); 3118 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2);
3059 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2); 3119 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2);
3060 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3120 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
3061 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 3121 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3062 client_->Reset(); 3122 client_->Reset();
3063 3123
3064 // Android onDraw. 3124 // Android onDraw.
3065 scheduler_->SetNeedsRedraw(); 3125 scheduler_->SetNeedsRedraw();
3066 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 3126 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
3067 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); 3127 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2);
3068 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2); 3128 EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2);
3069 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3129 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
3070 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 3130 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3071 client_->Reset(); 3131 client_->Reset();
3072 3132
3073 // Next vsync. 3133 // Next vsync.
3074 EXPECT_SCOPED(AdvanceFrame()); 3134 EXPECT_SCOPED(AdvanceFrame());
3075 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 3135 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3076 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); 3136 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
3077 EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3); 3137 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 4);
3078 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); 3138 EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
3139 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
3079 EXPECT_FALSE(scheduler_->begin_frames_expected()); 3140 EXPECT_FALSE(scheduler_->begin_frames_expected());
3080 client_->Reset(); 3141 client_->Reset();
3081 } 3142 }
3082 3143
3083 TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) { 3144 TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
3084 scheduler_settings_.using_synchronous_renderer_compositor = true; 3145 scheduler_settings_.using_synchronous_renderer_compositor = true;
3085 SetUpScheduler(EXTERNAL_BFS); 3146 SetUpScheduler(EXTERNAL_BFS);
3086 3147
3087 scheduler_->SetNeedsRedraw(); 3148 scheduler_->SetNeedsRedraw();
3088 EXPECT_SINGLE_ACTION("AddObserver(this)", client_); 3149 EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
3089 client_->Reset(); 3150 client_->Reset();
3090 3151
3091 // Next vsync. 3152 // Next vsync.
3092 EXPECT_SCOPED(AdvanceFrame()); 3153 EXPECT_SCOPED(AdvanceFrame());
3093 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 3154 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
3094 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); 3155 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
3156 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
3095 client_->Reset(); 3157 client_->Reset();
3096 3158
3097 // Android onDraw. 3159 // Android onDraw.
3098 scheduler_->SetNeedsRedraw(); 3160 scheduler_->SetNeedsRedraw();
3099 bool resourceless_software_draw = false; 3161 bool resourceless_software_draw = false;
3100 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 3162 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
3101 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 3163 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
3102 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3164 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
3103 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 3165 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3104 client_->Reset(); 3166 client_->Reset();
3105 3167
3106 // Simulate SetNeedsBeginMainFrame due to input event. 3168 // Simulate SetNeedsBeginMainFrame due to input event.
3107 scheduler_->SetNeedsBeginMainFrame(); 3169 scheduler_->SetNeedsBeginMainFrame();
3108 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_); 3170 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_);
3109 client_->Reset(); 3171 client_->Reset();
3110 3172
3111 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); 3173 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
3112 scheduler_->NotifyReadyToCommit(); 3174 scheduler_->NotifyReadyToCommit();
3113 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); 3175 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
3114 client_->Reset(); 3176 client_->Reset();
3115 3177
3116 scheduler_->NotifyReadyToActivate(); 3178 scheduler_->NotifyReadyToActivate();
3117 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); 3179 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
3118 client_->Reset(); 3180 client_->Reset();
3119 3181
3120 // Next vsync. 3182 // Next vsync.
3121 EXPECT_SCOPED(AdvanceFrame()); 3183 EXPECT_SCOPED(AdvanceFrame());
3122 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); 3184 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
3123 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 2); 3185 EXPECT_ACTION("ScheduledActionInvalidateCompositorFrameSink", client_, 1, 3);
3186 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 2, 3);
3124 client_->Reset(); 3187 client_->Reset();
3125 3188
3126 // Android onDraw. 3189 // Android onDraw.
3127 scheduler_->SetNeedsRedraw(); 3190 scheduler_->SetNeedsRedraw();
3128 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); 3191 scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw);
3129 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 3192 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
3130 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3193 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
3131 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 3194 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3132 client_->Reset(); 3195 client_->Reset();
3133 3196
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 } 3311 }
3249 3312
3250 TEST_F(SchedulerTest, ImplSideInvalidationsInDeadline) { 3313 TEST_F(SchedulerTest, ImplSideInvalidationsInDeadline) {
3251 SetUpScheduler(EXTERNAL_BFS); 3314 SetUpScheduler(EXTERNAL_BFS);
3252 3315
3253 // Request an impl-side invalidation and trigger the deadline. Ensure that the 3316 // Request an impl-side invalidation and trigger the deadline. Ensure that the
3254 // invalidation runs inside the deadline. 3317 // invalidation runs inside the deadline.
3255 scheduler_->SetNeedsImplSideInvalidation(); 3318 scheduler_->SetNeedsImplSideInvalidation();
3256 client_->Reset(); 3319 client_->Reset();
3257 EXPECT_SCOPED(AdvanceFrame()); 3320 EXPECT_SCOPED(AdvanceFrame());
3258 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 3321 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3322 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3259 3323
3260 // Deadline. 3324 // Deadline.
3261 client_->Reset(); 3325 client_->Reset();
3262 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); 3326 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
3263 EXPECT_SINGLE_ACTION("ScheduledActionPerformImplSideInvalidation", client_); 3327 EXPECT_SINGLE_ACTION("ScheduledActionPerformImplSideInvalidation", client_);
3264 } 3328 }
3265 3329
3266 TEST_F(SchedulerTest, ImplSideInvalidationsMergedWithCommit) { 3330 TEST_F(SchedulerTest, ImplSideInvalidationsMergedWithCommit) {
3267 SetUpScheduler(EXTERNAL_BFS); 3331 SetUpScheduler(EXTERNAL_BFS);
3268 3332
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3414 last_begin_frame_number, latest_confirmed_sequence_number, 3478 last_begin_frame_number, latest_confirmed_sequence_number,
3415 has_damage), 3479 has_damage),
3416 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); 3480 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get()));
3417 3481
3418 // Run a successful redraw and verify that a new ack is sent. 3482 // Run a successful redraw and verify that a new ack is sent.
3419 scheduler_->SetNeedsRedraw(); 3483 scheduler_->SetNeedsRedraw();
3420 client_->Reset(); 3484 client_->Reset();
3421 3485
3422 BeginFrameArgs args = SendNextBeginFrame(); 3486 BeginFrameArgs args = SendNextBeginFrame();
3423 EXPECT_LT(latest_confirmed_sequence_number, args.sequence_number); 3487 EXPECT_LT(latest_confirmed_sequence_number, args.sequence_number);
3424 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 3488 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3489 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3425 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 3490 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
3426 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3491 EXPECT_TRUE(scheduler_->begin_frames_expected());
3427 client_->Reset(); 3492 client_->Reset();
3428 3493
3429 task_runner().RunPendingTasks(); // Run posted deadline. 3494 task_runner().RunPendingTasks(); // Run posted deadline.
3430 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 3495 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
3431 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3496 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
3432 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3497 EXPECT_TRUE(scheduler_->begin_frames_expected());
3433 client_->Reset(); 3498 client_->Reset();
3434 3499
3435 // Successful draw caused damage. 3500 // Successful draw caused damage.
3436 latest_confirmed_sequence_number = args.sequence_number; 3501 latest_confirmed_sequence_number = args.sequence_number;
3437 has_damage = true; 3502 has_damage = true;
3438 EXPECT_EQ( 3503 EXPECT_EQ(
3439 BeginFrameAck(args.source_id, args.sequence_number, 3504 BeginFrameAck(args.source_id, args.sequence_number,
3440 latest_confirmed_sequence_number, has_damage), 3505 latest_confirmed_sequence_number, has_damage),
3441 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); 3506 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get()));
3442 3507
3443 // Request another redraw, but fail it. Verify that a new ack is sent, but 3508 // Request another redraw, but fail it. Verify that a new ack is sent, but
3444 // that its |latest_confirmed_sequence_number| didn't change. 3509 // that its |latest_confirmed_sequence_number| didn't change.
3445 scheduler_->SetNeedsRedraw(); 3510 scheduler_->SetNeedsRedraw();
3446 client_->Reset(); 3511 client_->Reset();
3447 3512
3448 args = SendNextBeginFrame(); 3513 args = SendNextBeginFrame();
3449 EXPECT_LT(latest_confirmed_sequence_number, args.sequence_number); 3514 EXPECT_LT(latest_confirmed_sequence_number, args.sequence_number);
3450 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 3515 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3516 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3451 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 3517 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
3452 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3518 EXPECT_TRUE(scheduler_->begin_frames_expected());
3453 client_->Reset(); 3519 client_->Reset();
3454 3520
3455 client_->SetDrawWillHappen(false); 3521 client_->SetDrawWillHappen(false);
3456 task_runner().RunPendingTasks(); // Run posted deadline. 3522 task_runner().RunPendingTasks(); // Run posted deadline.
3457 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2); 3523 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 2);
3458 // Failed draw triggers SendBeginMainFrame. 3524 // Failed draw triggers SendBeginMainFrame.
3459 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); 3525 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
3460 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3526 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
(...skipping 14 matching lines...) Expand all
3475 // To get into a high latency state, this test disables automatic swap acks. 3541 // To get into a high latency state, this test disables automatic swap acks.
3476 client_->SetAutomaticSubmitCompositorFrameAck(false); 3542 client_->SetAutomaticSubmitCompositorFrameAck(false);
3477 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); 3543 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
3478 3544
3479 // Run a successful redraw that submits a compositor frame but doesn't receive 3545 // Run a successful redraw that submits a compositor frame but doesn't receive
3480 // a swap ack. Verify that a BeginFrameAck is sent for it. 3546 // a swap ack. Verify that a BeginFrameAck is sent for it.
3481 scheduler_->SetNeedsRedraw(); 3547 scheduler_->SetNeedsRedraw();
3482 client_->Reset(); 3548 client_->Reset();
3483 3549
3484 BeginFrameArgs args = SendNextBeginFrame(); 3550 BeginFrameArgs args = SendNextBeginFrame();
3485 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 3551 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3552 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3486 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 3553 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
3487 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3554 EXPECT_TRUE(scheduler_->begin_frames_expected());
3488 client_->Reset(); 3555 client_->Reset();
3489 3556
3490 task_runner().RunPendingTasks(); // Run posted deadline. 3557 task_runner().RunPendingTasks(); // Run posted deadline.
3491 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 3558 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
3492 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3559 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
3493 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3560 EXPECT_TRUE(scheduler_->begin_frames_expected());
3494 client_->Reset(); 3561 client_->Reset();
3495 3562
(...skipping 26 matching lines...) Expand all
3522 } 3589 }
3523 3590
3524 TEST_F(SchedulerTest, BeginFrameAckForBeginFrameBeforeLastDeadline) { 3591 TEST_F(SchedulerTest, BeginFrameAckForBeginFrameBeforeLastDeadline) {
3525 SetUpScheduler(EXTERNAL_BFS); 3592 SetUpScheduler(EXTERNAL_BFS);
3526 3593
3527 // Request tile preparation to schedule a proactive BeginFrame. 3594 // Request tile preparation to schedule a proactive BeginFrame.
3528 scheduler_->SetNeedsPrepareTiles(); 3595 scheduler_->SetNeedsPrepareTiles();
3529 client_->Reset(); 3596 client_->Reset();
3530 3597
3531 SendNextBeginFrame(); 3598 SendNextBeginFrame();
3532 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 3599 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3600 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3533 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 3601 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
3534 // Until tiles were prepared, further proactive BeginFrames are expected. 3602 // Until tiles were prepared, further proactive BeginFrames are expected.
3535 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3603 EXPECT_TRUE(scheduler_->begin_frames_expected());
3536 client_->Reset(); 3604 client_->Reset();
3537 3605
3538 // Send the next BeginFrame before the previous one's deadline was executed. 3606 // Send the next BeginFrame before the previous one's deadline was executed.
3539 // This will wait for the previous deadline after which no further BeginFrames 3607 // This will wait for the previous deadline after which no further BeginFrames
3540 // will be needed, and the new BeginFrame should be dropped. 3608 // will be needed, and the new BeginFrame should be dropped.
3541 BeginFrameArgs args = SendNextBeginFrame(); 3609 BeginFrameArgs args = SendNextBeginFrame();
3542 3610
(...skipping 23 matching lines...) Expand all
3566 uint64_t latest_confirmed_sequence_number = 3634 uint64_t latest_confirmed_sequence_number =
3567 fake_external_begin_frame_source_->next_begin_frame_number() - 1; 3635 fake_external_begin_frame_source_->next_begin_frame_number() - 1;
3568 3636
3569 // Request a single BeginFrame. 3637 // Request a single BeginFrame.
3570 scheduler_->SetNeedsOneBeginImplFrame(); 3638 scheduler_->SetNeedsOneBeginImplFrame();
3571 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3639 EXPECT_TRUE(scheduler_->begin_frames_expected());
3572 client_->Reset(); 3640 client_->Reset();
3573 3641
3574 // First BeginFrame is handled by StateMachine. 3642 // First BeginFrame is handled by StateMachine.
3575 BeginFrameArgs first_args = SendNextBeginFrame(); 3643 BeginFrameArgs first_args = SendNextBeginFrame();
3576 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 3644 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3645 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3577 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 3646 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
3578 // State machine is no longer interested in BeginFrames, but scheduler is 3647 // State machine is no longer interested in BeginFrames, but scheduler is
3579 // still observing the source. 3648 // still observing the source.
3580 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3649 EXPECT_TRUE(scheduler_->begin_frames_expected());
3581 EXPECT_FALSE(scheduler_->BeginFrameNeeded()); 3650 EXPECT_FALSE(scheduler_->BeginFrameNeeded());
3582 client_->Reset(); 3651 client_->Reset();
3583 3652
3584 // Send the next BeginFrame before the previous one's deadline was executed. 3653 // Send the next BeginFrame before the previous one's deadline was executed.
3585 // The BeginFrame should be dropped immediately, since the state machine is 3654 // The BeginFrame should be dropped immediately, since the state machine is
3586 // not expecting any BeginFrames. 3655 // not expecting any BeginFrames.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3647 scheduler_->SetNeedsRedraw(); 3716 scheduler_->SetNeedsRedraw();
3648 client_->Reset(); 3717 client_->Reset();
3649 3718
3650 // Send a BeginFrame with a different source_id. 3719 // Send a BeginFrame with a different source_id.
3651 now_src_->Advance(BeginFrameArgs::DefaultInterval()); 3720 now_src_->Advance(BeginFrameArgs::DefaultInterval());
3652 uint32_t source_id = fake_external_begin_frame_source_->source_id() + 1; 3721 uint32_t source_id = fake_external_begin_frame_source_->source_id() + 1;
3653 BeginFrameArgs args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 3722 BeginFrameArgs args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE,
3654 source_id, 1, now_src()); 3723 source_id, 1, now_src());
3655 fake_external_begin_frame_source_->TestOnBeginFrame(args); 3724 fake_external_begin_frame_source_->TestOnBeginFrame(args);
3656 3725
3657 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1); 3726 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3727 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3658 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); 3728 EXPECT_TRUE(client_->IsInsideBeginImplFrame());
3659 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3729 EXPECT_TRUE(scheduler_->begin_frames_expected());
3660 client_->Reset(); 3730 client_->Reset();
3661 3731
3662 task_runner().RunPendingTasks(); // Run posted deadline. 3732 task_runner().RunPendingTasks(); // Run posted deadline.
3663 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1); 3733 EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 0, 1);
3664 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); 3734 EXPECT_FALSE(client_->IsInsideBeginImplFrame());
3665 EXPECT_TRUE(scheduler_->begin_frames_expected()); 3735 EXPECT_TRUE(scheduler_->begin_frames_expected());
3666 client_->Reset(); 3736 client_->Reset();
3667 3737
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3707 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get())); 3777 fake_external_begin_frame_source_->LastAckForObserver(scheduler_.get()));
3708 } 3778 }
3709 3779
3710 TEST_F(SchedulerTest, BeginFrameWhilePreviousDeadlinePending) { 3780 TEST_F(SchedulerTest, BeginFrameWhilePreviousDeadlinePending) {
3711 SetUpScheduler(EXTERNAL_BFS); 3781 SetUpScheduler(EXTERNAL_BFS);
3712 3782
3713 scheduler_->SetNeedsRedraw(); 3783 scheduler_->SetNeedsRedraw();
3714 3784
3715 client_->Reset(); 3785 client_->Reset();
3716 EXPECT_SCOPED(AdvanceFrame()); 3786 EXPECT_SCOPED(AdvanceFrame());
3717 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 3787 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3788 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3718 3789
3719 // Do not run pending deadline but send a new begin frame. The begin frame is 3790 // Do not run pending deadline but send a new begin frame. The begin frame is
3720 // saved and run when the previous frame is over. 3791 // saved and run when the previous frame is over.
3721 client_->Reset(); 3792 client_->Reset();
3722 SendNextBeginFrame(); 3793 SendNextBeginFrame();
3723 EXPECT_NO_ACTION(client_); 3794 EXPECT_NO_ACTION(client_);
3724 3795
3725 task_runner_->RunPendingTasks(); 3796 task_runner_->RunPendingTasks();
3726 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 3797 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
3727 3798
3728 // The saved begin frame is posted as a task. 3799 // The saved begin frame is posted as a task.
3729 client_->Reset(); 3800 client_->Reset();
3730 task_runner_->RunPendingTasks(); 3801 task_runner_->RunPendingTasks();
3731 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 3802 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3803 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3732 } 3804 }
3733 3805
3734 TEST_F(SchedulerTest, IncomingBeginFrameReplacesSavedBeginFrame) { 3806 TEST_F(SchedulerTest, IncomingBeginFrameReplacesSavedBeginFrame) {
3735 SetUpScheduler(EXTERNAL_BFS); 3807 SetUpScheduler(EXTERNAL_BFS);
3736 3808
3737 scheduler_->SetNeedsRedraw(); 3809 scheduler_->SetNeedsRedraw();
3738 3810
3739 client_->Reset(); 3811 client_->Reset();
3740 EXPECT_SCOPED(AdvanceFrame()); 3812 EXPECT_SCOPED(AdvanceFrame());
3741 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 3813 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3814 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3742 3815
3743 // Send two BeginFrames while deadline is pending. 3816 // Send two BeginFrames while deadline is pending.
3744 client_->Reset(); 3817 client_->Reset();
3745 SendNextBeginFrame(); 3818 SendNextBeginFrame();
3746 EXPECT_NO_ACTION(client_); 3819 EXPECT_NO_ACTION(client_);
3747 3820
3748 SendNextBeginFrame(); 3821 SendNextBeginFrame();
3749 EXPECT_NO_ACTION(client_); 3822 EXPECT_NO_ACTION(client_);
3750 3823
3751 task_runner_->RunPendingTasks(); 3824 task_runner_->RunPendingTasks();
3752 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); 3825 EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_);
3753 3826
3754 // Only the last BeginFrame runs. 3827 // Only the last BeginFrame runs.
3755 client_->Reset(); 3828 client_->Reset();
3756 task_runner_->RunPendingTasks(); 3829 task_runner_->RunPendingTasks();
3757 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 3830 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
3831 EXPECT_ACTION("ScheduledActionBeginMainFrameNotExpectedUntil", client_, 1, 2);
3758 3832
3759 client_->Reset(); 3833 client_->Reset();
3760 task_runner_->RunPendingTasks(); 3834 task_runner_->RunPendingTasks();
3761 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2); 3835 EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
3762 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); 3836 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
3763 } 3837 }
3764 3838
3765 } // namespace 3839 } // namespace
3766 } // namespace cc 3840 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698