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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 2323123002: Make disable vsync run the renderer independently (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index c16eb978eaffc19d156f94b8522662f902b60187..d75795103000de15f4719039525c5e318dd21de7 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -215,6 +215,12 @@ class FakeSchedulerClient : public SchedulerClient,
TestScheduler* scheduler_;
};
+enum BeginFrameSourceType {
enne (OOO) 2016/09/08 22:19:52 Most of these tests are using external. I'll prob
+ EXTERNAL_BFS,
+ UNTHROTTLED_BFS,
+ THROTTLED_BFS,
+};
+
class SchedulerTest : public testing::Test {
public:
SchedulerTest()
@@ -232,7 +238,7 @@ class SchedulerTest : public testing::Test {
~SchedulerTest() override {}
protected:
- TestScheduler* CreateScheduler() {
+ TestScheduler* CreateScheduler(BeginFrameSourceType bfs_type) {
BeginFrameSource* frame_source;
unthrottled_frame_source_.reset(new BackToBackBeginFrameSource(
base::MakeUnique<TestDelayBasedTimeSource>(now_src_.get(),
@@ -243,12 +249,16 @@ class SchedulerTest : public testing::Test {
synthetic_frame_source_.reset(new DelayBasedBeginFrameSource(
base::MakeUnique<TestDelayBasedTimeSource>(now_src_.get(),
task_runner_.get())));
- if (!scheduler_settings_.throttle_frame_production) {
- frame_source = unthrottled_frame_source_.get();
- } else if (scheduler_settings_.use_external_begin_frame_source) {
- frame_source = fake_external_begin_frame_source_.get();
- } else {
- frame_source = synthetic_frame_source_.get();
+ switch (bfs_type) {
+ case EXTERNAL_BFS:
+ frame_source = fake_external_begin_frame_source_.get();
+ break;
+ case UNTHROTTLED_BFS:
+ frame_source = unthrottled_frame_source_.get();
+ break;
+ case THROTTLED_BFS:
+ frame_source = synthetic_frame_source_.get();
+ break;
}
std::unique_ptr<FakeCompositorTimingHistory>
@@ -269,22 +279,20 @@ class SchedulerTest : public testing::Test {
return scheduler_.get();
}
- void CreateSchedulerAndInitSurface() {
- CreateScheduler();
+ void SetUpScheduler(BeginFrameSourceType bfs_type,
+ std::unique_ptr<FakeSchedulerClient> client) {
+ client_ = std::move(client);
+ CreateScheduler(bfs_type);
EXPECT_SCOPED(InitializeOutputSurfaceAndFirstCommit());
}
- void SetUpScheduler(bool initSurface) {
- SetUpScheduler(base::WrapUnique(new FakeSchedulerClient), initSurface);
+ void SetUpScheduler(BeginFrameSourceType bfs_type) {
+ SetUpScheduler(bfs_type, base::MakeUnique<FakeSchedulerClient>());
}
- void SetUpScheduler(std::unique_ptr<FakeSchedulerClient> client,
- bool initSurface) {
- client_ = std::move(client);
- if (initSurface)
- CreateSchedulerAndInitSurface();
- else
- CreateScheduler();
+ void SetUpSchedulerWithNoOutputSurface(BeginFrameSourceType bfs_type) {
+ client_ = base::MakeUnique<FakeSchedulerClient>();
+ CreateScheduler(bfs_type);
}
OrderedSimpleTaskRunner& task_runner() { return *task_runner_; }
@@ -408,11 +416,8 @@ class SchedulerTest : public testing::Test {
void CheckMainFrameSkippedAfterLateCommit(bool expect_send_begin_main_frame);
void ImplFrameSkippedAfterLateSwapAck(bool swap_ack_before_deadline);
void ImplFrameNotSkippedAfterLateSwapAck();
- void BeginFramesNotFromClient(bool use_external_begin_frame_source,
- bool throttle_frame_production);
- void BeginFramesNotFromClient_SwapThrottled(
- bool use_external_begin_frame_source,
- bool throttle_frame_production);
+ void BeginFramesNotFromClient(BeginFrameSourceType bfs_type);
+ void BeginFramesNotFromClient_SwapThrottled(BeginFrameSourceType bfs_type);
bool BeginMainFrameOnCriticalPath(TreePriority tree_priority,
ScrollHandlerState scroll_handler_state,
base::TimeDelta durations);
@@ -430,8 +435,7 @@ class SchedulerTest : public testing::Test {
};
TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(false);
+ SetUpSchedulerWithNoOutputSurface(EXTERNAL_BFS);
scheduler_->SetVisible(true);
scheduler_->SetCanDraw(true);
@@ -442,8 +446,7 @@ TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) {
}
TEST_F(SchedulerTest, VideoNeedsBeginFrames) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetVideoNeedsBeginFrames(true);
EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
@@ -473,8 +476,7 @@ TEST_F(SchedulerTest, VideoNeedsBeginFrames) {
}
TEST_F(SchedulerTest, RequestCommit) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -536,8 +538,7 @@ TEST_F(SchedulerTest, RequestCommit) {
}
TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetDeferCommits(true);
@@ -563,8 +564,7 @@ TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) {
}
TEST_F(SchedulerTest, DeferCommitWithRedraw) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetDeferCommits(true);
@@ -594,8 +594,7 @@ TEST_F(SchedulerTest, DeferCommitWithRedraw) {
}
TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -701,8 +700,7 @@ class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
TEST_F(SchedulerTest, RequestRedrawInsideDraw) {
SchedulerClientThatsetNeedsDrawInsideDraw* client =
new SchedulerClientThatsetNeedsDrawInsideDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
client->SetRequestRedrawsInsideDraw(true);
scheduler_->SetNeedsRedraw();
@@ -737,8 +735,7 @@ TEST_F(SchedulerTest, RequestRedrawInsideDraw) {
TEST_F(SchedulerTest, RequestRedrawInsideFailedDraw) {
SchedulerClientThatsetNeedsDrawInsideDraw* client =
new SchedulerClientThatsetNeedsDrawInsideDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
client->SetRequestRedrawsInsideDraw(true);
client->SetDrawWillHappen(false);
@@ -812,9 +809,7 @@ class SchedulerClientThatSetNeedsBeginMainFrameInsideDraw
TEST_F(SchedulerTest, RequestCommitInsideDraw) {
SchedulerClientThatSetNeedsBeginMainFrameInsideDraw* client =
new SchedulerClientThatSetNeedsBeginMainFrameInsideDraw;
-
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
EXPECT_FALSE(client->needs_begin_frames());
scheduler_->SetNeedsRedraw();
@@ -855,8 +850,7 @@ TEST_F(SchedulerTest, RequestCommitInsideDraw) {
TEST_F(SchedulerTest, RequestCommitInsideFailedDraw) {
SchedulerClientThatsetNeedsDrawInsideDraw* client =
new SchedulerClientThatsetNeedsDrawInsideDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
client->SetDrawWillHappen(false);
@@ -898,8 +892,7 @@ TEST_F(SchedulerTest, RequestCommitInsideFailedDraw) {
TEST_F(SchedulerTest, NoSwapWhenDrawFails) {
SchedulerClientThatSetNeedsBeginMainFrameInsideDraw* client =
new SchedulerClientThatSetNeedsBeginMainFrameInsideDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
scheduler_->SetNeedsRedraw();
EXPECT_TRUE(scheduler_->RedrawPending());
@@ -936,8 +929,7 @@ class SchedulerClientNeedsPrepareTilesInDraw : public FakeSchedulerClient {
TEST_F(SchedulerTest, PrepareTiles) {
SchedulerClientNeedsPrepareTilesInDraw* client =
new SchedulerClientNeedsPrepareTilesInDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
// Request both draw and prepare tiles. PrepareTiles shouldn't
// be trigged until BeginImplFrame.
@@ -1036,8 +1028,7 @@ TEST_F(SchedulerTest, PrepareTiles) {
// Test that PrepareTiles only happens once per frame. If an external caller
// initiates it, then the state machine should not PrepareTiles on that frame.
TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// If DidPrepareTiles during a frame, then PrepareTiles should not occur
// again.
@@ -1149,8 +1140,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
TEST_F(SchedulerTest, PrepareTilesFunnelResetOnVisibilityChange) {
std::unique_ptr<SchedulerClientNeedsPrepareTilesInDraw> client =
base::WrapUnique(new SchedulerClientNeedsPrepareTilesInDraw);
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(std::move(client), true);
+ SetUpScheduler(EXTERNAL_BFS, std::move(client));
// Simulate a few visibility changes and associated PrepareTiles.
for (int i = 0; i < 10; i++) {
@@ -1182,8 +1172,7 @@ TEST_F(SchedulerTest, PrepareTilesFunnelResetOnVisibilityChange) {
TEST_F(SchedulerTest, TriggerBeginFrameDeadlineEarly) {
SchedulerClientNeedsPrepareTilesInDraw* client =
new SchedulerClientNeedsPrepareTilesInDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
scheduler_->SetNeedsRedraw();
EXPECT_SCOPED(AdvanceFrame());
@@ -1196,9 +1185,8 @@ TEST_F(SchedulerTest, TriggerBeginFrameDeadlineEarly) {
TEST_F(SchedulerTest, WaitForReadyToDrawDoNotPostDeadline) {
SchedulerClientNeedsPrepareTilesInDraw* client =
new SchedulerClientNeedsPrepareTilesInDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
scheduler_settings_.commit_to_active_tree = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -1236,9 +1224,8 @@ TEST_F(SchedulerTest, WaitForReadyToDrawDoNotPostDeadline) {
TEST_F(SchedulerTest, WaitForReadyToDrawCancelledWhenLostOutputSurface) {
SchedulerClientNeedsPrepareTilesInDraw* client =
new SchedulerClientNeedsPrepareTilesInDraw;
- scheduler_settings_.use_external_begin_frame_source = true;
scheduler_settings_.commit_to_active_tree = true;
- SetUpScheduler(base::WrapUnique(client), true);
+ SetUpScheduler(EXTERNAL_BFS, base::WrapUnique(client));
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -1308,8 +1295,7 @@ void SchedulerTest::CheckMainFrameSkippedAfterLateCommit(
}
TEST_F(SchedulerTest, MainFrameSkippedAfterLateCommit) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
bool expect_send_begin_main_frame = false;
@@ -1321,8 +1307,7 @@ TEST_F(SchedulerTest, MainFrameSkippedAfterLateCommit) {
// should not affect whether we recover latency or not.
TEST_F(SchedulerTest,
MainFrameSkippedAfterLateCommit_LongMainFrameQueueDurationNotCritical) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_
->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration);
@@ -1336,8 +1321,7 @@ TEST_F(SchedulerTest,
// should affect whether we recover latency or not.
TEST_F(SchedulerTest,
MainFrameNotSkippedAfterLateCommit_LongMainFrameQueueDurationCritical) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_
->SetBeginMainFrameQueueDurationCriticalEstimate(kSlowDuration);
@@ -1351,8 +1335,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
MainFrameNotSkippedAfterLateCommitInPreferImplLatencyMode) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetTreePrioritiesAndScrollState(
SMOOTHNESS_TAKES_PRIORITY,
ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER);
@@ -1365,8 +1348,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
MainFrameNotSkippedAfterLateCommit_CommitEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_
->SetBeginMainFrameStartToCommitDurationEstimate(kSlowDuration);
@@ -1378,8 +1360,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
MainFrameNotSkippedAfterLateCommit_ReadyToActivateEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate(
kSlowDuration);
@@ -1391,8 +1372,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
MainFrameNotSkippedAfterLateCommit_ActivateEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_->SetActivateDurationEstimate(kSlowDuration);
@@ -1402,8 +1382,7 @@ TEST_F(SchedulerTest,
}
TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration);
@@ -1415,8 +1394,7 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) {
// If the BeginMainFrame aborts, it doesn't actually insert a frame into the
// queue, which means there is no latency to recover.
TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateBeginMainFrameAbort) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// Use fast estimates so we think we can recover latency if needed.
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
@@ -1452,8 +1430,7 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateBeginMainFrameAbort) {
// If the BeginMainFrame aborts, it doesn't actually insert a frame into the
// queue, which means there is no latency to recover.
TEST_F(SchedulerTest, MainFrameNotSkippedAfterCanDrawChanges) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// Use fast estimates so we think we can recover latency if needed.
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
@@ -1574,8 +1551,7 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
TEST_F(SchedulerTest,
ImplFrameSkippedAfterLateSwapAck_FastEstimates_SwapAckThenDeadline) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
bool swap_ack_before_deadline = true;
@@ -1584,8 +1560,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
ImplFrameSkippedAfterLateSwapAck_FastEstimates_DeadlineThenSwapAck) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
bool swap_ack_before_deadline = false;
@@ -1594,8 +1569,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
ImplFrameSkippedAfterLateSwapAck_LongMainFrameQueueDurationNotCritical) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_
->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration);
@@ -1606,8 +1580,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
ImplFrameSkippedAfterLateSwapAck_ImplLatencyTakesPriority) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// Even if every estimate related to the main thread is slow, we should
// still expect to recover impl thread latency if the draw is fast and we
@@ -1625,8 +1598,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
ImplFrameSkippedAfterLateSwapAck_OnlyImplSideUpdatesExpected) {
// This tests that we recover impl thread latency when there are no commits.
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// To get into a high latency state, this test disables automatic swap acks.
client_->SetAutomaticSwapAck(false);
@@ -1740,8 +1712,7 @@ void SchedulerTest::ImplFrameNotSkippedAfterLateSwapAck() {
TEST_F(
SchedulerTest,
ImplFrameNotSkippedAfterLateSwapAck_MainFrameQueueDurationCriticalTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_
->SetBeginMainFrameQueueDurationCriticalEstimate(kSlowDuration);
@@ -1752,8 +1723,7 @@ TEST_F(
TEST_F(SchedulerTest,
ImplFrameNotSkippedAfterLateSwapAck_CommitEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_
->SetBeginMainFrameStartToCommitDurationEstimate(kSlowDuration);
@@ -1762,8 +1732,7 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
ImplFrameNotSkippedAfterLateSwapAck_ReadyToActivateEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate(
kSlowDuration);
@@ -1772,16 +1741,14 @@ TEST_F(SchedulerTest,
TEST_F(SchedulerTest,
ImplFrameNotSkippedAfterLateSwapAck_ActivateEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_->SetActivateDurationEstimate(kSlowDuration);
EXPECT_SCOPED(ImplFrameNotSkippedAfterLateSwapAck());
}
TEST_F(SchedulerTest, ImplFrameNotSkippedAfterLateSwapAck_DrawEstimateTooLong) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration);
EXPECT_SCOPED(ImplFrameNotSkippedAfterLateSwapAck());
@@ -1793,8 +1760,7 @@ TEST_F(SchedulerTest,
// This test starts off with expensive estimates to prevent latency recovery
// initially, then lowers the estimates to enable it once both the main
// and impl threads are in a high latency mode.
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration);
// To get into a high latency state, this test disables automatic swap acks.
@@ -1915,9 +1881,8 @@ TEST_F(
// NPAPI plugins on Windows block the Browser UI thread on the Renderer main
// thread. This prevents the scheduler from receiving any pending swap acks.
- scheduler_settings_.use_external_begin_frame_source = true;
scheduler_settings_.main_frame_while_swap_throttled_enabled = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
@@ -1979,10 +1944,9 @@ TEST_F(
// Since we are simulating a long commit, set up a client with draw duration
// estimates that prevent skipping main frames to get to low latency mode.
- scheduler_settings_.use_external_begin_frame_source = true;
scheduler_settings_.main_frame_while_swap_throttled_enabled = true;
scheduler_settings_.main_frame_before_activation_enabled = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
@@ -2039,8 +2003,7 @@ TEST_F(
}
TEST_F(SchedulerTest, BeginRetroFrame) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2113,8 +2076,7 @@ TEST_F(SchedulerTest, BeginRetroFrame) {
}
TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsBeginMainFrame();
EXPECT_TRUE(scheduler_->begin_frames_expected());
@@ -2172,8 +2134,7 @@ TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
}
TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsBeginMainFrame();
EXPECT_TRUE(scheduler_->begin_frames_expected());
@@ -2224,8 +2185,7 @@ TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
}
TEST_F(SchedulerTest, MissedFrameDoesNotExpireTooEarly) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsBeginMainFrame();
EXPECT_TRUE(scheduler_->begin_frames_expected());
@@ -2249,8 +2209,7 @@ TEST_F(SchedulerTest, MissedFrameDoesNotExpireTooEarly) {
}
TEST_F(SchedulerTest, MissedFrameExpiresOnTime) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsBeginMainFrame();
EXPECT_TRUE(scheduler_->begin_frames_expected());
@@ -2273,13 +2232,8 @@ TEST_F(SchedulerTest, MissedFrameExpiresOnTime) {
EXPECT_FALSE(client_->IsInsideBeginImplFrame());
}
-void SchedulerTest::BeginFramesNotFromClient(
- bool use_external_begin_frame_source,
- bool throttle_frame_production) {
- scheduler_settings_.use_external_begin_frame_source =
- use_external_begin_frame_source;
- scheduler_settings_.throttle_frame_production = throttle_frame_production;
- SetUpScheduler(true);
+void SchedulerTest::BeginFramesNotFromClient(BeginFrameSourceType bfs_type) {
+ SetUpScheduler(bfs_type);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame
// without calling SetNeedsBeginFrame.
@@ -2339,33 +2293,16 @@ void SchedulerTest::BeginFramesNotFromClient(
}
TEST_F(SchedulerTest, SyntheticBeginFrames) {
- bool use_external_begin_frame_source = false;
- bool throttle_frame_production = true;
- BeginFramesNotFromClient(use_external_begin_frame_source,
- throttle_frame_production);
+ BeginFramesNotFromClient(THROTTLED_BFS);
enne (OOO) 2016/09/08 22:19:52 BeginFramesNotFromClient are really old tests from
}
-TEST_F(SchedulerTest, VSyncThrottlingDisabled) {
- bool use_external_begin_frame_source = true;
- bool throttle_frame_production = false;
- BeginFramesNotFromClient(use_external_begin_frame_source,
- throttle_frame_production);
-}
-
-TEST_F(SchedulerTest, SyntheticBeginFrames_And_VSyncThrottlingDisabled) {
- bool use_external_begin_frame_source = false;
- bool throttle_frame_production = false;
- BeginFramesNotFromClient(use_external_begin_frame_source,
- throttle_frame_production);
+TEST_F(SchedulerTest, UnthrottledBeginFrames) {
+ BeginFramesNotFromClient(UNTHROTTLED_BFS);
}
void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
- bool use_external_begin_frame_source,
- bool throttle_frame_production) {
- scheduler_settings_.use_external_begin_frame_source =
- use_external_begin_frame_source;
- scheduler_settings_.throttle_frame_production = throttle_frame_production;
- SetUpScheduler(true);
+ BeginFrameSourceType bfs_type) {
+ SetUpScheduler(bfs_type);
scheduler_->SetEstimatedParentDrawTime(
BeginFrameArgs::DefaultEstimatedParentDrawTime());
@@ -2455,30 +2392,15 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
}
TEST_F(SchedulerTest, SyntheticBeginFrames_SwapThrottled) {
- bool use_external_begin_frame_source = false;
- bool throttle_frame_production = true;
- BeginFramesNotFromClient_SwapThrottled(use_external_begin_frame_source,
- throttle_frame_production);
-}
-
-TEST_F(SchedulerTest, VSyncThrottlingDisabled_SwapThrottled) {
- bool use_external_begin_frame_source = true;
- bool throttle_frame_production = false;
- BeginFramesNotFromClient_SwapThrottled(use_external_begin_frame_source,
- throttle_frame_production);
+ BeginFramesNotFromClient_SwapThrottled(THROTTLED_BFS);
}
-TEST_F(SchedulerTest,
- SyntheticBeginFrames_And_VSyncThrottlingDisabled_SwapThrottled) {
- bool use_external_begin_frame_source = false;
- bool throttle_frame_production = false;
- BeginFramesNotFromClient_SwapThrottled(use_external_begin_frame_source,
- throttle_frame_production);
+TEST_F(SchedulerTest, UnthrottledBeginFrames_SwapThrottled) {
+ BeginFramesNotFromClient_SwapThrottled(UNTHROTTLED_BFS);
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterOutputSurfaceIsInitialized) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(false);
+ SetUpSchedulerWithNoOutputSurface(EXTERNAL_BFS);
scheduler_->SetVisible(true);
scheduler_->SetCanDraw(true);
@@ -2493,8 +2415,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterOutputSurfaceIsInitialized) {
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2526,8 +2447,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
TEST_F(SchedulerTest,
DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2570,8 +2490,7 @@ TEST_F(SchedulerTest,
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2602,8 +2521,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) {
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsPrepareTiles) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsPrepareTiles();
scheduler_->SetNeedsRedraw();
@@ -2628,8 +2546,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsPrepareTiles) {
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2688,8 +2605,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2762,7 +2678,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceWithDelayBasedBeginFrameSource) {
- SetUpScheduler(true);
+ SetUpScheduler(THROTTLED_BFS);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
EXPECT_FALSE(scheduler_->begin_frames_expected());
@@ -2803,8 +2719,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWithDelayBasedBeginFrameSource) {
}
TEST_F(SchedulerTest, DidLoseOutputSurfaceWhenIdle) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2838,8 +2753,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWhenIdle) {
}
TEST_F(SchedulerTest, ScheduledActionActivateAfterBecomingInvisible) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2868,8 +2782,7 @@ TEST_F(SchedulerTest, ScheduledActionActivateAfterBecomingInvisible) {
}
TEST_F(SchedulerTest, ScheduledActionActivateAfterBeginFrameSourcePaused) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -2897,8 +2810,7 @@ TEST_F(SchedulerTest, ScheduledActionActivateAfterBeginFrameSourcePaused) {
// Tests to ensure frame sources can be successfully changed while drawing.
TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsRedraw should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsRedraw();
@@ -2934,8 +2846,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
// Tests to ensure frame sources can be successfully changed while a frame
// deadline is pending.
TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsRedraw should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsRedraw();
@@ -2969,9 +2880,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
// Tests to ensure that the active frame source can successfully be changed from
// unthrottled to throttled.
TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
- scheduler_settings_.throttle_frame_production = false;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(UNTHROTTLED_BFS);
scheduler_->SetNeedsRedraw();
EXPECT_NO_ACTION(client_);
@@ -3007,8 +2916,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
}
TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsRedraw();
EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
@@ -3060,8 +2968,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) {
// This test maskes sure that switching a frame source when not observing
// such as when not visible also works.
TEST_F(SchedulerTest, SwitchFrameSourceWhenNotObserving) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -3113,8 +3020,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceWhenNotObserving) {
// Tests to ensure that we send a BeginMainFrameNotExpectedSoon when expected.
TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
scheduler_->SetNeedsBeginMainFrame();
@@ -3149,8 +3055,7 @@ TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
scheduler_settings_.using_synchronous_renderer_compositor = true;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsOneBeginImplFrame();
EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
@@ -3205,8 +3110,7 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) {
scheduler_settings_.using_synchronous_renderer_compositor = true;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsRedraw();
bool resourceless_software_draw = false;
@@ -3226,8 +3130,7 @@ TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) {
}
TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
EXPECT_FALSE(scheduler_->begin_frames_expected());
@@ -3265,8 +3168,7 @@ TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
TEST_F(SchedulerTest, SynchronousCompositorCommit) {
scheduler_settings_.using_synchronous_renderer_compositor = true;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsBeginMainFrame();
EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
@@ -3322,8 +3224,7 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) {
TEST_F(SchedulerTest, SynchronousCompositorDoubleCommitWithoutDraw) {
scheduler_settings_.using_synchronous_renderer_compositor = true;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsBeginMainFrame();
EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
@@ -3379,11 +3280,10 @@ class SchedulerClientSetNeedsPrepareTilesOnDraw : public FakeSchedulerClient {
TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {
scheduler_settings_.using_synchronous_renderer_compositor = true;
- scheduler_settings_.use_external_begin_frame_source = true;
std::unique_ptr<FakeSchedulerClient> client =
base::WrapUnique(new SchedulerClientSetNeedsPrepareTilesOnDraw);
- SetUpScheduler(std::move(client), true);
+ SetUpScheduler(EXTERNAL_BFS, std::move(client));
scheduler_->SetNeedsRedraw();
EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
@@ -3426,9 +3326,7 @@ TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {
TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
scheduler_settings_.using_synchronous_renderer_compositor = true;
- scheduler_settings_.use_external_begin_frame_source = true;
-
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetNeedsRedraw();
EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
@@ -3485,8 +3383,7 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
TEST_F(SchedulerTest, SynchronousCompositorResourcelessOnDrawWhenInvisible) {
scheduler_settings_.using_synchronous_renderer_compositor = true;
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
scheduler_->SetVisible(false);
@@ -3500,7 +3397,7 @@ TEST_F(SchedulerTest, SynchronousCompositorResourcelessOnDrawWhenInvisible) {
}
TEST_F(SchedulerTest, AuthoritativeVSyncInterval) {
- SetUpScheduler(true);
+ SetUpScheduler(THROTTLED_BFS);
base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval();
base::TimeDelta authoritative_interval =
base::TimeDelta::FromMilliseconds(33);
@@ -3528,7 +3425,7 @@ TEST_F(SchedulerTest, AuthoritativeVSyncInterval) {
}
TEST_F(SchedulerTest, ImplLatencyTakesPriority) {
- SetUpScheduler(true);
+ SetUpScheduler(THROTTLED_BFS);
scheduler_->SetTreePrioritiesAndScrollState(
SMOOTHNESS_TAKES_PRIORITY,
@@ -3564,7 +3461,7 @@ TEST_F(SchedulerTest, ImplLatencyTakesPriority) {
}
TEST_F(SchedulerTest, NoOutputSurfaceCreationWhileCommitPending) {
- SetUpScheduler(true);
+ SetUpScheduler(THROTTLED_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -3595,7 +3492,7 @@ TEST_F(SchedulerTest, NoOutputSurfaceCreationWhileCommitPending) {
TEST_F(SchedulerTest, OutputSurfaceCreationWhileCommitPending) {
scheduler_settings_.abort_commit_before_output_surface_creation = false;
- SetUpScheduler(true);
+ SetUpScheduler(THROTTLED_BFS);
// SetNeedsBeginMainFrame should begin the frame.
scheduler_->SetNeedsBeginMainFrame();
@@ -3627,8 +3524,7 @@ bool SchedulerTest::BeginMainFrameOnCriticalPath(
TreePriority tree_priority,
ScrollHandlerState scroll_handler_state,
base::TimeDelta durations) {
- scheduler_settings_.use_external_begin_frame_source = true;
- SetUpScheduler(true);
+ SetUpScheduler(EXTERNAL_BFS);
fake_compositor_timing_history_->SetAllEstimatesTo(durations);
client_->Reset();
scheduler_->SetTreePrioritiesAndScrollState(tree_priority,

Powered by Google App Engine
This is Rietveld 408576698