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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
18 #include "base/time/tick_clock.h" | 18 #include "base/time/tick_clock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 namespace internal { | |
23 | |
24 namespace { | 22 namespace { |
25 | 23 |
26 // A SingleThreadTaskRunner that mocks the current time and allows it to be | 24 // A SingleThreadTaskRunner that mocks the current time and allows it to be |
27 // fast-forwarded. TODO(bartfab): Copies of this class exist in several tests. | 25 // fast-forwarded. TODO(bartfab): Copies of this class exist in several tests. |
28 // Consolidate them (crbug.com/329911). | 26 // Consolidate them (crbug.com/329911). |
29 class MockTimeSingleThreadTaskRunner : public base::SingleThreadTaskRunner { | 27 class MockTimeSingleThreadTaskRunner : public base::SingleThreadTaskRunner { |
30 public: | 28 public: |
31 MockTimeSingleThreadTaskRunner(); | 29 MockTimeSingleThreadTaskRunner(); |
32 | 30 |
33 // base::SingleThreadTaskRunner: | 31 // base::SingleThreadTaskRunner: |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 280 |
283 controller_.ConfirmLogout( | 281 controller_.ConfirmLogout( |
284 runner_->GetCurrentTime() + base::TimeDelta::FromSeconds(10)); | 282 runner_->GetCurrentTime() + base::TimeDelta::FromSeconds(10)); |
285 EXPECT_FALSE(log_out_called_); | 283 EXPECT_FALSE(log_out_called_); |
286 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); | 284 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); |
287 EXPECT_FALSE(log_out_called_); | 285 EXPECT_FALSE(log_out_called_); |
288 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); | 286 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); |
289 EXPECT_TRUE(log_out_called_); | 287 EXPECT_TRUE(log_out_called_); |
290 } | 288 } |
291 | 289 |
292 } // namespace internal | |
293 } // namespace ash | 290 } // namespace ash |
OLD | NEW |