Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 1 | // Copyright (c) 2014 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include <gtest/gtest.h> |
| 6 | |
Gilad Arnold | 5ef9c48 | 2014-03-03 13:51:02 -0800 | [diff] [blame] | 7 | #include "update_engine/fake_clock.h" |
| 8 | #include "update_engine/mock_dbus_wrapper.h" |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 9 | #include "update_engine/policy_manager/real_state.h" |
| 10 | #include "update_engine/policy_manager/pmtest_utils.h" |
| 11 | |
Gilad Arnold | 5ef9c48 | 2014-03-03 13:51:02 -0800 | [diff] [blame] | 12 | using chromeos_update_engine::FakeClock; |
| 13 | using chromeos_update_engine::MockDBusWrapper; |
| 14 | using testing::_; |
| 15 | using testing::NiceMock; |
| 16 | using testing::Return; |
| 17 | |
| 18 | namespace { |
| 19 | |
| 20 | DBusGConnection* const kFakeConnection = reinterpret_cast<DBusGConnection*>(1); |
| 21 | |
| 22 | } // namespace |
| 23 | |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 24 | namespace chromeos_policy_manager { |
| 25 | |
| 26 | TEST(PmRealStateTest, InitTest) { |
Gilad Arnold | 5ef9c48 | 2014-03-03 13:51:02 -0800 | [diff] [blame] | 27 | NiceMock<MockDBusWrapper> mock_dbus; |
| 28 | FakeClock fake_clock; |
| 29 | EXPECT_CALL(mock_dbus, BusGet(_, _)).WillOnce(Return(kFakeConnection)); |
| 30 | RealState state(&mock_dbus, &fake_clock); |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 31 | EXPECT_TRUE(state.Init()); |
| 32 | // Check that the providers are being initialized. |
| 33 | PMTEST_ASSERT_NOT_NULL(state.random_provider()); |
Alex Deymo | 540d942 | 2014-02-27 11:17:31 -0800 | [diff] [blame] | 34 | PMTEST_EXPECT_NOT_NULL(state.random_provider()->var_seed()); |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | } // namespace chromeos_policy_manager |