| 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 "base/test/simple_test_tick_clock.h" | 5 #include "base/test/simple_test_tick_clock.h" |
| 6 #include "components/scheduler/base/test_time_source.h" | 6 #include "components/scheduler/base/test_time_source.h" |
| 7 #include "components/scheduler/renderer/task_cost_estimator.h" | 7 #include "components/scheduler/renderer/task_cost_estimator.h" |
| 8 | 8 |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace scheduler { | 12 namespace scheduler { |
| 13 | 13 |
| 14 class TaskCostEstimatorTest : public testing::Test { | 14 class TaskCostEstimatorTest : public testing::Test { |
| 15 public: | 15 public: |
| 16 TaskCostEstimatorTest() {} | 16 TaskCostEstimatorTest() : clock_(base::TimeTicks()) {} |
| 17 ~TaskCostEstimatorTest() override {} | 17 ~TaskCostEstimatorTest() override {} |
| 18 | 18 |
| 19 void SetUp() override { | 19 void SetUp() override { |
| 20 test_time_source_.reset(new TestTimeSource(&clock_)); | 20 test_time_source_.reset(new TestTimeSource(&clock_)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 base::SimpleTestTickClock clock_; | 23 base::SimpleTestTickClock clock_; |
| 24 scoped_ptr<TestTimeSource> test_time_source_; | 24 scoped_ptr<TestTimeSource> test_time_source_; |
| 25 }; | 25 }; |
| 26 | 26 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 clock_.Advance(base::TimeDelta::FromMilliseconds(500)); | 69 clock_.Advance(base::TimeDelta::FromMilliseconds(500)); |
| 70 estimator.DidProcessTask(task); | 70 estimator.DidProcessTask(task); |
| 71 clock_.Advance(base::TimeDelta::FromMilliseconds(500)); | 71 clock_.Advance(base::TimeDelta::FromMilliseconds(500)); |
| 72 estimator.DidProcessTask(task); | 72 estimator.DidProcessTask(task); |
| 73 | 73 |
| 74 EXPECT_EQ(base::TimeDelta::FromMilliseconds(1000), | 74 EXPECT_EQ(base::TimeDelta::FromMilliseconds(1000), |
| 75 estimator.expected_task_duration()); | 75 estimator.expected_task_duration()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace scheduler | 78 } // namespace scheduler |
| OLD | NEW |