OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/system/chromeos/session/logout_confirmation_controller.h" | 5 #include "ash/system/chromeos/session/logout_confirmation_controller.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 TemporalOrder> tasks_; | 60 TemporalOrder> tasks_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(MockTimeSingleThreadTaskRunner); | 62 DISALLOW_COPY_AND_ASSIGN(MockTimeSingleThreadTaskRunner); |
63 }; | 63 }; |
64 | 64 |
65 // A base::TickClock that uses a MockTimeSingleThreadTaskRunner as the source of | 65 // A base::TickClock that uses a MockTimeSingleThreadTaskRunner as the source of |
66 // the current time. | 66 // the current time. |
67 class MockClock : public base::TickClock { | 67 class MockClock : public base::TickClock { |
68 public: | 68 public: |
69 explicit MockClock(scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner); | 69 explicit MockClock(scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner); |
70 virtual ~MockClock(); | |
71 | |
72 // base::TickClock: | 70 // base::TickClock: |
73 virtual base::TimeTicks NowTicks() override; | 71 virtual base::TimeTicks NowTicks() override; |
74 | 72 |
75 private: | 73 private: |
| 74 virtual ~MockClock(); |
| 75 |
76 scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner_; | 76 scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(MockClock); | 78 DISALLOW_COPY_AND_ASSIGN(MockClock); |
79 }; | 79 }; |
80 | 80 |
81 | 81 |
82 MockTimeSingleThreadTaskRunner::MockTimeSingleThreadTaskRunner() { | 82 MockTimeSingleThreadTaskRunner::MockTimeSingleThreadTaskRunner() { |
83 } | 83 } |
84 | 84 |
85 bool MockTimeSingleThreadTaskRunner::RunsTasksOnCurrentThread() const { | 85 bool MockTimeSingleThreadTaskRunner::RunsTasksOnCurrentThread() const { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 controller_.ConfirmLogout( | 281 controller_.ConfirmLogout( |
282 runner_->GetCurrentTime() + base::TimeDelta::FromSeconds(10)); | 282 runner_->GetCurrentTime() + base::TimeDelta::FromSeconds(10)); |
283 EXPECT_FALSE(log_out_called_); | 283 EXPECT_FALSE(log_out_called_); |
284 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); | 284 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); |
285 EXPECT_FALSE(log_out_called_); | 285 EXPECT_FALSE(log_out_called_); |
286 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); | 286 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); |
287 EXPECT_TRUE(log_out_called_); | 287 EXPECT_TRUE(log_out_called_); |
288 } | 288 } |
289 | 289 |
290 } // namespace ash | 290 } // namespace ash |
OLD | NEW |