| 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" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 | 15 |
| 16 class LogoutConfirmationControllerTest : public testing::Test { | 16 class LogoutConfirmationControllerTest : public testing::Test { |
| 17 protected: | 17 protected: |
| 18 LogoutConfirmationControllerTest(); | 18 LogoutConfirmationControllerTest(); |
| 19 virtual ~LogoutConfirmationControllerTest(); | 19 ~LogoutConfirmationControllerTest() override; |
| 20 | 20 |
| 21 void LogOut(); | 21 void LogOut(); |
| 22 | 22 |
| 23 bool log_out_called_; | 23 bool log_out_called_; |
| 24 | 24 |
| 25 scoped_refptr<base::TestMockTimeTaskRunner> runner_; | 25 scoped_refptr<base::TestMockTimeTaskRunner> runner_; |
| 26 base::ThreadTaskRunnerHandle runner_handle_; | 26 base::ThreadTaskRunnerHandle runner_handle_; |
| 27 | 27 |
| 28 LogoutConfirmationController controller_; | 28 LogoutConfirmationController controller_; |
| 29 | 29 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 controller_.ConfirmLogout( | 145 controller_.ConfirmLogout( |
| 146 runner_->GetCurrentMockTime() + base::TimeDelta::FromSeconds(10)); | 146 runner_->GetCurrentMockTime() + base::TimeDelta::FromSeconds(10)); |
| 147 EXPECT_FALSE(log_out_called_); | 147 EXPECT_FALSE(log_out_called_); |
| 148 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); | 148 runner_->FastForwardBy(base::TimeDelta::FromSeconds(9)); |
| 149 EXPECT_FALSE(log_out_called_); | 149 EXPECT_FALSE(log_out_called_); |
| 150 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); | 150 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); |
| 151 EXPECT_TRUE(log_out_called_); | 151 EXPECT_TRUE(log_out_called_); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace ash | 154 } // namespace ash |
| OLD | NEW |