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 "platform/wtf/CurrentTime.h" | 8 #include "platform/wtf/CurrentTime.h" |
9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ~MockPlatform() override {} | 61 ~MockPlatform() override {} |
62 WebThread* CurrentThread() override { return &thread_; } | 62 WebThread* CurrentThread() override { return &thread_; } |
63 | 63 |
64 private: | 64 private: |
65 MockThread thread_; | 65 MockThread thread_; |
66 DISALLOW_COPY_AND_ASSIGN(MockPlatform); | 66 DISALLOW_COPY_AND_ASSIGN(MockPlatform); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace | 69 } // namespace |
70 | 70 |
71 class IdleDeadlineTest : public testing::Test { | 71 class IdleDeadlineTest : public ::testing::Test { |
72 public: | 72 public: |
73 void SetUp() override { | 73 void SetUp() override { |
74 original_time_function_ = SetTimeFunctionsForTesting([] { return 1.0; }); | 74 original_time_function_ = SetTimeFunctionsForTesting([] { return 1.0; }); |
75 } | 75 } |
76 | 76 |
77 void TearDown() override { | 77 void TearDown() override { |
78 SetTimeFunctionsForTesting(original_time_function_); | 78 SetTimeFunctionsForTesting(original_time_function_); |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
(...skipping 15 matching lines...) Expand all Loading... |
97 | 97 |
98 TEST_F(IdleDeadlineTest, yieldForHighPriorityWork) { | 98 TEST_F(IdleDeadlineTest, yieldForHighPriorityWork) { |
99 ScopedTestingPlatformSupport<MockPlatform> platform; | 99 ScopedTestingPlatformSupport<MockPlatform> platform; |
100 | 100 |
101 IdleDeadline* deadline = | 101 IdleDeadline* deadline = |
102 IdleDeadline::Create(1.25, IdleDeadline::CallbackType::kCalledWhenIdle); | 102 IdleDeadline::Create(1.25, IdleDeadline::CallbackType::kCalledWhenIdle); |
103 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); | 103 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); |
104 } | 104 } |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
OLD | NEW |