| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/dom/IdleDeadline.h" | 5 #include "core/dom/IdleDeadline.h" |
| 6 | 6 |
| 7 #include "platform/testing/TestingPlatformSupport.h" | 7 #include "platform/testing/TestingPlatformSupport.h" |
| 8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "wtf/CurrentTime.h" | 10 #include "wtf/CurrentTime.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 EXPECT_FLOAT_EQ(249.995, deadline->timeRemaining()); | 68 EXPECT_FLOAT_EQ(249.995, deadline->timeRemaining()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 TEST_F(IdleDeadlineTest, deadlineInPast) { | 71 TEST_F(IdleDeadlineTest, deadlineInPast) { |
| 72 IdleDeadline* deadline = | 72 IdleDeadline* deadline = |
| 73 IdleDeadline::create(0.75, IdleDeadline::CallbackType::CalledWhenIdle); | 73 IdleDeadline::create(0.75, IdleDeadline::CallbackType::CalledWhenIdle); |
| 74 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); | 74 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 TEST_F(IdleDeadlineTest, yieldForHighPriorityWork) { | 77 TEST_F(IdleDeadlineTest, yieldForHighPriorityWork) { |
| 78 MockPlatform platform; | 78 ScopedTestingPlatformSupport<MockPlatform> platform(new MockPlatform); |
| 79 | 79 |
| 80 IdleDeadline* deadline = | 80 IdleDeadline* deadline = |
| 81 IdleDeadline::create(1.25, IdleDeadline::CallbackType::CalledWhenIdle); | 81 IdleDeadline::create(1.25, IdleDeadline::CallbackType::CalledWhenIdle); |
| 82 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); | 82 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |