OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
6 #include "platform/Timer.h" | 6 #include "platform/Timer.h" |
7 | 7 |
8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
9 #include "public/platform/WebScheduler.h" | 9 #include "public/platform/WebScheduler.h" |
10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 EXPECT_FLOAT_EQ(18.0, timer.nextFireInterval()); | 654 EXPECT_FLOAT_EQ(18.0, timer.nextFireInterval()); |
655 | 655 |
656 runUntilIdleOrDeadlinePassed(m_startTime + 50.0); | 656 runUntilIdleOrDeadlinePassed(m_startTime + 50.0); |
657 EXPECT_THAT(m_runTimes, ElementsAre(m_startTime + 20.0, m_startTime + 40.0))
; | 657 EXPECT_THAT(m_runTimes, ElementsAre(m_startTime + 20.0, m_startTime + 40.0))
; |
658 } | 658 } |
659 | 659 |
660 class MockTimerWithAlignment : public TimerBase { | 660 class MockTimerWithAlignment : public TimerBase { |
661 public: | 661 public: |
662 MockTimerWithAlignment() : m_lastFireTime(0.0), m_alignedFireTime(0.0) { } | 662 MockTimerWithAlignment() : m_lastFireTime(0.0), m_alignedFireTime(0.0) { } |
663 | 663 |
664 virtual void fired() override | 664 void fired() override |
665 { | 665 { |
666 } | 666 } |
667 | 667 |
668 double alignedFireTime(double fireTime) const override | 668 double alignedFireTime(double fireTime) const override |
669 { | 669 { |
670 m_lastFireTime = fireTime; | 670 m_lastFireTime = fireTime; |
671 return m_alignedFireTime; | 671 return m_alignedFireTime; |
672 } | 672 } |
673 | 673 |
674 void setAlignedFireTime(double alignedFireTime) | 674 void setAlignedFireTime(double alignedFireTime) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 timer.didChangeAlignmentInterval(monotonicallyIncreasingTime()); | 727 timer.didChangeAlignmentInterval(monotonicallyIncreasingTime()); |
728 | 728 |
729 EXPECT_FLOAT_EQ(0.0, timer.nextFireInterval()); | 729 EXPECT_FLOAT_EQ(0.0, timer.nextFireInterval()); |
730 EXPECT_FLOAT_EQ(0.0, timer.nextUnalignedFireInterval()); | 730 EXPECT_FLOAT_EQ(0.0, timer.nextUnalignedFireInterval()); |
731 EXPECT_FLOAT_EQ(m_startTime, timer.lastFireTime()); | 731 EXPECT_FLOAT_EQ(m_startTime, timer.lastFireTime()); |
732 } | 732 } |
733 | 733 |
734 | 734 |
735 } // namespace | 735 } // namespace |
736 } // namespace blink | 736 } // namespace blink |
OLD | NEW |