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 base::TimeTicks() + base::TimeDelta::FromMicroseconds(5000))); |
21 | |
22 user_model_.reset(new UserModel()); | 21 user_model_.reset(new UserModel()); |
23 } | 22 } |
24 | 23 |
25 protected: | 24 protected: |
26 static base::TimeDelta priority_escalation_after_input_duration() { | 25 static base::TimeDelta priority_escalation_after_input_duration() { |
27 return base::TimeDelta::FromMilliseconds( | 26 return base::TimeDelta::FromMilliseconds( |
28 UserModel::kGestureEstimationLimitMillis); | 27 UserModel::kGestureEstimationLimitMillis); |
29 } | 28 } |
30 | 29 |
31 static base::TimeDelta subsequent_input_expected_after_input_duration() { | 30 static base::TimeDelta subsequent_input_expected_after_input_duration() { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 UserModel::kMedianGestureDurationMillis * 2)); | 244 UserModel::kMedianGestureDurationMillis * 2)); |
246 clock_->Advance(delta); | 245 clock_->Advance(delta); |
247 | 246 |
248 base::TimeDelta prediction_valid_duration; | 247 base::TimeDelta prediction_valid_duration; |
249 EXPECT_FALSE(user_model_->IsGestureExpectedToContinue( | 248 EXPECT_FALSE(user_model_->IsGestureExpectedToContinue( |
250 clock_->NowTicks(), &prediction_valid_duration)); | 249 clock_->NowTicks(), &prediction_valid_duration)); |
251 EXPECT_EQ(base::TimeDelta(), prediction_valid_duration); | 250 EXPECT_EQ(base::TimeDelta(), prediction_valid_duration); |
252 } | 251 } |
253 | 252 |
254 } // namespace scheduler | 253 } // namespace scheduler |
OLD | NEW |