| 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 "platform/Timer.h" | 5 #include "platform/Timer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "platform/scheduler/base/task_queue_impl.h" | 10 #include "platform/scheduler/base/task_queue_impl.h" |
| 11 #include "platform/scheduler/child/web_scheduler.h" | 11 #include "platform/scheduler/child/web_scheduler.h" |
| 12 #include "platform/scheduler/child/web_task_runner_impl.h" | 12 #include "platform/scheduler/child/web_task_runner_impl.h" |
| 13 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" | 13 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 14 #include "platform/scheduler/renderer/web_view_scheduler.h" | 14 #include "platform/scheduler/renderer/web_view_scheduler.h" |
| 15 #include "platform/testing/TestingPlatformSupport.h" | 15 #include "platform/testing/TestingPlatformSupport.h" |
| 16 #include "platform/wtf/CurrentTime.h" | 16 #include "platform/wtf/CurrentTime.h" |
| 17 #include "platform/wtf/PtrUtil.h" | 17 #include "platform/wtf/PtrUtil.h" |
| 18 #include "platform/wtf/RefCounted.h" | 18 #include "platform/wtf/RefCounted.h" |
| 19 #include "public/platform/Platform.h" | 19 #include "public/platform/Platform.h" |
| 20 #include "public/platform/WebThread.h" | 20 #include "public/platform/WebThread.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using testing::ElementsAre; | 24 using ::testing::ElementsAre; |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 class TimerTest : public testing::Test { | 29 class TimerTest : public ::testing::Test { |
| 30 public: | 30 public: |
| 31 void SetUp() override { | 31 void SetUp() override { |
| 32 run_times_.clear(); | 32 run_times_.clear(); |
| 33 platform_->AdvanceClockSeconds(10.0); | 33 platform_->AdvanceClockSeconds(10.0); |
| 34 start_time_ = MonotonicallyIncreasingTime(); | 34 start_time_ = MonotonicallyIncreasingTime(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void CountingTask(TimerBase*) { | 37 void CountingTask(TimerBase*) { |
| 38 run_times_.push_back(MonotonicallyIncreasingTime()); | 38 run_times_.push_back(MonotonicallyIncreasingTime()); |
| 39 } | 39 } |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 &TimerTest::CountingTask); | 722 &TimerTest::CountingTask); |
| 723 | 723 |
| 724 platform_->RunUntilIdle(); | 724 platform_->RunUntilIdle(); |
| 725 EXPECT_TRUE(!run_times_.size()); | 725 EXPECT_TRUE(!run_times_.size()); |
| 726 EXPECT_TRUE(task_runner1->IsEmpty()); | 726 EXPECT_TRUE(task_runner1->IsEmpty()); |
| 727 EXPECT_TRUE(task_runner2->IsEmpty()); | 727 EXPECT_TRUE(task_runner2->IsEmpty()); |
| 728 } | 728 } |
| 729 | 729 |
| 730 } // namespace | 730 } // namespace |
| 731 } // namespace blink | 731 } // namespace blink |
| OLD | NEW |