| 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 15 matching lines...) Expand all Loading... |
| 26 void PostIdleTask(const WebTraceLocation&, WebThread::IdleTask*) override {} | 26 void PostIdleTask(const WebTraceLocation&, WebThread::IdleTask*) override {} |
| 27 void PostNonNestableIdleTask(const WebTraceLocation&, | 27 void PostNonNestableIdleTask(const WebTraceLocation&, |
| 28 WebThread::IdleTask*) override {} | 28 WebThread::IdleTask*) override {} |
| 29 std::unique_ptr<WebViewScheduler> CreateWebViewScheduler( | 29 std::unique_ptr<WebViewScheduler> CreateWebViewScheduler( |
| 30 InterventionReporter*, | 30 InterventionReporter*, |
| 31 WebViewScheduler::WebViewSchedulerSettings*) override { | 31 WebViewScheduler::WebViewSchedulerSettings*) override { |
| 32 return nullptr; | 32 return nullptr; |
| 33 } | 33 } |
| 34 void SuspendTimerQueue() override {} | 34 void SuspendTimerQueue() override {} |
| 35 void ResumeTimerQueue() override {} | 35 void ResumeTimerQueue() override {} |
| 36 void AddPendingNavigation(WebScheduler::NavigatingFrameType) override {} | 36 void AddPendingNavigation( |
| 37 void RemovePendingNavigation(WebScheduler::NavigatingFrameType) override {} | 37 scheduler::RendererScheduler::NavigatingFrameType) override {} |
| 38 void RemovePendingNavigation( |
| 39 scheduler::RendererScheduler::NavigatingFrameType) override {} |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(MockScheduler); | 42 DISALLOW_COPY_AND_ASSIGN(MockScheduler); |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 class MockThread final : public WebThread { | 45 class MockThread final : public WebThread { |
| 44 public: | 46 public: |
| 45 MockThread() {} | 47 MockThread() {} |
| 46 ~MockThread() override {} | 48 ~MockThread() override {} |
| 47 bool IsCurrentThread() const override { return true; } | 49 bool IsCurrentThread() const override { return true; } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 96 |
| 95 TEST_F(IdleDeadlineTest, yieldForHighPriorityWork) { | 97 TEST_F(IdleDeadlineTest, yieldForHighPriorityWork) { |
| 96 ScopedTestingPlatformSupport<MockPlatform> platform; | 98 ScopedTestingPlatformSupport<MockPlatform> platform; |
| 97 | 99 |
| 98 IdleDeadline* deadline = | 100 IdleDeadline* deadline = |
| 99 IdleDeadline::Create(1.25, IdleDeadline::CallbackType::kCalledWhenIdle); | 101 IdleDeadline::Create(1.25, IdleDeadline::CallbackType::kCalledWhenIdle); |
| 100 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); | 102 EXPECT_FLOAT_EQ(0, deadline->timeRemaining()); |
| 101 } | 103 } |
| 102 | 104 |
| 103 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |