| 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 "components/scheduler/renderer/user_model.h" | 5 #include "components/scheduler/renderer/user_model.h" |
| 6 | 6 |
| 7 #include "base/test/simple_test_tick_clock.h" | 7 #include "base/test/simple_test_tick_clock.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace scheduler { | 11 namespace scheduler { |
| 12 | 12 |
| 13 class UserModelTest : public testing::Test { | 13 class UserModelTest : public testing::Test { |
| 14 public: | 14 public: |
| 15 UserModelTest() {} | 15 UserModelTest() {} |
| 16 ~UserModelTest() override {} | 16 ~UserModelTest() override {} |
| 17 | 17 |
| 18 void SetUp() override { | 18 void SetUp() override { |
| 19 clock_.reset(new base::SimpleTestTickClock()); | 19 clock_.reset(new base::SimpleTestTickClock()); |
| 20 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); | 20 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); |
| 21 | 21 |
| 22 user_model_.reset(new UserModel()); | 22 user_model_.reset(new UserModel(NULL)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 static base::TimeDelta priority_escalation_after_input_duration() { | 26 static base::TimeDelta priority_escalation_after_input_duration() { |
| 27 return base::TimeDelta::FromMilliseconds( | 27 return base::TimeDelta::FromMilliseconds( |
| 28 UserModel::kGestureEstimationLimitMillis); | 28 UserModel::kGestureEstimationLimitMillis); |
| 29 } | 29 } |
| 30 | 30 |
| 31 static base::TimeDelta subsequent_input_expected_after_input_duration() { | 31 static base::TimeDelta subsequent_input_expected_after_input_duration() { |
| 32 return base::TimeDelta::FromMilliseconds( | 32 return base::TimeDelta::FromMilliseconds( |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 UserModel::kMedianGestureDurationMillis * 2)); | 245 UserModel::kMedianGestureDurationMillis * 2)); |
| 246 clock_->Advance(delta); | 246 clock_->Advance(delta); |
| 247 | 247 |
| 248 base::TimeDelta prediction_valid_duration; | 248 base::TimeDelta prediction_valid_duration; |
| 249 EXPECT_FALSE(user_model_->IsGestureExpectedToContinue( | 249 EXPECT_FALSE(user_model_->IsGestureExpectedToContinue( |
| 250 clock_->NowTicks(), &prediction_valid_duration)); | 250 clock_->NowTicks(), &prediction_valid_duration)); |
| 251 EXPECT_EQ(base::TimeDelta(), prediction_valid_duration); | 251 EXPECT_EQ(base::TimeDelta(), prediction_valid_duration); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace scheduler | 254 } // namespace scheduler |
| OLD | NEW |