blob: 0362688b15ed81b1f32b0420314f4e5bba5d14a9 [file] [log] [blame]
Alex Deymo2de23f52014-02-26 14:30:13 -08001// 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 Arnold308c1012014-03-12 15:37:06 -07007#include "update_engine/policy_manager/fake_random_provider.h"
8#include "update_engine/policy_manager/fake_shill_provider.h"
Gilad Arnold78a78112014-03-13 14:58:06 -07009#include "update_engine/policy_manager/fake_time_provider.h"
Alex Deymo2de23f52014-02-26 14:30:13 -080010#include "update_engine/policy_manager/real_state.h"
11#include "update_engine/policy_manager/pmtest_utils.h"
Gilad Arnold5ef9c482014-03-03 13:51:02 -080012
Alex Deymo2de23f52014-02-26 14:30:13 -080013namespace chromeos_policy_manager {
14
15TEST(PmRealStateTest, InitTest) {
Gilad Arnold78a78112014-03-13 14:58:06 -070016 RealState state(new FakeRandomProvider(), new FakeShillProvider(),
17 new FakeTimeProvider());
Alex Deymo2de23f52014-02-26 14:30:13 -080018 EXPECT_TRUE(state.Init());
Gilad Arnoldbeb39e92014-03-11 11:34:50 -070019
Gilad Arnold308c1012014-03-12 15:37:06 -070020 // 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 Deymo2de23f52014-02-26 14:30:13 -080023 PMTEST_ASSERT_NOT_NULL(state.random_provider());
Alex Deymo540d9422014-02-27 11:17:31 -080024 PMTEST_EXPECT_NOT_NULL(state.random_provider()->var_seed());
Gilad Arnold308c1012014-03-12 15:37:06 -070025 PMTEST_ASSERT_NOT_NULL(state.shill_provider());
26 PMTEST_EXPECT_NOT_NULL(state.shill_provider()->var_is_connected());
Gilad Arnold78a78112014-03-13 14:58:06 -070027 PMTEST_ASSERT_NOT_NULL(state.time_provider());
28 PMTEST_ASSERT_NOT_NULL(state.time_provider()->var_curr_date());
Alex Deymo2de23f52014-02-26 14:30:13 -080029}
30
31} // namespace chromeos_policy_manager