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 | 308c101 | 2014-03-12 15:37:06 -0700 | [diff] [blame] | 7 | #include "update_engine/policy_manager/fake_random_provider.h" |
| 8 | #include "update_engine/policy_manager/fake_shill_provider.h" |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 9 | #include "update_engine/policy_manager/fake_time_provider.h" |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 10 | #include "update_engine/policy_manager/real_state.h" |
| 11 | #include "update_engine/policy_manager/pmtest_utils.h" |
Gilad Arnold | 5ef9c48 | 2014-03-03 13:51:02 -0800 | [diff] [blame] | 12 | |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 13 | namespace chromeos_policy_manager { |
| 14 | |
| 15 | TEST(PmRealStateTest, InitTest) { |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 16 | RealState state(new FakeRandomProvider(), new FakeShillProvider(), |
| 17 | new FakeTimeProvider()); |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 18 | EXPECT_TRUE(state.Init()); |
Gilad Arnold | beb39e9 | 2014-03-11 11:34:50 -0700 | [diff] [blame] | 19 | |
Gilad Arnold | 308c101 | 2014-03-12 15:37:06 -0700 | [diff] [blame] | 20 | // Check that the providers are being initialized. Beyond ensuring that we get |
| 21 | // non-null provider handles, verifying that we can get a single variable from |
| 22 | // each provider is enough of an indication that it has initialized. |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 23 | PMTEST_ASSERT_NOT_NULL(state.random_provider()); |
Alex Deymo | 540d942 | 2014-02-27 11:17:31 -0800 | [diff] [blame] | 24 | PMTEST_EXPECT_NOT_NULL(state.random_provider()->var_seed()); |
Gilad Arnold | 308c101 | 2014-03-12 15:37:06 -0700 | [diff] [blame] | 25 | PMTEST_ASSERT_NOT_NULL(state.shill_provider()); |
| 26 | PMTEST_EXPECT_NOT_NULL(state.shill_provider()->var_is_connected()); |
Gilad Arnold | 78a7811 | 2014-03-13 14:58:06 -0700 | [diff] [blame] | 27 | PMTEST_ASSERT_NOT_NULL(state.time_provider()); |
| 28 | PMTEST_ASSERT_NOT_NULL(state.time_provider()->var_curr_date()); |
Alex Deymo | 2de23f5 | 2014-02-26 14:30:13 -0800 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | } // namespace chromeos_policy_manager |