| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/session_length_limiter.h" | 5 #include "chrome/browser/chromeos/session_length_limiter.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 bool MockTimeSingleThreadTaskRunner::TemporalOrder::operator()( | 179 bool MockTimeSingleThreadTaskRunner::TemporalOrder::operator()( |
| 180 const std::pair<base::TimeTicks, base::Closure>& first_task, | 180 const std::pair<base::TimeTicks, base::Closure>& first_task, |
| 181 const std::pair<base::TimeTicks, base::Closure>& second_task) const { | 181 const std::pair<base::TimeTicks, base::Closure>& second_task) const { |
| 182 return first_task.first >= second_task.first; | 182 return first_task.first >= second_task.first; |
| 183 } | 183 } |
| 184 | 184 |
| 185 MockTimeSingleThreadTaskRunner::~MockTimeSingleThreadTaskRunner() { | 185 MockTimeSingleThreadTaskRunner::~MockTimeSingleThreadTaskRunner() { |
| 186 } | 186 } |
| 187 | 187 |
| 188 SessionLengthLimiterTest::SessionLengthLimiterTest() : delegate_(NULL) { | 188 SessionLengthLimiterTest::SessionLengthLimiterTest() |
| 189 : user_activity_seen_(false), |
| 190 delegate_(NULL) { |
| 189 } | 191 } |
| 190 | 192 |
| 191 void SessionLengthLimiterTest::SetUp() { | 193 void SessionLengthLimiterTest::SetUp() { |
| 192 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 194 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
| 193 SessionLengthLimiter::RegisterPrefs(local_state_.registry()); | 195 SessionLengthLimiter::RegisterPrefs(local_state_.registry()); |
| 194 runner_ = new MockTimeSingleThreadTaskRunner; | 196 runner_ = new MockTimeSingleThreadTaskRunner; |
| 195 } | 197 } |
| 196 | 198 |
| 197 void SessionLengthLimiterTest::TearDown() { | 199 void SessionLengthLimiterTest::TearDown() { |
| 198 session_length_limiter_.reset(); | 200 session_length_limiter_.reset(); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 runner_->FastForwardBy(base::TimeDelta::FromSeconds(50)); | 841 runner_->FastForwardBy(base::TimeDelta::FromSeconds(50)); |
| 840 | 842 |
| 841 // Remove the session length limit. | 843 // Remove the session length limit. |
| 842 ClearSessionLengthLimitPref(); | 844 ClearSessionLengthLimitPref(); |
| 843 | 845 |
| 844 // Verify that no timer fires to terminate the session. | 846 // Verify that no timer fires to terminate the session. |
| 845 runner_->FastForwardUntilNoTasksRemain(); | 847 runner_->FastForwardUntilNoTasksRemain(); |
| 846 } | 848 } |
| 847 | 849 |
| 848 } // namespace chromeos | 850 } // namespace chromeos |
| OLD | NEW |