| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/idle_timer.h" | 5 #include "base/idle_timer.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 using base::Time; |
| 10 using base::TimeDelta; |
| 9 using base::IdleTimer; | 11 using base::IdleTimer; |
| 10 | 12 |
| 11 namespace { | 13 namespace { |
| 12 | 14 |
| 13 // We Mock the GetLastInputInfo function to return | 15 // We Mock the GetLastInputInfo function to return |
| 14 // the time stored here. | 16 // the time stored here. |
| 15 static Time mock_timer_started; | 17 static Time mock_timer_started; |
| 16 | 18 |
| 17 bool MockIdleTimeSource(int32 *milliseconds_interval_since_last_event) { | 19 bool MockIdleTimeSource(int32 *milliseconds_interval_since_last_event) { |
| 18 TimeDelta delta = Time::Now() - mock_timer_started; | 20 TimeDelta delta = Time::Now() - mock_timer_started; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 224 |
| 223 test_task.Start(); | 225 test_task.Start(); |
| 224 MessageLoop::current()->Run(); | 226 MessageLoop::current()->Run(); |
| 225 | 227 |
| 226 reset_timer.Stop(); | 228 reset_timer.Stop(); |
| 227 | 229 |
| 228 EXPECT_EQ(test_task.get_idle_counter(), 0); | 230 EXPECT_EQ(test_task.get_idle_counter(), 0); |
| 229 } | 231 } |
| 230 | 232 |
| 231 } // namespace | 233 } // namespace |
| OLD | NEW |