| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/test/test_mock_time_task_runner.h" | 10 #include "base/test/test_mock_time_task_runner.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 LogoutConfirmationControllerTest::LogoutConfirmationControllerTest() | 35 LogoutConfirmationControllerTest::LogoutConfirmationControllerTest() |
| 36 : log_out_called_(false), | 36 : log_out_called_(false), |
| 37 runner_(new base::TestMockTimeTaskRunner), | 37 runner_(new base::TestMockTimeTaskRunner), |
| 38 runner_handle_(runner_), | 38 runner_handle_(runner_), |
| 39 controller_(base::Bind(&LogoutConfirmationControllerTest::LogOut, | 39 controller_(base::Bind(&LogoutConfirmationControllerTest::LogOut, |
| 40 base::Unretained(this))) { | 40 base::Unretained(this))) { |
| 41 controller_.SetClockForTesting(runner_->GetMockTickClock()); | 41 controller_.SetClockForTesting(runner_->GetMockTickClock()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 LogoutConfirmationControllerTest::~LogoutConfirmationControllerTest() { | 44 LogoutConfirmationControllerTest::~LogoutConfirmationControllerTest() {} |
| 45 } | |
| 46 | 45 |
| 47 void LogoutConfirmationControllerTest::LogOut() { | 46 void LogoutConfirmationControllerTest::LogOut() { |
| 48 log_out_called_ = true; | 47 log_out_called_ = true; |
| 49 } | 48 } |
| 50 | 49 |
| 51 // Verifies that the user is logged out immediately if logout confirmation with | 50 // Verifies that the user is logged out immediately if logout confirmation with |
| 52 // a zero-length countdown is requested. | 51 // a zero-length countdown is requested. |
| 53 TEST_F(LogoutConfirmationControllerTest, ZeroDuration) { | 52 TEST_F(LogoutConfirmationControllerTest, ZeroDuration) { |
| 54 controller_.ConfirmLogout(runner_->NowTicks()); | 53 controller_.ConfirmLogout(runner_->NowTicks()); |
| 55 EXPECT_FALSE(log_out_called_); | 54 EXPECT_FALSE(log_out_called_); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 controller_.ConfirmLogout(runner_->NowTicks() + | 145 controller_.ConfirmLogout(runner_->NowTicks() + |
| 147 base::TimeDelta::FromSeconds(10)); | 146 base::TimeDelta::FromSeconds(10)); |
| 148 EXPECT_FALSE(log_out_called_); | 147 EXPECT_FALSE(log_out_called_); |
| 149 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); | 148 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); |
| 150 EXPECT_FALSE(log_out_called_); | 149 EXPECT_FALSE(log_out_called_); |
| 151 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); | 150 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); |
| 152 EXPECT_TRUE(log_out_called_); | 151 EXPECT_TRUE(log_out_called_); |
| 153 } | 152 } |
| 154 | 153 |
| 155 } // namespace ash | 154 } // namespace ash |
| OLD | NEW |