Index: cc/scheduler/scheduler_unittest.cc |
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc |
index 03bb8b0da5c094ec7a0f7aed75331f4e061e0d26..1392c303dd586b6d9e6be7540a580b11219041f5 100644 |
--- a/cc/scheduler/scheduler_unittest.cc |
+++ b/cc/scheduler/scheduler_unittest.cc |
@@ -45,6 +45,9 @@ |
namespace cc { |
namespace { |
+base::TimeDelta kSlowDuration = base::TimeDelta::FromSeconds(1); |
+base::TimeDelta kFastDuration = base::TimeDelta::FromMilliseconds(1); |
+ |
class FakeSchedulerClient : public SchedulerClient { |
public: |
FakeSchedulerClient() |
@@ -276,8 +279,7 @@ class SchedulerTest : public testing::Test { |
client_->set_scheduler(scheduler_.get()); |
// Use large estimates by default to avoid latency recovery in most tests. |
- base::TimeDelta slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
return scheduler_.get(); |
} |
@@ -424,6 +426,9 @@ class SchedulerTest : public testing::Test { |
void BeginFramesNotFromClient_SwapThrottled( |
bool use_external_begin_frame_source, |
bool throttle_frame_production); |
+ bool BeginMainFrameOnCriticalPath(TreePriority tree_priority, |
+ ScrollHandlerState scroll_handler_state, |
+ base::TimeDelta durations); |
scoped_ptr<base::SimpleTestTickClock> now_src_; |
scoped_refptr<OrderedSimpleTaskRunner> task_runner_; |
@@ -485,8 +490,9 @@ TEST_F(SchedulerTest, SendBeginFramesToChildrenDeadlineNotAdjusted) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate( |
- base::TimeDelta::FromMilliseconds(2)); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameStartToCommitDurationEstimate( |
+ base::TimeDelta::FromMilliseconds(2)); |
fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( |
base::TimeDelta::FromMilliseconds(4)); |
fake_compositor_timing_history_->SetDrawDurationEstimate( |
@@ -1381,6 +1387,7 @@ void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( |
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
EXPECT_EQ(expect_send_begin_main_frame, |
scheduler_->MainThreadMissedLastDeadline()); |
+ EXPECT_TRUE(client_->HasAction("WillBeginImplFrame")); |
EXPECT_EQ(expect_send_begin_main_frame, |
client_->HasAction("ScheduledActionSendBeginMainFrame")); |
} |
@@ -1388,23 +1395,55 @@ void SchedulerTest::CheckMainFrameSkippedAfterLateCommit( |
TEST_F(SchedulerTest, MainFrameSkippedAfterLateCommit) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
+ bool expect_send_begin_main_frame = false; |
+ EXPECT_SCOPED( |
+ CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
+} |
+ |
+// Response times of BeginMainFrame's without the critical path flag set |
+// should not affect whether we recover latency or not. |
+TEST_F( |
+ SchedulerTest, |
+ MainFrameSkippedAfterLateCommit_LongBeginMainFrameQueueDurationNotCritical) { |
+ scheduler_settings_.use_external_begin_frame_source = true; |
+ SetUpScheduler(true); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
bool expect_send_begin_main_frame = false; |
EXPECT_SCOPED( |
CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
} |
+// Response times of BeginMainFrame's with the critical path flag set |
+// should affect whether we recover latency or not. |
+TEST_F( |
+ SchedulerTest, |
+ MainFrameNotSkippedAfterLateCommit_LongBeginMainFrameQueueDurationCritical) { |
+ scheduler_settings_.use_external_begin_frame_source = true; |
+ SetUpScheduler(true); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameQueueDurationCriticalEstimate(kSlowDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
+ |
+ bool expect_send_begin_main_frame = true; |
+ EXPECT_SCOPED( |
+ CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
+} |
+ |
TEST_F(SchedulerTest, |
MainFrameNotSkippedAfterLateCommitInPreferImplLatencyMode) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- scheduler_->SetImplLatencyTakesPriority(true); |
- |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
+ scheduler_->SetTreePrioritiesAndScrollState( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
bool expect_send_begin_main_frame = true; |
EXPECT_SCOPED( |
@@ -1415,11 +1454,9 @@ TEST_F(SchedulerTest, |
MainFrameNotSkippedAfterLateCommit_CommitEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate( |
- slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameStartToCommitDurationEstimate(kSlowDuration); |
bool expect_send_begin_main_frame = true; |
EXPECT_SCOPED( |
@@ -1430,11 +1467,9 @@ TEST_F(SchedulerTest, |
MainFrameNotSkippedAfterLateCommit_ReadyToActivateEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( |
- slow_duration); |
+ kSlowDuration); |
bool expect_send_begin_main_frame = true; |
EXPECT_SCOPED( |
@@ -1445,10 +1480,8 @@ TEST_F(SchedulerTest, |
MainFrameNotSkippedAfterLateCommit_ActivateEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetActivateDurationEstimate(slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_->SetActivateDurationEstimate(kSlowDuration); |
bool expect_send_begin_main_frame = true; |
EXPECT_SCOPED( |
@@ -1458,10 +1491,8 @@ TEST_F(SchedulerTest, |
TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetDrawDurationEstimate(slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration); |
bool expect_send_begin_main_frame = true; |
EXPECT_SCOPED( |
@@ -1549,9 +1580,7 @@ TEST_F(SchedulerTest, |
ImplFrameSkippedAfterLateSwapAck_FastEstimates_SwapAckThenDeadline) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
bool swap_ack_before_deadline = true; |
EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
@@ -1561,9 +1590,20 @@ TEST_F(SchedulerTest, |
ImplFrameSkippedAfterLateSwapAck_FastEstimates_DeadlineThenSwapAck) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
+ bool swap_ack_before_deadline = false; |
+ EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
+} |
+ |
+TEST_F( |
+ SchedulerTest, |
+ ImplFrameSkippedAfterLateSwapAck_LongBeginMainFrameQueueDurationNotCritical) { |
+ scheduler_settings_.use_external_begin_frame_source = true; |
+ SetUpScheduler(true); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
bool swap_ack_before_deadline = false; |
EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
@@ -1577,11 +1617,11 @@ TEST_F(SchedulerTest, |
// 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 |
// are in impl latency takes priority. |
- scheduler_->SetImplLatencyTakesPriority(true); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetDrawDurationEstimate(fast_duration); |
+ scheduler_->SetTreePrioritiesAndScrollState( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
+ fake_compositor_timing_history_->SetDrawDurationEstimate(kFastDuration); |
bool swap_ack_before_deadline = false; |
EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
@@ -1599,10 +1639,8 @@ TEST_F(SchedulerTest, |
// Even if every estimate related to the main thread is slow, we should |
// still expect to recover impl thread latency if there are no commits from |
// the main thread. |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetDrawDurationEstimate(fast_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
+ fake_compositor_timing_history_->SetDrawDurationEstimate(kFastDuration); |
// Draw and swap for first BeginFrame |
client_->Reset(); |
@@ -1708,15 +1746,26 @@ void SchedulerTest::ImplFrameIsNotSkippedAfterLateSwapAck() { |
} |
} |
+TEST_F( |
+ SchedulerTest, |
+ ImplFrameIsNotSkippedAfterLateSwapAck_BeginMainFrameQueueDurationCriticalTooLong) { |
+ scheduler_settings_.use_external_begin_frame_source = true; |
+ SetUpScheduler(true); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameQueueDurationCriticalEstimate(kSlowDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
+ EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
+} |
+ |
TEST_F(SchedulerTest, |
ImplFrameIsNotSkippedAfterLateSwapAck_CommitEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate( |
- slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_ |
+ ->SetBeginMainFrameStartToCommitDurationEstimate(kSlowDuration); |
EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
} |
@@ -1724,11 +1773,9 @@ TEST_F(SchedulerTest, |
ImplFrameIsNotSkippedAfterLateSwapAck_ReadyToActivateEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( |
- slow_duration); |
+ kSlowDuration); |
EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
} |
@@ -1736,10 +1783,8 @@ TEST_F(SchedulerTest, |
ImplFrameIsNotSkippedAfterLateSwapAck_ActivateEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetActivateDurationEstimate(slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_->SetActivateDurationEstimate(kSlowDuration); |
EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
} |
@@ -1747,10 +1792,8 @@ TEST_F(SchedulerTest, |
ImplFrameIsNotSkippedAfterLateSwapAck_DrawEstimateTooLong) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetDrawDurationEstimate(slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration); |
EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
} |
@@ -1762,9 +1805,7 @@ TEST_F(SchedulerTest, |
// and impl threads are in a high latency mode. |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- |
- auto slow_duration = base::TimeDelta::FromSeconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
// To get into a high latency state, this test disables automatic swap acks. |
client_->SetAutomaticSwapAck(false); |
@@ -1825,8 +1866,7 @@ TEST_F(SchedulerTest, |
EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
// Lower estimates so that the scheduler will attempt latency recovery. |
- auto fast_duration = base::TimeDelta::FromMilliseconds(1); |
- fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
// Now that both threads are in a high latency mode, make sure we |
// skip the BeginMainFrame, then the BeginImplFrame, but not both |
@@ -3478,39 +3518,112 @@ TEST_F(SchedulerTest, AuthoritativeVSyncInterval) { |
TEST_F(SchedulerTest, ImplLatencyTakesPriority) { |
SetUpScheduler(true); |
- scheduler_->SetImplLatencyTakesPriority(true); |
+ |
+ scheduler_->SetTreePrioritiesAndScrollState( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
+ EXPECT_TRUE(scheduler_->ImplLatencyTakesPriority()); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
EXPECT_TRUE(scheduler_->ImplLatencyTakesPriority()); |
- scheduler_->SetImplLatencyTakesPriority(false); |
+ scheduler_->SetTreePrioritiesAndScrollState( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
+ EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
+ EXPECT_TRUE(scheduler_->ImplLatencyTakesPriority()); |
+ |
+ scheduler_->SetTreePrioritiesAndScrollState( |
+ SAME_PRIORITY_FOR_BOTH_TREES, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
+ EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
+ EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
+ |
+ scheduler_->SetTreePrioritiesAndScrollState( |
+ SAME_PRIORITY_FOR_BOTH_TREES, |
+ ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
+ EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
+ scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
} |
-TEST_F(SchedulerTest, BeginMainFrameArgs_OnCriticalPath) { |
+// The three letters appeneded to each version of this test mean the following:s |
+// tree_priority: B = both trees same priority; A = active tree priority; |
+// scroll_handler_state: H = affects scroll handler; N = does not affect scroll |
+// handler; |
+// durations: F = fast durations; S = slow durations |
+bool SchedulerTest::BeginMainFrameOnCriticalPath( |
+ TreePriority tree_priority, |
+ ScrollHandlerState scroll_handler_state, |
+ base::TimeDelta durations) { |
scheduler_settings_.use_external_begin_frame_source = true; |
SetUpScheduler(true); |
- |
- scheduler_->SetImplLatencyTakesPriority(false); |
- scheduler_->SetNeedsBeginMainFrame(); |
- |
+ fake_compositor_timing_history_->SetAllEstimatesTo(durations); |
client_->Reset(); |
+ scheduler_->SetTreePrioritiesAndScrollState(tree_priority, |
+ scroll_handler_state); |
+ scheduler_->SetNeedsBeginMainFrame(); |
EXPECT_FALSE(client_->last_begin_main_frame_args().IsValid()); |
EXPECT_SCOPED(AdvanceFrame()); |
EXPECT_TRUE(client_->last_begin_main_frame_args().IsValid()); |
- EXPECT_TRUE(client_->last_begin_main_frame_args().on_critical_path); |
+ return client_->last_begin_main_frame_args().on_critical_path; |
} |
-TEST_F(SchedulerTest, BeginMainFrameArgs_NotOnCriticalPath) { |
- scheduler_settings_.use_external_begin_frame_source = true; |
- SetUpScheduler(true); |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BNF) { |
+ EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
+ SAME_PRIORITY_FOR_BOTH_TREES, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
+ kFastDuration)); |
+} |
- scheduler_->SetImplLatencyTakesPriority(true); |
- scheduler_->SetNeedsBeginMainFrame(); |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BNS) { |
+ EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
+ SAME_PRIORITY_FOR_BOTH_TREES, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
+ kSlowDuration)); |
+} |
- client_->Reset(); |
- EXPECT_FALSE(client_->last_begin_main_frame_args().IsValid()); |
- EXPECT_SCOPED(AdvanceFrame()); |
- EXPECT_TRUE(client_->last_begin_main_frame_args().IsValid()); |
- EXPECT_FALSE(client_->last_begin_main_frame_args().on_critical_path); |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BHF) { |
+ EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
+ SAME_PRIORITY_FOR_BOTH_TREES, |
+ ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kFastDuration)); |
+} |
+ |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BHS) { |
+ EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
+ SAME_PRIORITY_FOR_BOTH_TREES, |
+ ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); |
+} |
+ |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_ANF) { |
+ EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
+ kFastDuration)); |
+} |
+ |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_ANS) { |
+ EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
+ kSlowDuration)); |
+} |
+ |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHF) { |
+ EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kFastDuration)); |
+} |
+ |
+TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { |
+ EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
+ SMOOTHNESS_TAKES_PRIORITY, |
+ ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); |
} |
} // namespace |