| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return local_state_.HasPrefPath(prefs::kSessionUserActivitySeen); | 114 return local_state_.HasPrefPath(prefs::kSessionUserActivitySeen); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool SessionLengthLimiterTest::GetSessionUserActivitySeenPref() { | 117 bool SessionLengthLimiterTest::GetSessionUserActivitySeenPref() { |
| 118 EXPECT_TRUE(IsSessionUserActivitySeenPrefSet()); | 118 EXPECT_TRUE(IsSessionUserActivitySeenPrefSet()); |
| 119 return local_state_.GetBoolean(prefs::kSessionUserActivitySeen); | 119 return local_state_.GetBoolean(prefs::kSessionUserActivitySeen); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void SessionLengthLimiterTest::SetSessionStartTimePref( | 122 void SessionLengthLimiterTest::SetSessionStartTimePref( |
| 123 const base::TimeTicks& session_start_time) { | 123 const base::TimeTicks& session_start_time) { |
| 124 local_state_.SetUserPref( | 124 local_state_.SetUserPref(prefs::kSessionStartTime, |
| 125 prefs::kSessionStartTime, | 125 new base::Value(base::Int64ToString( |
| 126 new base::StringValue( | 126 session_start_time.ToInternalValue()))); |
| 127 base::Int64ToString(session_start_time.ToInternalValue()))); | |
| 128 } | 127 } |
| 129 | 128 |
| 130 void SessionLengthLimiterTest::ClearSessionStartTimePref() { | 129 void SessionLengthLimiterTest::ClearSessionStartTimePref() { |
| 131 local_state_.ClearPref(prefs::kSessionStartTime); | 130 local_state_.ClearPref(prefs::kSessionStartTime); |
| 132 } | 131 } |
| 133 | 132 |
| 134 bool SessionLengthLimiterTest::IsSessionStartTimePrefSet() { | 133 bool SessionLengthLimiterTest::IsSessionStartTimePrefSet() { |
| 135 return local_state_.HasPrefPath(prefs::kSessionStartTime); | 134 return local_state_.HasPrefPath(prefs::kSessionStartTime); |
| 136 } | 135 } |
| 137 | 136 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 runner_->FastForwardBy(base::TimeDelta::FromSeconds(50)); | 730 runner_->FastForwardBy(base::TimeDelta::FromSeconds(50)); |
| 732 | 731 |
| 733 // Remove the session length limit. | 732 // Remove the session length limit. |
| 734 ClearSessionLengthLimitPref(); | 733 ClearSessionLengthLimitPref(); |
| 735 | 734 |
| 736 // Verify that no timer fires to terminate the session. | 735 // Verify that no timer fires to terminate the session. |
| 737 runner_->FastForwardUntilNoTasksRemain(); | 736 runner_->FastForwardUntilNoTasksRemain(); |
| 738 } | 737 } |
| 739 | 738 |
| 740 } // namespace chromeos | 739 } // namespace chromeos |
| OLD | NEW |