OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 #define EXPECT_SCOPED(statements) \ | 39 #define EXPECT_SCOPED(statements) \ |
40 { \ | 40 { \ |
41 SCOPED_TRACE(""); \ | 41 SCOPED_TRACE(""); \ |
42 statements; \ | 42 statements; \ |
43 } | 43 } |
44 | 44 |
45 namespace cc { | 45 namespace cc { |
46 namespace { | 46 namespace { |
47 | 47 |
| 48 base::TimeDelta kSlowDuration = base::TimeDelta::FromSeconds(1); |
| 49 base::TimeDelta kFastDuration = base::TimeDelta::FromMilliseconds(1); |
| 50 |
48 class FakeSchedulerClient : public SchedulerClient { | 51 class FakeSchedulerClient : public SchedulerClient { |
49 public: | 52 public: |
50 FakeSchedulerClient() | 53 FakeSchedulerClient() |
51 : automatic_swap_ack_(true), | 54 : automatic_swap_ack_(true), |
52 scheduler_(nullptr) { | 55 scheduler_(nullptr) { |
53 Reset(); | 56 Reset(); |
54 } | 57 } |
55 | 58 |
56 void Reset() { | 59 void Reset() { |
57 actions_.clear(); | 60 actions_.clear(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 fake_compositor_timing_history_ = fake_compositor_timing_history.get(); | 272 fake_compositor_timing_history_ = fake_compositor_timing_history.get(); |
270 | 273 |
271 scheduler_ = TestScheduler::Create( | 274 scheduler_ = TestScheduler::Create( |
272 now_src_.get(), client_.get(), scheduler_settings_, 0, | 275 now_src_.get(), client_.get(), scheduler_settings_, 0, |
273 task_runner_.get(), fake_external_begin_frame_source_.get(), | 276 task_runner_.get(), fake_external_begin_frame_source_.get(), |
274 fake_compositor_timing_history.Pass()); | 277 fake_compositor_timing_history.Pass()); |
275 DCHECK(scheduler_); | 278 DCHECK(scheduler_); |
276 client_->set_scheduler(scheduler_.get()); | 279 client_->set_scheduler(scheduler_.get()); |
277 | 280 |
278 // Use large estimates by default to avoid latency recovery in most tests. | 281 // Use large estimates by default to avoid latency recovery in most tests. |
279 base::TimeDelta slow_duration = base::TimeDelta::FromSeconds(1); | 282 fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
280 fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); | |
281 | 283 |
282 return scheduler_.get(); | 284 return scheduler_.get(); |
283 } | 285 } |
284 | 286 |
285 void CreateSchedulerAndInitSurface() { | 287 void CreateSchedulerAndInitSurface() { |
286 CreateScheduler(); | 288 CreateScheduler(); |
287 EXPECT_SCOPED(InitializeOutputSurfaceAndFirstCommit()); | 289 EXPECT_SCOPED(InitializeOutputSurfaceAndFirstCommit()); |
288 } | 290 } |
289 | 291 |
290 void SetUpScheduler(bool initSurface) { | 292 void SetUpScheduler(bool initSurface) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 419 } |
418 | 420 |
419 void CheckMainFrameSkippedAfterLateCommit(bool expect_send_begin_main_frame); | 421 void CheckMainFrameSkippedAfterLateCommit(bool expect_send_begin_main_frame); |
420 void ImplFrameSkippedAfterLateSwapAck(bool swap_ack_before_deadline); | 422 void ImplFrameSkippedAfterLateSwapAck(bool swap_ack_before_deadline); |
421 void ImplFrameIsNotSkippedAfterLateSwapAck(); | 423 void ImplFrameIsNotSkippedAfterLateSwapAck(); |
422 void BeginFramesNotFromClient(bool use_external_begin_frame_source, | 424 void BeginFramesNotFromClient(bool use_external_begin_frame_source, |
423 bool throttle_frame_production); | 425 bool throttle_frame_production); |
424 void BeginFramesNotFromClient_SwapThrottled( | 426 void BeginFramesNotFromClient_SwapThrottled( |
425 bool use_external_begin_frame_source, | 427 bool use_external_begin_frame_source, |
426 bool throttle_frame_production); | 428 bool throttle_frame_production); |
| 429 bool BeginMainFrameOnCriticalPath(TreePriority tree_priority, |
| 430 ScrollHandlerState scroll_handler_state, |
| 431 base::TimeDelta durations); |
427 | 432 |
428 scoped_ptr<base::SimpleTestTickClock> now_src_; | 433 scoped_ptr<base::SimpleTestTickClock> now_src_; |
429 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; | 434 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; |
430 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source_; | 435 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source_; |
431 SchedulerSettings scheduler_settings_; | 436 SchedulerSettings scheduler_settings_; |
432 scoped_ptr<FakeSchedulerClient> client_; | 437 scoped_ptr<FakeSchedulerClient> client_; |
433 scoped_ptr<TestScheduler> scheduler_; | 438 scoped_ptr<TestScheduler> scheduler_; |
434 FakeCompositorTimingHistory* fake_compositor_timing_history_; | 439 FakeCompositorTimingHistory* fake_compositor_timing_history_; |
435 }; | 440 }; |
436 | 441 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 client_->Reset(); | 483 client_->Reset(); |
479 EXPECT_SCOPED(AdvanceFrame()); | 484 EXPECT_SCOPED(AdvanceFrame()); |
480 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 485 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
481 } | 486 } |
482 | 487 |
483 TEST_F(SchedulerTest, SendBeginFramesToChildrenDeadlineNotAdjusted) { | 488 TEST_F(SchedulerTest, SendBeginFramesToChildrenDeadlineNotAdjusted) { |
484 // Set up client with specified estimates. | 489 // Set up client with specified estimates. |
485 scheduler_settings_.use_external_begin_frame_source = true; | 490 scheduler_settings_.use_external_begin_frame_source = true; |
486 SetUpScheduler(true); | 491 SetUpScheduler(true); |
487 | 492 |
488 fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate( | 493 fake_compositor_timing_history_ |
489 base::TimeDelta::FromMilliseconds(2)); | 494 ->SetBeginMainFrameStartToCommitDurationEstimate( |
| 495 base::TimeDelta::FromMilliseconds(2)); |
490 fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( | 496 fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( |
491 base::TimeDelta::FromMilliseconds(4)); | 497 base::TimeDelta::FromMilliseconds(4)); |
492 fake_compositor_timing_history_->SetDrawDurationEstimate( | 498 fake_compositor_timing_history_->SetDrawDurationEstimate( |
493 base::TimeDelta::FromMilliseconds(1)); | 499 base::TimeDelta::FromMilliseconds(1)); |
494 | 500 |
495 EXPECT_FALSE(client_->needs_begin_frames()); | 501 EXPECT_FALSE(client_->needs_begin_frames()); |
496 scheduler_->SetChildrenNeedBeginFrames(true); | 502 scheduler_->SetChildrenNeedBeginFrames(true); |
497 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 503 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
498 EXPECT_TRUE(client_->needs_begin_frames()); | 504 EXPECT_TRUE(client_->needs_begin_frames()); |
499 | 505 |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1380 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1375 | 1381 |
1376 client_->Reset(); | 1382 client_->Reset(); |
1377 scheduler_->SetNeedsBeginMainFrame(); | 1383 scheduler_->SetNeedsBeginMainFrame(); |
1378 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1384 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1379 EXPECT_SCOPED(AdvanceFrame()); | 1385 EXPECT_SCOPED(AdvanceFrame()); |
1380 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1386 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1381 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 1387 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
1382 EXPECT_EQ(expect_send_begin_main_frame, | 1388 EXPECT_EQ(expect_send_begin_main_frame, |
1383 scheduler_->MainThreadMissedLastDeadline()); | 1389 scheduler_->MainThreadMissedLastDeadline()); |
| 1390 EXPECT_TRUE(client_->HasAction("WillBeginImplFrame")); |
1384 EXPECT_EQ(expect_send_begin_main_frame, | 1391 EXPECT_EQ(expect_send_begin_main_frame, |
1385 client_->HasAction("ScheduledActionSendBeginMainFrame")); | 1392 client_->HasAction("ScheduledActionSendBeginMainFrame")); |
1386 } | 1393 } |
1387 | 1394 |
1388 TEST_F(SchedulerTest, MainFrameSkippedAfterLateCommit) { | 1395 TEST_F(SchedulerTest, MainFrameSkippedAfterLateCommit) { |
1389 scheduler_settings_.use_external_begin_frame_source = true; | 1396 scheduler_settings_.use_external_begin_frame_source = true; |
1390 SetUpScheduler(true); | 1397 SetUpScheduler(true); |
1391 | 1398 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1392 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | |
1393 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | |
1394 | 1399 |
1395 bool expect_send_begin_main_frame = false; | 1400 bool expect_send_begin_main_frame = false; |
1396 EXPECT_SCOPED( | 1401 EXPECT_SCOPED( |
1397 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); | 1402 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
1398 } | 1403 } |
1399 | 1404 |
| 1405 // Response times of BeginMainFrame's without the critical path flag set |
| 1406 // should not affect whether we recover latency or not. |
| 1407 TEST_F( |
| 1408 SchedulerTest, |
| 1409 MainFrameSkippedAfterLateCommit_LongBeginMainFrameQueueDurationNotCritical)
{ |
| 1410 scheduler_settings_.use_external_begin_frame_source = true; |
| 1411 SetUpScheduler(true); |
| 1412 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
| 1413 fake_compositor_timing_history_ |
| 1414 ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
| 1415 |
| 1416 bool expect_send_begin_main_frame = false; |
| 1417 EXPECT_SCOPED( |
| 1418 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
| 1419 } |
| 1420 |
| 1421 // Response times of BeginMainFrame's with the critical path flag set |
| 1422 // should affect whether we recover latency or not. |
| 1423 TEST_F( |
| 1424 SchedulerTest, |
| 1425 MainFrameNotSkippedAfterLateCommit_LongBeginMainFrameQueueDurationCritical)
{ |
| 1426 scheduler_settings_.use_external_begin_frame_source = true; |
| 1427 SetUpScheduler(true); |
| 1428 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
| 1429 fake_compositor_timing_history_ |
| 1430 ->SetBeginMainFrameQueueDurationCriticalEstimate(kSlowDuration); |
| 1431 fake_compositor_timing_history_ |
| 1432 ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
| 1433 |
| 1434 bool expect_send_begin_main_frame = true; |
| 1435 EXPECT_SCOPED( |
| 1436 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
| 1437 } |
| 1438 |
1400 TEST_F(SchedulerTest, | 1439 TEST_F(SchedulerTest, |
1401 MainFrameNotSkippedAfterLateCommitInPreferImplLatencyMode) { | 1440 MainFrameNotSkippedAfterLateCommitInPreferImplLatencyMode) { |
1402 scheduler_settings_.use_external_begin_frame_source = true; | 1441 scheduler_settings_.use_external_begin_frame_source = true; |
1403 SetUpScheduler(true); | 1442 SetUpScheduler(true); |
1404 scheduler_->SetImplLatencyTakesPriority(true); | 1443 scheduler_->SetSmoothnessMode(SMOOTHNESS_TAKES_PRIORITY, |
1405 | 1444 SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
1406 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1445 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1407 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | |
1408 | 1446 |
1409 bool expect_send_begin_main_frame = true; | 1447 bool expect_send_begin_main_frame = true; |
1410 EXPECT_SCOPED( | 1448 EXPECT_SCOPED( |
1411 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); | 1449 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
1412 } | 1450 } |
1413 | 1451 |
1414 TEST_F(SchedulerTest, | 1452 TEST_F(SchedulerTest, |
1415 MainFrameNotSkippedAfterLateCommit_CommitEstimateTooLong) { | 1453 MainFrameNotSkippedAfterLateCommit_CommitEstimateTooLong) { |
1416 scheduler_settings_.use_external_begin_frame_source = true; | 1454 scheduler_settings_.use_external_begin_frame_source = true; |
1417 SetUpScheduler(true); | 1455 SetUpScheduler(true); |
1418 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1456 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1419 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | 1457 fake_compositor_timing_history_ |
1420 auto slow_duration = base::TimeDelta::FromSeconds(1); | 1458 ->SetBeginMainFrameStartToCommitDurationEstimate(kSlowDuration); |
1421 fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate( | |
1422 slow_duration); | |
1423 | 1459 |
1424 bool expect_send_begin_main_frame = true; | 1460 bool expect_send_begin_main_frame = true; |
1425 EXPECT_SCOPED( | 1461 EXPECT_SCOPED( |
1426 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); | 1462 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
1427 } | 1463 } |
1428 | 1464 |
1429 TEST_F(SchedulerTest, | 1465 TEST_F(SchedulerTest, |
1430 MainFrameNotSkippedAfterLateCommit_ReadyToActivateEstimateTooLong) { | 1466 MainFrameNotSkippedAfterLateCommit_ReadyToActivateEstimateTooLong) { |
1431 scheduler_settings_.use_external_begin_frame_source = true; | 1467 scheduler_settings_.use_external_begin_frame_source = true; |
1432 SetUpScheduler(true); | 1468 SetUpScheduler(true); |
1433 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1469 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1434 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | |
1435 auto slow_duration = base::TimeDelta::FromSeconds(1); | |
1436 fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( | 1470 fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( |
1437 slow_duration); | 1471 kSlowDuration); |
1438 | 1472 |
1439 bool expect_send_begin_main_frame = true; | 1473 bool expect_send_begin_main_frame = true; |
1440 EXPECT_SCOPED( | 1474 EXPECT_SCOPED( |
1441 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); | 1475 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
1442 } | 1476 } |
1443 | 1477 |
1444 TEST_F(SchedulerTest, | 1478 TEST_F(SchedulerTest, |
1445 MainFrameNotSkippedAfterLateCommit_ActivateEstimateTooLong) { | 1479 MainFrameNotSkippedAfterLateCommit_ActivateEstimateTooLong) { |
1446 scheduler_settings_.use_external_begin_frame_source = true; | 1480 scheduler_settings_.use_external_begin_frame_source = true; |
1447 SetUpScheduler(true); | 1481 SetUpScheduler(true); |
1448 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1482 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1449 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | 1483 fake_compositor_timing_history_->SetActivateDurationEstimate(kSlowDuration); |
1450 auto slow_duration = base::TimeDelta::FromSeconds(1); | |
1451 fake_compositor_timing_history_->SetActivateDurationEstimate(slow_duration); | |
1452 | 1484 |
1453 bool expect_send_begin_main_frame = true; | 1485 bool expect_send_begin_main_frame = true; |
1454 EXPECT_SCOPED( | 1486 EXPECT_SCOPED( |
1455 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); | 1487 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
1456 } | 1488 } |
1457 | 1489 |
1458 TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) { | 1490 TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) { |
1459 scheduler_settings_.use_external_begin_frame_source = true; | 1491 scheduler_settings_.use_external_begin_frame_source = true; |
1460 SetUpScheduler(true); | 1492 SetUpScheduler(true); |
1461 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1493 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1462 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | 1494 fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration); |
1463 auto slow_duration = base::TimeDelta::FromSeconds(1); | |
1464 fake_compositor_timing_history_->SetDrawDurationEstimate(slow_duration); | |
1465 | 1495 |
1466 bool expect_send_begin_main_frame = true; | 1496 bool expect_send_begin_main_frame = true; |
1467 EXPECT_SCOPED( | 1497 EXPECT_SCOPED( |
1468 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); | 1498 CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
1469 } | 1499 } |
1470 | 1500 |
1471 void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( | 1501 void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( |
1472 bool swap_ack_before_deadline) { | 1502 bool swap_ack_before_deadline) { |
1473 // To get into a high latency state, this test disables automatic swap acks. | 1503 // To get into a high latency state, this test disables automatic swap acks. |
1474 scheduler_->SetMaxSwapsPending(1); | 1504 scheduler_->SetMaxSwapsPending(1); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); | 1573 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 4); |
1544 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); | 1574 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 4); |
1545 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); | 1575 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 3, 4); |
1546 } | 1576 } |
1547 } | 1577 } |
1548 | 1578 |
1549 TEST_F(SchedulerTest, | 1579 TEST_F(SchedulerTest, |
1550 ImplFrameSkippedAfterLateSwapAck_FastEstimates_SwapAckThenDeadline) { | 1580 ImplFrameSkippedAfterLateSwapAck_FastEstimates_SwapAckThenDeadline) { |
1551 scheduler_settings_.use_external_begin_frame_source = true; | 1581 scheduler_settings_.use_external_begin_frame_source = true; |
1552 SetUpScheduler(true); | 1582 SetUpScheduler(true); |
1553 | 1583 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1554 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | |
1555 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | |
1556 | 1584 |
1557 bool swap_ack_before_deadline = true; | 1585 bool swap_ack_before_deadline = true; |
1558 EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); | 1586 EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
1559 } | 1587 } |
1560 | 1588 |
1561 TEST_F(SchedulerTest, | 1589 TEST_F(SchedulerTest, |
1562 ImplFrameSkippedAfterLateSwapAck_FastEstimates_DeadlineThenSwapAck) { | 1590 ImplFrameSkippedAfterLateSwapAck_FastEstimates_DeadlineThenSwapAck) { |
1563 scheduler_settings_.use_external_begin_frame_source = true; | 1591 scheduler_settings_.use_external_begin_frame_source = true; |
1564 SetUpScheduler(true); | 1592 SetUpScheduler(true); |
1565 | 1593 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1566 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | |
1567 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | |
1568 | 1594 |
1569 bool swap_ack_before_deadline = false; | 1595 bool swap_ack_before_deadline = false; |
1570 EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); | 1596 EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
| 1597 } |
| 1598 |
| 1599 TEST_F( |
| 1600 SchedulerTest, |
| 1601 ImplFrameSkippedAfterLateSwapAck_LongBeginMainFrameQueueDurationNotCritical)
{ |
| 1602 scheduler_settings_.use_external_begin_frame_source = true; |
| 1603 SetUpScheduler(true); |
| 1604 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
| 1605 fake_compositor_timing_history_ |
| 1606 ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
| 1607 |
| 1608 bool swap_ack_before_deadline = false; |
| 1609 EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
1571 } | 1610 } |
1572 | 1611 |
1573 TEST_F(SchedulerTest, | 1612 TEST_F(SchedulerTest, |
1574 ImplFrameSkippedAfterLateSwapAck_ImplLatencyTakesPriority) { | 1613 ImplFrameSkippedAfterLateSwapAck_ImplLatencyTakesPriority) { |
1575 scheduler_settings_.use_external_begin_frame_source = true; | 1614 scheduler_settings_.use_external_begin_frame_source = true; |
1576 SetUpScheduler(true); | 1615 SetUpScheduler(true); |
1577 | 1616 |
1578 // Even if every estimate related to the main thread is slow, we should | 1617 // Even if every estimate related to the main thread is slow, we should |
1579 // still expect to recover impl thread latency if the draw is fast and we | 1618 // still expect to recover impl thread latency if the draw is fast and we |
1580 // are in impl latency takes priority. | 1619 // are in impl latency takes priority. |
1581 scheduler_->SetImplLatencyTakesPriority(true); | 1620 scheduler_->SetSmoothnessMode(SMOOTHNESS_TAKES_PRIORITY, |
1582 auto slow_duration = base::TimeDelta::FromSeconds(1); | 1621 SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
1583 fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); | 1622 fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
1584 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1623 fake_compositor_timing_history_->SetDrawDurationEstimate(kFastDuration); |
1585 fake_compositor_timing_history_->SetDrawDurationEstimate(fast_duration); | |
1586 | 1624 |
1587 bool swap_ack_before_deadline = false; | 1625 bool swap_ack_before_deadline = false; |
1588 EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); | 1626 EXPECT_SCOPED(ImplFrameSkippedAfterLateSwapAck(swap_ack_before_deadline)); |
1589 } | 1627 } |
1590 | 1628 |
1591 TEST_F(SchedulerTest, | 1629 TEST_F(SchedulerTest, |
1592 ImplFrameSkippedAfterLateSwapAck_OnlyImplSideUpdatesExpected) { | 1630 ImplFrameSkippedAfterLateSwapAck_OnlyImplSideUpdatesExpected) { |
1593 // This tests that we recover impl thread latency when there are no commits. | 1631 // This tests that we recover impl thread latency when there are no commits. |
1594 scheduler_settings_.use_external_begin_frame_source = true; | 1632 scheduler_settings_.use_external_begin_frame_source = true; |
1595 SetUpScheduler(true); | 1633 SetUpScheduler(true); |
1596 | 1634 |
1597 // To get into a high latency state, this test disables automatic swap acks. | 1635 // To get into a high latency state, this test disables automatic swap acks. |
1598 scheduler_->SetMaxSwapsPending(1); | 1636 scheduler_->SetMaxSwapsPending(1); |
1599 client_->SetAutomaticSwapAck(false); | 1637 client_->SetAutomaticSwapAck(false); |
1600 | 1638 |
1601 // Even if every estimate related to the main thread is slow, we should | 1639 // Even if every estimate related to the main thread is slow, we should |
1602 // still expect to recover impl thread latency if there are no commits from | 1640 // still expect to recover impl thread latency if there are no commits from |
1603 // the main thread. | 1641 // the main thread. |
1604 auto slow_duration = base::TimeDelta::FromSeconds(1); | 1642 fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
1605 fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); | 1643 fake_compositor_timing_history_->SetDrawDurationEstimate(kFastDuration); |
1606 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | |
1607 fake_compositor_timing_history_->SetDrawDurationEstimate(fast_duration); | |
1608 | 1644 |
1609 // Draw and swap for first BeginFrame | 1645 // Draw and swap for first BeginFrame |
1610 client_->Reset(); | 1646 client_->Reset(); |
1611 scheduler_->SetNeedsRedraw(); | 1647 scheduler_->SetNeedsRedraw(); |
1612 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1648 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
1613 SendNextBeginFrame(); | 1649 SendNextBeginFrame(); |
1614 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 3); | 1650 EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 3); |
1615 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); | 1651 EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); |
1616 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 3); | 1652 EXPECT_ACTION("ScheduledActionAnimate", client_, 2, 3); |
1617 | 1653 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 | 1740 |
1705 // Verify that we don't skip the actions of the BeginImplFrame | 1741 // Verify that we don't skip the actions of the BeginImplFrame |
1706 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 5); | 1742 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 5); |
1707 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 5); | 1743 EXPECT_ACTION("ScheduledActionCommit", client_, 1, 5); |
1708 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 5); | 1744 EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 2, 5); |
1709 EXPECT_ACTION("ScheduledActionAnimate", client_, 3, 5); | 1745 EXPECT_ACTION("ScheduledActionAnimate", client_, 3, 5); |
1710 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); | 1746 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 4, 5); |
1711 } | 1747 } |
1712 } | 1748 } |
1713 | 1749 |
| 1750 TEST_F( |
| 1751 SchedulerTest, |
| 1752 ImplFrameIsNotSkippedAfterLateSwapAck_BeginMainFrameQueueDurationCriticalToo
Long) { |
| 1753 scheduler_settings_.use_external_begin_frame_source = true; |
| 1754 SetUpScheduler(true); |
| 1755 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
| 1756 fake_compositor_timing_history_ |
| 1757 ->SetBeginMainFrameQueueDurationCriticalEstimate(kSlowDuration); |
| 1758 fake_compositor_timing_history_ |
| 1759 ->SetBeginMainFrameQueueDurationNotCriticalEstimate(kSlowDuration); |
| 1760 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
| 1761 } |
| 1762 |
1714 TEST_F(SchedulerTest, | 1763 TEST_F(SchedulerTest, |
1715 ImplFrameIsNotSkippedAfterLateSwapAck_CommitEstimateTooLong) { | 1764 ImplFrameIsNotSkippedAfterLateSwapAck_CommitEstimateTooLong) { |
1716 scheduler_settings_.use_external_begin_frame_source = true; | 1765 scheduler_settings_.use_external_begin_frame_source = true; |
1717 SetUpScheduler(true); | 1766 SetUpScheduler(true); |
1718 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1767 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1719 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | 1768 fake_compositor_timing_history_ |
1720 auto slow_duration = base::TimeDelta::FromSeconds(1); | 1769 ->SetBeginMainFrameStartToCommitDurationEstimate(kSlowDuration); |
1721 fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate( | |
1722 slow_duration); | |
1723 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); | 1770 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
1724 } | 1771 } |
1725 | 1772 |
1726 TEST_F(SchedulerTest, | 1773 TEST_F(SchedulerTest, |
1727 ImplFrameIsNotSkippedAfterLateSwapAck_ReadyToActivateEstimateTooLong) { | 1774 ImplFrameIsNotSkippedAfterLateSwapAck_ReadyToActivateEstimateTooLong) { |
1728 scheduler_settings_.use_external_begin_frame_source = true; | 1775 scheduler_settings_.use_external_begin_frame_source = true; |
1729 SetUpScheduler(true); | 1776 SetUpScheduler(true); |
1730 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1777 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1731 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | |
1732 auto slow_duration = base::TimeDelta::FromSeconds(1); | |
1733 fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( | 1778 fake_compositor_timing_history_->SetCommitToReadyToActivateDurationEstimate( |
1734 slow_duration); | 1779 kSlowDuration); |
1735 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); | 1780 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
1736 } | 1781 } |
1737 | 1782 |
1738 TEST_F(SchedulerTest, | 1783 TEST_F(SchedulerTest, |
1739 ImplFrameIsNotSkippedAfterLateSwapAck_ActivateEstimateTooLong) { | 1784 ImplFrameIsNotSkippedAfterLateSwapAck_ActivateEstimateTooLong) { |
1740 scheduler_settings_.use_external_begin_frame_source = true; | 1785 scheduler_settings_.use_external_begin_frame_source = true; |
1741 SetUpScheduler(true); | 1786 SetUpScheduler(true); |
1742 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1787 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1743 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | 1788 fake_compositor_timing_history_->SetActivateDurationEstimate(kSlowDuration); |
1744 auto slow_duration = base::TimeDelta::FromSeconds(1); | |
1745 fake_compositor_timing_history_->SetActivateDurationEstimate(slow_duration); | |
1746 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); | 1789 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
1747 } | 1790 } |
1748 | 1791 |
1749 TEST_F(SchedulerTest, | 1792 TEST_F(SchedulerTest, |
1750 ImplFrameIsNotSkippedAfterLateSwapAck_DrawEstimateTooLong) { | 1793 ImplFrameIsNotSkippedAfterLateSwapAck_DrawEstimateTooLong) { |
1751 scheduler_settings_.use_external_begin_frame_source = true; | 1794 scheduler_settings_.use_external_begin_frame_source = true; |
1752 SetUpScheduler(true); | 1795 SetUpScheduler(true); |
1753 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1796 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1754 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | 1797 fake_compositor_timing_history_->SetDrawDurationEstimate(kSlowDuration); |
1755 auto slow_duration = base::TimeDelta::FromSeconds(1); | |
1756 fake_compositor_timing_history_->SetDrawDurationEstimate(slow_duration); | |
1757 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); | 1798 EXPECT_SCOPED(ImplFrameIsNotSkippedAfterLateSwapAck()); |
1758 } | 1799 } |
1759 | 1800 |
1760 TEST_F(SchedulerTest, | 1801 TEST_F(SchedulerTest, |
1761 MainFrameThenImplFrameSkippedAfterLateCommitAndLateSwapAck) { | 1802 MainFrameThenImplFrameSkippedAfterLateCommitAndLateSwapAck) { |
1762 // Set up client with custom estimates. | 1803 // Set up client with custom estimates. |
1763 // This test starts off with expensive estimates to prevent latency recovery | 1804 // This test starts off with expensive estimates to prevent latency recovery |
1764 // initially, then lowers the estimates to enable it once both the main | 1805 // initially, then lowers the estimates to enable it once both the main |
1765 // and impl threads are in a high latency mode. | 1806 // and impl threads are in a high latency mode. |
1766 scheduler_settings_.use_external_begin_frame_source = true; | 1807 scheduler_settings_.use_external_begin_frame_source = true; |
1767 SetUpScheduler(true); | 1808 SetUpScheduler(true); |
1768 | 1809 fake_compositor_timing_history_->SetAllEstimatesTo(kSlowDuration); |
1769 auto slow_duration = base::TimeDelta::FromSeconds(1); | |
1770 fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration); | |
1771 | 1810 |
1772 // To get into a high latency state, this test disables automatic swap acks. | 1811 // To get into a high latency state, this test disables automatic swap acks. |
1773 scheduler_->SetMaxSwapsPending(1); | 1812 scheduler_->SetMaxSwapsPending(1); |
1774 client_->SetAutomaticSwapAck(false); | 1813 client_->SetAutomaticSwapAck(false); |
1775 | 1814 |
1776 // Impl thread hits deadline before commit finishes to make | 1815 // Impl thread hits deadline before commit finishes to make |
1777 // MainThreadMissedLastDeadline true | 1816 // MainThreadMissedLastDeadline true |
1778 client_->Reset(); | 1817 client_->Reset(); |
1779 scheduler_->SetNeedsBeginMainFrame(); | 1818 scheduler_->SetNeedsBeginMainFrame(); |
1780 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); | 1819 EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 | 1861 |
1823 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 1862 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
1824 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 2); | 1863 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 2); |
1825 // Note: BeginMainFrame and swap are skipped here because of | 1864 // Note: BeginMainFrame and swap are skipped here because of |
1826 // swap ack backpressure, not because of latency recovery. | 1865 // swap ack backpressure, not because of latency recovery. |
1827 EXPECT_FALSE(client_->HasAction("ScheduledActionSendBeginMainFrame")); | 1866 EXPECT_FALSE(client_->HasAction("ScheduledActionSendBeginMainFrame")); |
1828 EXPECT_FALSE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); | 1867 EXPECT_FALSE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible")); |
1829 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); | 1868 EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
1830 | 1869 |
1831 // Lower estimates so that the scheduler will attempt latency recovery. | 1870 // Lower estimates so that the scheduler will attempt latency recovery. |
1832 auto fast_duration = base::TimeDelta::FromMilliseconds(1); | 1871 fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
1833 fake_compositor_timing_history_->SetAllEstimatesTo(fast_duration); | |
1834 | 1872 |
1835 // Now that both threads are in a high latency mode, make sure we | 1873 // Now that both threads are in a high latency mode, make sure we |
1836 // skip the BeginMainFrame, then the BeginImplFrame, but not both | 1874 // skip the BeginMainFrame, then the BeginImplFrame, but not both |
1837 // at the same time. | 1875 // at the same time. |
1838 | 1876 |
1839 // Verify we skip BeginMainFrame first. | 1877 // Verify we skip BeginMainFrame first. |
1840 client_->Reset(); | 1878 client_->Reset(); |
1841 // Previous commit request is still outstanding. | 1879 // Previous commit request is still outstanding. |
1842 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); | 1880 EXPECT_TRUE(scheduler_->NeedsBeginMainFrame()); |
1843 EXPECT_TRUE(scheduler_->SwapThrottled()); | 1881 EXPECT_TRUE(scheduler_->SwapThrottled()); |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3479 EXPECT_SCOPED(AdvanceFrame()); | 3517 EXPECT_SCOPED(AdvanceFrame()); |
3480 | 3518 |
3481 // At the next BeginFrame, authoritative interval is used instead of previous | 3519 // At the next BeginFrame, authoritative interval is used instead of previous |
3482 // interval. | 3520 // interval. |
3483 EXPECT_NE(initial_interval, scheduler_->BeginImplFrameInterval()); | 3521 EXPECT_NE(initial_interval, scheduler_->BeginImplFrameInterval()); |
3484 EXPECT_EQ(authoritative_interval, scheduler_->BeginImplFrameInterval()); | 3522 EXPECT_EQ(authoritative_interval, scheduler_->BeginImplFrameInterval()); |
3485 } | 3523 } |
3486 | 3524 |
3487 TEST_F(SchedulerTest, ImplLatencyTakesPriority) { | 3525 TEST_F(SchedulerTest, ImplLatencyTakesPriority) { |
3488 SetUpScheduler(true); | 3526 SetUpScheduler(true); |
3489 scheduler_->SetImplLatencyTakesPriority(true); | 3527 |
| 3528 scheduler_->SetSmoothnessMode(SMOOTHNESS_TAKES_PRIORITY, |
| 3529 SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
| 3530 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
| 3531 EXPECT_TRUE(scheduler_->ImplLatencyTakesPriority()); |
| 3532 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
3490 EXPECT_TRUE(scheduler_->ImplLatencyTakesPriority()); | 3533 EXPECT_TRUE(scheduler_->ImplLatencyTakesPriority()); |
3491 | 3534 |
3492 scheduler_->SetImplLatencyTakesPriority(false); | 3535 scheduler_->SetSmoothnessMode(SMOOTHNESS_TAKES_PRIORITY, |
| 3536 SCROLL_AFFECTS_SCROLL_HANDLER); |
| 3537 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
| 3538 EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
| 3539 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
| 3540 EXPECT_TRUE(scheduler_->ImplLatencyTakesPriority()); |
| 3541 |
| 3542 scheduler_->SetSmoothnessMode(SAME_PRIORITY_FOR_BOTH_TREES, |
| 3543 SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER); |
| 3544 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
| 3545 EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
| 3546 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
| 3547 EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
| 3548 |
| 3549 scheduler_->SetSmoothnessMode(SAME_PRIORITY_FOR_BOTH_TREES, |
| 3550 SCROLL_AFFECTS_SCROLL_HANDLER); |
| 3551 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(true); |
| 3552 EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
| 3553 scheduler_->SetCriticalBeginMainFrameToActivateIsFast(false); |
3493 EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); | 3554 EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); |
3494 } | 3555 } |
3495 | 3556 |
3496 TEST_F(SchedulerTest, BeginMainFrameArgs_OnCriticalPath) { | 3557 // The three letters appeneded to each version of this test mean the following:s |
| 3558 // tree_priority: B = both trees same priority; A = active tree priority; |
| 3559 // scroll_handler_state: H = affects scroll handler; N = does not affect scroll |
| 3560 // handler; |
| 3561 // durations: F = fast durations; S = slow durations |
| 3562 bool SchedulerTest::BeginMainFrameOnCriticalPath( |
| 3563 TreePriority tree_priority, |
| 3564 ScrollHandlerState scroll_handler_state, |
| 3565 base::TimeDelta durations) { |
3497 scheduler_settings_.use_external_begin_frame_source = true; | 3566 scheduler_settings_.use_external_begin_frame_source = true; |
3498 SetUpScheduler(true); | 3567 SetUpScheduler(true); |
3499 | 3568 fake_compositor_timing_history_->SetAllEstimatesTo(durations); |
3500 scheduler_->SetImplLatencyTakesPriority(false); | 3569 client_->Reset(); |
| 3570 scheduler_->SetSmoothnessMode(tree_priority, scroll_handler_state); |
3501 scheduler_->SetNeedsBeginMainFrame(); | 3571 scheduler_->SetNeedsBeginMainFrame(); |
3502 | |
3503 client_->Reset(); | |
3504 EXPECT_FALSE(client_->last_begin_main_frame_args().IsValid()); | 3572 EXPECT_FALSE(client_->last_begin_main_frame_args().IsValid()); |
3505 EXPECT_SCOPED(AdvanceFrame()); | 3573 EXPECT_SCOPED(AdvanceFrame()); |
3506 EXPECT_TRUE(client_->last_begin_main_frame_args().IsValid()); | 3574 EXPECT_TRUE(client_->last_begin_main_frame_args().IsValid()); |
3507 EXPECT_TRUE(client_->last_begin_main_frame_args().on_critical_path); | 3575 return client_->last_begin_main_frame_args().on_critical_path; |
3508 } | 3576 } |
3509 | 3577 |
3510 TEST_F(SchedulerTest, BeginMainFrameArgs_NotOnCriticalPath) { | 3578 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BNF) { |
3511 scheduler_settings_.use_external_begin_frame_source = true; | 3579 EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
3512 SetUpScheduler(true); | 3580 SAME_PRIORITY_FOR_BOTH_TREES, SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
| 3581 kFastDuration)); |
| 3582 } |
3513 | 3583 |
3514 scheduler_->SetImplLatencyTakesPriority(true); | 3584 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BNS) { |
3515 scheduler_->SetNeedsBeginMainFrame(); | 3585 EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
| 3586 SAME_PRIORITY_FOR_BOTH_TREES, SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
| 3587 kSlowDuration)); |
| 3588 } |
3516 | 3589 |
3517 client_->Reset(); | 3590 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BHF) { |
3518 EXPECT_FALSE(client_->last_begin_main_frame_args().IsValid()); | 3591 EXPECT_TRUE(BeginMainFrameOnCriticalPath(SAME_PRIORITY_FOR_BOTH_TREES, |
3519 EXPECT_SCOPED(AdvanceFrame()); | 3592 SCROLL_AFFECTS_SCROLL_HANDLER, |
3520 EXPECT_TRUE(client_->last_begin_main_frame_args().IsValid()); | 3593 kFastDuration)); |
3521 EXPECT_FALSE(client_->last_begin_main_frame_args().on_critical_path); | 3594 } |
| 3595 |
| 3596 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_BHS) { |
| 3597 EXPECT_TRUE(BeginMainFrameOnCriticalPath(SAME_PRIORITY_FOR_BOTH_TREES, |
| 3598 SCROLL_AFFECTS_SCROLL_HANDLER, |
| 3599 kSlowDuration)); |
| 3600 } |
| 3601 |
| 3602 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_ANF) { |
| 3603 EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
| 3604 SMOOTHNESS_TAKES_PRIORITY, SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
| 3605 kFastDuration)); |
| 3606 } |
| 3607 |
| 3608 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_ANS) { |
| 3609 EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
| 3610 SMOOTHNESS_TAKES_PRIORITY, SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER, |
| 3611 kSlowDuration)); |
| 3612 } |
| 3613 |
| 3614 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHF) { |
| 3615 EXPECT_TRUE(BeginMainFrameOnCriticalPath( |
| 3616 SMOOTHNESS_TAKES_PRIORITY, SCROLL_AFFECTS_SCROLL_HANDLER, kFastDuration)); |
| 3617 } |
| 3618 |
| 3619 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { |
| 3620 EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
| 3621 SMOOTHNESS_TAKES_PRIORITY, SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); |
3522 } | 3622 } |
3523 | 3623 |
3524 } // namespace | 3624 } // namespace |
3525 } // namespace cc | 3625 } // namespace cc |
OLD | NEW |