Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Side by Side Diff: components/scheduler/renderer/user_model_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698