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