Rename the PolicyManager to UpdateManager.
This change renames the PolicyManager class, directory, tests, etc,
to avoid confusion with libpolicy and its classes.
BUG=chromium:373551
TEST=emerged on link.
CQ-DEPEND=CL:I43081673c7ba409f02273197da7915537bde39c6
Change-Id: Iffa76caa3b95ecbbdba87ab01006d1d8ce35a27f
Reviewed-on: https://chromium-review.googlesource.com/201876
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/SConstruct b/SConstruct
index bf65864..38c396e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -238,20 +238,6 @@
payload_generator/topological_sort.cc
payload_signer.cc
payload_state.cc
- policy_manager/boxed_value.cc
- policy_manager/chromeos_policy.cc
- policy_manager/evaluation_context.cc
- policy_manager/event_loop.cc
- policy_manager/policy.cc
- policy_manager/policy_manager.cc
- policy_manager/real_config_provider.cc
- policy_manager/real_device_policy_provider.cc
- policy_manager/real_random_provider.cc
- policy_manager/real_shill_provider.cc
- policy_manager/real_system_provider.cc
- policy_manager/real_time_provider.cc
- policy_manager/real_updater_provider.cc
- policy_manager/state_factory.cc
postinstall_runner_action.cc
prefs.cc
proxy_resolver.cc
@@ -261,6 +247,20 @@
terminator.cc
update_attempter.cc
update_check_scheduler.cc
+ update_manager/boxed_value.cc
+ update_manager/chromeos_policy.cc
+ update_manager/evaluation_context.cc
+ update_manager/event_loop.cc
+ update_manager/policy.cc
+ update_manager/real_config_provider.cc
+ update_manager/real_device_policy_provider.cc
+ update_manager/real_random_provider.cc
+ update_manager/real_shill_provider.cc
+ update_manager/real_system_provider.cc
+ update_manager/real_time_provider.cc
+ update_manager/real_updater_provider.cc
+ update_manager/state_factory.cc
+ update_manager/update_manager.cc
update_metadata.pb.cc
utils.cc""")
main = ['main.cc']
@@ -299,22 +299,6 @@
payload_generator/topological_sort_unittest.cc
payload_signer_unittest.cc
payload_state_unittest.cc
- policy_manager/boxed_value_unittest.cc
- policy_manager/chromeos_policy_unittest.cc
- policy_manager/evaluation_context_unittest.cc
- policy_manager/event_loop_unittest.cc
- policy_manager/generic_variables_unittest.cc
- policy_manager/pmtest_utils.cc
- policy_manager/policy_manager_unittest.cc
- policy_manager/prng_unittest.cc
- policy_manager/real_config_provider_unittest.cc
- policy_manager/real_device_policy_provider_unittest.cc
- policy_manager/real_random_provider_unittest.cc
- policy_manager/real_shill_provider_unittest.cc
- policy_manager/real_system_provider_unittest.cc
- policy_manager/real_time_provider_unittest.cc
- policy_manager/real_updater_provider_unittest.cc
- policy_manager/variable_unittest.cc
postinstall_runner_action_unittest.cc
prefs_unittest.cc
simple_key_value_store_unittest.cc
@@ -323,6 +307,22 @@
test_utils.cc
update_attempter_unittest.cc
update_check_scheduler_unittest.cc
+ update_manager/boxed_value_unittest.cc
+ update_manager/chromeos_policy_unittest.cc
+ update_manager/evaluation_context_unittest.cc
+ update_manager/event_loop_unittest.cc
+ update_manager/generic_variables_unittest.cc
+ update_manager/prng_unittest.cc
+ update_manager/real_config_provider_unittest.cc
+ update_manager/real_device_policy_provider_unittest.cc
+ update_manager/real_random_provider_unittest.cc
+ update_manager/real_shill_provider_unittest.cc
+ update_manager/real_system_provider_unittest.cc
+ update_manager/real_time_provider_unittest.cc
+ update_manager/real_updater_provider_unittest.cc
+ update_manager/umtest_utils.cc
+ update_manager/update_manager_unittest.cc
+ update_manager/variable_unittest.cc
utils_unittest.cc
zip_unittest.cc""")
unittest_main = ['testrunner.cc']
diff --git a/fake_system_state.cc b/fake_system_state.cc
index 8291ba3..8c5ffc9 100644
--- a/fake_system_state.cc
+++ b/fake_system_state.cc
@@ -3,9 +3,9 @@
// found in the LICENSE file.
#include "update_engine/fake_system_state.h"
-#include "update_engine/policy_manager/fake_state.h"
+#include "update_engine/update_manager/fake_state.h"
-using chromeos_policy_manager::FakeState;
+using chromeos_update_manager::FakeState;
namespace chromeos_update_engine {
@@ -15,7 +15,7 @@
: mock_connection_manager_(this),
mock_update_attempter_(this, &dbus_),
default_request_params_(this),
- fake_policy_manager_(&fake_clock_),
+ fake_update_manager_(&fake_clock_),
clock_(&fake_clock_),
connection_manager_(&mock_connection_manager_),
hardware_(&fake_hardware_),
@@ -26,7 +26,7 @@
update_attempter_(&mock_update_attempter_),
request_params_(&default_request_params_),
p2p_manager_(&mock_p2p_manager_),
- policy_manager_(&fake_policy_manager_),
+ update_manager_(&fake_update_manager_),
device_policy_(nullptr),
fake_system_rebooted_(false) {
mock_payload_state_.Initialize(this);
diff --git a/fake_system_state.h b/fake_system_state.h
index a7f4b6f..0e853c9 100644
--- a/fake_system_state.h
+++ b/fake_system_state.h
@@ -16,10 +16,10 @@
#include "update_engine/mock_dbus_wrapper.h"
#include "update_engine/mock_p2p_manager.h"
#include "update_engine/mock_payload_state.h"
-#include "update_engine/policy_manager/fake_policy_manager.h"
#include "update_engine/prefs_mock.h"
#include "update_engine/system_state.h"
#include "update_engine/update_attempter_mock.h"
+#include "update_engine/update_manager/fake_update_manager.h"
namespace chromeos_update_engine {
@@ -82,9 +82,9 @@
return p2p_manager_;
}
- virtual inline chromeos_policy_manager::PolicyManager* policy_manager()
+ virtual inline chromeos_update_manager::UpdateManager* update_manager()
override {
- return policy_manager_;
+ return update_manager_;
}
virtual inline bool system_rebooted() override {
@@ -139,9 +139,9 @@
p2p_manager_ = p2p_manager ? p2p_manager : &mock_p2p_manager_;
}
- inline void set_policy_manager(
- chromeos_policy_manager::PolicyManager *policy_manager) {
- policy_manager_ = policy_manager ? policy_manager : &fake_policy_manager_;
+ inline void set_update_manager(
+ chromeos_update_manager::UpdateManager *update_manager) {
+ update_manager_ = update_manager ? update_manager : &fake_update_manager_;
}
inline void set_system_rebooted(bool system_rebooted) {
@@ -203,9 +203,9 @@
return &mock_p2p_manager_;
}
- inline chromeos_policy_manager::FakePolicyManager* fake_policy_manager() {
- CHECK(policy_manager_ == &fake_policy_manager_);
- return &fake_policy_manager_;
+ inline chromeos_update_manager::FakeUpdateManager* fake_update_manager() {
+ CHECK(update_manager_ == &fake_update_manager_);
+ return &fake_update_manager_;
}
private:
@@ -220,7 +220,7 @@
testing::NiceMock<UpdateAttempterMock> mock_update_attempter_;
OmahaRequestParams default_request_params_;
testing::NiceMock<MockP2PManager> mock_p2p_manager_;
- chromeos_policy_manager::FakePolicyManager fake_policy_manager_;
+ chromeos_update_manager::FakeUpdateManager fake_update_manager_;
// Pointers to objects that client code can override. They are initialized to
// the default implementations above.
@@ -234,7 +234,7 @@
UpdateAttempter* update_attempter_;
OmahaRequestParams* request_params_;
P2PManager* p2p_manager_;
- chromeos_policy_manager::PolicyManager* policy_manager_;
+ chromeos_update_manager::UpdateManager* update_manager_;
// Other object pointers (not preinitialized).
const policy::DevicePolicy* device_policy_;
diff --git a/policy_manager/fake_policy_manager.h b/policy_manager/fake_policy_manager.h
deleted file mode 100644
index 83c575c..0000000
--- a/policy_manager/fake_policy_manager.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_POLICY_MANAGER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_POLICY_MANAGER_H_
-
-#include "update_engine/policy_manager/policy_manager.h"
-
-#include "update_engine/policy_manager/default_policy.h"
-#include "update_engine/policy_manager/fake_state.h"
-
-namespace chromeos_policy_manager {
-
-class FakePolicyManager : public PolicyManager {
- public:
- explicit FakePolicyManager(chromeos_update_engine::ClockInterface* clock)
- : PolicyManager(clock, new FakeState()) {
- // The FakePolicyManager uses a DefaultPolicy.
- set_policy(new DefaultPolicy());
- }
-
- // PolicyManager overrides.
- using PolicyManager::set_policy;
-
- FakeState* state() {
- return reinterpret_cast<FakeState*>(PolicyManager::state());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(FakePolicyManager);
-};
-
-} // namespace chromeos_policy_manager
-
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_POLICY_MANAGER_H_
diff --git a/policy_manager/policy_manager.cc b/policy_manager/policy_manager.cc
deleted file mode 100644
index 71f0290..0000000
--- a/policy_manager/policy_manager.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "update_engine/policy_manager/policy_manager.h"
-
-#include "update_engine/policy_manager/chromeos_policy.h"
-#include "update_engine/policy_manager/state.h"
-
-using base::Closure;
-
-namespace chromeos_policy_manager {
-
-PolicyManager::PolicyManager(chromeos_update_engine::ClockInterface* clock,
- State* state)
- : state_(state), clock_(clock) {
- // TODO(deymo): Make it possible to replace this policy with a different
- // implementation with a build-time flag.
- policy_.reset(new ChromeOSPolicy());
-}
-
-} // namespace chromeos_policy_manager
diff --git a/policy_manager/provider.h b/policy_manager/provider.h
deleted file mode 100644
index 020a8bc..0000000
--- a/policy_manager/provider.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PROVIDER_H_
-
-#include <base/basictypes.h>
-
-namespace chromeos_policy_manager {
-
-// Abstract base class for a policy provider.
-class Provider {
- public:
- virtual ~Provider() {}
-
- protected:
- Provider() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Provider);
-};
-
-} // namespace chromeos_policy_manager
-
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PROVIDER_H_
diff --git a/policy_manager/real_system_provider_unittest.cc b/policy_manager/real_system_provider_unittest.cc
deleted file mode 100644
index d82c3bd..0000000
--- a/policy_manager/real_system_provider_unittest.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "update_engine/policy_manager/real_system_provider.h"
-
-#include <base/memory/scoped_ptr.h>
-#include <base/time/time.h>
-#include <gtest/gtest.h>
-
-#include "update_engine/fake_hardware.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
-
-namespace chromeos_policy_manager {
-
-class PmRealSystemProviderTest : public ::testing::Test {
- protected:
- virtual void SetUp() {
- provider_.reset(new RealSystemProvider(&fake_hardware_));
- EXPECT_TRUE(provider_->Init());
- }
-
- chromeos_update_engine::FakeHardware fake_hardware_;
- scoped_ptr<RealSystemProvider> provider_;
-};
-
-TEST_F(PmRealSystemProviderTest, InitTest) {
- PMTEST_EXPECT_NOT_NULL(provider_->var_is_normal_boot_mode());
- PMTEST_EXPECT_NOT_NULL(provider_->var_is_official_build());
- PMTEST_EXPECT_NOT_NULL(provider_->var_is_oobe_complete());
-}
-
-TEST_F(PmRealSystemProviderTest, IsOOBECompleteTrue) {
- fake_hardware_.SetIsOOBEComplete(base::Time());
- PmTestUtils::ExpectVariableHasValue(true, provider_->var_is_oobe_complete());
-}
-
-TEST_F(PmRealSystemProviderTest, IsOOBECompleteFalse) {
- fake_hardware_.UnsetIsOOBEComplete();
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_is_oobe_complete());
-}
-
-} // namespace chromeos_policy_manager
diff --git a/policy_manager/state.h b/policy_manager/state.h
deleted file mode 100644
index 39abbad..0000000
--- a/policy_manager/state.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_STATE_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_STATE_H_
-
-#include "update_engine/policy_manager/device_policy_provider.h"
-#include "update_engine/policy_manager/config_provider.h"
-#include "update_engine/policy_manager/random_provider.h"
-#include "update_engine/policy_manager/shill_provider.h"
-#include "update_engine/policy_manager/system_provider.h"
-#include "update_engine/policy_manager/time_provider.h"
-#include "update_engine/policy_manager/updater_provider.h"
-
-namespace chromeos_policy_manager {
-
-// The State class is an interface to the ensemble of providers. This class
-// gives visibility of the state providers to policy implementations.
-class State {
- public:
- virtual ~State() {}
-
- // These methods return the given provider.
- virtual ConfigProvider* config_provider() = 0;
- virtual DevicePolicyProvider* device_policy_provider() = 0;
- virtual RandomProvider* random_provider() = 0;
- virtual ShillProvider* shill_provider() = 0;
- virtual SystemProvider* system_provider() = 0;
- virtual TimeProvider* time_provider() = 0;
- virtual UpdaterProvider* updater_provider() = 0;
-
- protected:
- State() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(State);
-};
-
-} // namespace chromeos_policy_manager
-
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_STATE_H_
diff --git a/real_system_state.cc b/real_system_state.cc
index 10b66f3..4886b91 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -7,7 +7,7 @@
#include <base/file_util.h>
#include "update_engine/constants.h"
-#include "update_engine/policy_manager/state_factory.h"
+#include "update_engine/update_manager/state_factory.h"
#include "update_engine/utils.h"
namespace chromeos_update_engine {
@@ -43,16 +43,16 @@
p2p_manager_.reset(P2PManager::Construct(NULL, &prefs_, "cros_au",
kMaxP2PFilesToKeep));
- // Initialize the PolicyManager using the default State Factory.
- chromeos_policy_manager::State* pm_state =
- chromeos_policy_manager::DefaultStateFactory(
+ // Initialize the Update Manager using the default state factory.
+ chromeos_update_manager::State* um_state =
+ chromeos_update_manager::DefaultStateFactory(
&policy_provider_, &dbus_, this);
- if (!pm_state) {
- LOG(ERROR) << "Failed to initialize the policy manager.";
+ if (!um_state) {
+ LOG(ERROR) << "Failed to initialize the Update Manager.";
return false;
}
- policy_manager_.reset(
- new chromeos_policy_manager::PolicyManager(&clock_, pm_state));
+ update_manager_.reset(
+ new chromeos_update_manager::UpdateManager(&clock_, um_state));
if (!payload_state_.Initialize(this)) {
LOG(ERROR) << "Failed to initialize the payload state object.";
diff --git a/real_system_state.h b/real_system_state.h
index 28ba254..acbcab9 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -7,18 +7,18 @@
#include "update_engine/system_state.h"
-#include <policy/device_policy.h>
#include <metrics/metrics_library.h>
+#include <policy/device_policy.h>
#include "update_engine/clock.h"
#include "update_engine/connection_manager.h"
#include "update_engine/hardware.h"
#include "update_engine/p2p_manager.h"
#include "update_engine/payload_state.h"
-#include "update_engine/policy_manager/policy_manager.h"
#include "update_engine/prefs.h"
#include "update_engine/real_dbus_wrapper.h"
#include "update_engine/update_attempter.h"
+#include "update_engine/update_manager/update_manager.h"
namespace chromeos_update_engine {
@@ -83,9 +83,9 @@
return p2p_manager_.get();
}
- virtual inline chromeos_policy_manager::PolicyManager* policy_manager()
+ virtual inline chromeos_update_manager::UpdateManager* update_manager()
override {
- return policy_manager_.get();
+ return update_manager_.get();
}
virtual inline bool system_rebooted() override {
@@ -130,7 +130,7 @@
scoped_ptr<P2PManager> p2p_manager_;
- scoped_ptr<chromeos_policy_manager::PolicyManager> policy_manager_;
+ scoped_ptr<chromeos_update_manager::UpdateManager> update_manager_;
policy::PolicyProvider policy_provider_;
diff --git a/system_state.h b/system_state.h
index a9e3c02..b008095 100644
--- a/system_state.h
+++ b/system_state.h
@@ -7,11 +7,11 @@
class MetricsLibraryInterface;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PolicyManager;
+class UpdateManager;
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
namespace policy {
@@ -84,8 +84,8 @@
// Returns a pointer to the P2PManager singleton.
virtual P2PManager* p2p_manager() = 0;
- // Returns a pointer to the PolicyManager singleton.
- virtual chromeos_policy_manager::PolicyManager* policy_manager() = 0;
+ // Returns a pointer to the UpdateManager singleton.
+ virtual chromeos_update_manager::UpdateManager* update_manager() = 0;
// If true, this is the first instance of the update engine since the system
// restarted. Important for tracking whether you are running instance of the
diff --git a/policy_manager/boxed_value.cc b/update_manager/boxed_value.cc
similarity index 94%
rename from policy_manager/boxed_value.cc
rename to update_manager/boxed_value.cc
index 02bc0bd..512f7a8 100644
--- a/policy_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -8,15 +8,15 @@
#include <base/strings/string_number_conversions.h>
#include <base/time/time.h>
-#include "update_engine/policy_manager/boxed_value.h"
-#include "update_engine/policy_manager/shill_provider.h"
-#include "update_engine/policy_manager/updater_provider.h"
+#include "update_engine/update_manager/boxed_value.h"
+#include "update_engine/update_manager/shill_provider.h"
+#include "update_engine/update_manager/updater_provider.h"
#include "update_engine/utils.h"
using std::set;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Template instantiation for common types; used in BoxedValue::ToString().
// Keep in sync with boxed_value_unitttest.cc.
@@ -160,4 +160,4 @@
return "Unknown";
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/boxed_value.h b/update_manager/boxed_value.h
similarity index 92%
rename from policy_manager/boxed_value.h
rename to update_manager/boxed_value.h
index 4e26292..69ad0a4 100644
--- a/policy_manager/boxed_value.h
+++ b/update_manager/boxed_value.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_BOXED_VALUE_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_BOXED_VALUE_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_BOXED_VALUE_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_BOXED_VALUE_H_
#include <string>
#include <base/basictypes.h>
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// BoxedValue is a class to hold pointers of a given type that deletes them when
// the instance goes out of scope, as scoped_ptr<T> does. The main difference
@@ -106,6 +106,6 @@
DISALLOW_COPY_AND_ASSIGN(BoxedValue);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_BOXED_VALUE_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_BOXED_VALUE_H_
diff --git a/policy_manager/boxed_value_unittest.cc b/update_manager/boxed_value_unittest.cc
similarity index 83%
rename from policy_manager/boxed_value_unittest.cc
rename to update_manager/boxed_value_unittest.cc
index a84604d..b42b361 100644
--- a/policy_manager/boxed_value_unittest.cc
+++ b/update_manager/boxed_value_unittest.cc
@@ -11,19 +11,19 @@
#include <base/strings/stringprintf.h>
#include <base/time/time.h>
-#include "update_engine/policy_manager/boxed_value.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
-#include "update_engine/policy_manager/shill_provider.h"
-#include "update_engine/policy_manager/updater_provider.h"
+#include "update_engine/update_manager/boxed_value.h"
+#include "update_engine/update_manager/shill_provider.h"
+#include "update_engine/update_manager/umtest_utils.h"
+#include "update_engine/update_manager/updater_provider.h"
using base::Time;
using base::TimeDelta;
-using std::set;
using std::list;
using std::map;
+using std::set;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// The DeleterMarker flags a bool variable when the class is destroyed.
class DeleterMarker {
@@ -46,7 +46,7 @@
*val->marker_ ? "true" : "false");
}
-TEST(PmBoxedValueTest, Deleted) {
+TEST(UmBoxedValueTest, Deleted) {
bool marker = true;
const DeleterMarker* deleter_marker = new DeleterMarker(&marker);
@@ -57,7 +57,7 @@
EXPECT_TRUE(marker);
}
-TEST(PmBoxedValueTest, MoveConstructor) {
+TEST(UmBoxedValueTest, MoveConstructor) {
bool marker = true;
const DeleterMarker* deleter_marker = new DeleterMarker(&marker);
@@ -71,7 +71,7 @@
EXPECT_TRUE(marker);
}
-TEST(PmBoxedValueTest, MixedList) {
+TEST(UmBoxedValueTest, MixedList) {
list<BoxedValue> lst;
// This is mostly a compile test.
lst.emplace_back(new const int(42));
@@ -83,65 +83,65 @@
EXPECT_TRUE(marker);
}
-TEST(PmBoxedValueTest, MixedMap) {
+TEST(UmBoxedValueTest, MixedMap) {
map<int, BoxedValue> m;
m.emplace(42, std::move(BoxedValue(new const string("Hola mundo!"))));
auto it = m.find(42);
ASSERT_NE(it, m.end());
- PMTEST_EXPECT_NOT_NULL(it->second.value());
- PMTEST_EXPECT_NULL(m[33].value());
+ UMTEST_EXPECT_NOT_NULL(it->second.value());
+ UMTEST_EXPECT_NULL(m[33].value());
}
-TEST(PmBoxedValueTest, StringToString) {
+TEST(UmBoxedValueTest, StringToString) {
EXPECT_EQ("Hej Verden!",
BoxedValue(new string("Hej Verden!")).ToString());
}
-TEST(PmBoxedValueTest, IntToString) {
+TEST(UmBoxedValueTest, IntToString) {
EXPECT_EQ("42", BoxedValue(new int(42)).ToString());
}
-TEST(PmBoxedValueTest, Int64ToString) {
+TEST(UmBoxedValueTest, Int64ToString) {
// -123456789012345 doensn't fit in 32-bit integers.
EXPECT_EQ("-123456789012345", BoxedValue(
new int64_t(-123456789012345LL)).ToString());
}
-TEST(PmBoxedValueTest, UnsignedIntToString) {
+TEST(UmBoxedValueTest, UnsignedIntToString) {
// 4294967295 is the biggest possible 32-bit unsigned integer.
EXPECT_EQ("4294967295", BoxedValue(new unsigned int(4294967295U)).ToString());
}
-TEST(PmBoxedValueTest, UnsignedInt64ToString) {
+TEST(UmBoxedValueTest, UnsignedInt64ToString) {
// 18446744073709551615 is the biggest possible 64-bit unsigned integer.
EXPECT_EQ("18446744073709551615", BoxedValue(
new uint64_t(18446744073709551615ULL)).ToString());
}
-TEST(PmBoxedValueTest, BoolToString) {
+TEST(UmBoxedValueTest, BoolToString) {
EXPECT_EQ("false", BoxedValue(new bool(false)).ToString());
EXPECT_EQ("true", BoxedValue(new bool(true)).ToString());
}
-TEST(PmBoxedValueTest, DoubleToString) {
+TEST(UmBoxedValueTest, DoubleToString) {
EXPECT_EQ("1.501", BoxedValue(new double(1.501)).ToString());
}
-TEST(PmBoxedValueTest, TimeToString) {
+TEST(UmBoxedValueTest, TimeToString) {
// Tue Apr 29 22:30:55 UTC 2014 is 1398810655 seconds since the Unix Epoch.
EXPECT_EQ("4/29/2014 22:30:55 GMT",
BoxedValue(new Time(Time::FromTimeT(1398810655))).ToString());
}
-TEST(PmBoxedValueTest, TimeDeltaToString) {
+TEST(UmBoxedValueTest, TimeDeltaToString) {
// 12345 seconds is 3 hours, 25 minutes and 45 seconds.
EXPECT_EQ("3h25m45s",
BoxedValue(new TimeDelta(TimeDelta::FromSeconds(12345)))
.ToString());
}
-TEST(PmBoxedValueTest, ConnectionTypeToString) {
+TEST(UmBoxedValueTest, ConnectionTypeToString) {
EXPECT_EQ("Ethernet",
BoxedValue(new ConnectionType(ConnectionType::kEthernet))
.ToString());
@@ -160,7 +160,7 @@
.ToString());
}
-TEST(PmBoxedValueTest, ConnectionTetheringToString) {
+TEST(UmBoxedValueTest, ConnectionTetheringToString) {
EXPECT_EQ("Not Detected",
BoxedValue(new ConnectionTethering(
ConnectionTethering::kNotDetected)).ToString());
@@ -175,7 +175,7 @@
.ToString());
}
-TEST(PmBoxedValueTest, SetConnectionTypeToString) {
+TEST(UmBoxedValueTest, SetConnectionTypeToString) {
set<ConnectionType>* set1 = new set<ConnectionType>;
set1->insert(ConnectionType::kWimax);
set1->insert(ConnectionType::kEthernet);
@@ -186,7 +186,7 @@
EXPECT_EQ("Wifi", BoxedValue(set2).ToString());
}
-TEST(PmBoxedValueTest, StageToString) {
+TEST(UmBoxedValueTest, StageToString) {
EXPECT_EQ("Idle",
BoxedValue(new Stage(Stage::kIdle)).ToString());
EXPECT_EQ("Checking For Update",
@@ -207,7 +207,7 @@
BoxedValue(new Stage(Stage::kAttemptingRollback)).ToString());
}
-TEST(PmBoxedValueTest, DeleterMarkerToString) {
+TEST(UmBoxedValueTest, DeleterMarkerToString) {
bool marker = false;
BoxedValue value = BoxedValue(new DeleterMarker(&marker));
EXPECT_EQ("DeleterMarker:false", value.ToString());
@@ -215,4 +215,4 @@
EXPECT_EQ("DeleterMarker:true", value.ToString());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
similarity index 97%
rename from policy_manager/chromeos_policy.cc
rename to update_manager/chromeos_policy.cc
index 2ce8108..6cf1fd1 100644
--- a/policy_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/chromeos_policy.h"
+#include "update_engine/update_manager/chromeos_policy.h"
#include <algorithm>
#include <set>
@@ -11,9 +11,9 @@
#include <base/logging.h>
#include <base/time/time.h>
-#include "update_engine/policy_manager/device_policy_provider.h"
-#include "update_engine/policy_manager/policy_utils.h"
-#include "update_engine/policy_manager/shill_provider.h"
+#include "update_engine/update_manager/device_policy_provider.h"
+#include "update_engine/update_manager/policy_utils.h"
+#include "update_engine/update_manager/shill_provider.h"
using base::Time;
using base::TimeDelta;
@@ -21,7 +21,7 @@
using std::set;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
EvalStatus ChromeOSPolicy::UpdateCheckAllowed(
EvaluationContext* ec, State* state, string* error,
@@ -393,4 +393,4 @@
return EvalStatus::kSucceeded;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/chromeos_policy.h b/update_manager/chromeos_policy.h
similarity index 82%
rename from policy_manager/chromeos_policy.h
rename to update_manager/chromeos_policy.h
index 1542f9e..3c47c60 100644
--- a/policy_manager/chromeos_policy.h
+++ b/update_manager/chromeos_policy.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_CHROMEOS_POLICY_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_CHROMEOS_POLICY_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_CHROMEOS_POLICY_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_CHROMEOS_POLICY_H_
#include <base/time/time.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include "update_engine/policy_manager/policy.h"
-#include "update_engine/policy_manager/prng.h"
+#include "update_engine/update_manager/policy.h"
+#include "update_engine/update_manager/prng.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Parameters for update scattering, as determined by UpdateNotScattering.
struct UpdateScatteringResult {
@@ -46,21 +46,21 @@
bool* result) const override;
private:
- friend class PmChromeOSPolicyTest;
- FRIEND_TEST(PmChromeOSPolicyTest,
+ friend class UmChromeOSPolicyTest;
+ FRIEND_TEST(UmChromeOSPolicyTest,
FirstCheckIsAtMostInitialIntervalAfterStart);
- FRIEND_TEST(PmChromeOSPolicyTest, ExponentialBackoffIsCapped);
- FRIEND_TEST(PmChromeOSPolicyTest, UpdateCheckAllowedWaitsForTheTimeout);
- FRIEND_TEST(PmChromeOSPolicyTest,
+ FRIEND_TEST(UmChromeOSPolicyTest, ExponentialBackoffIsCapped);
+ FRIEND_TEST(UmChromeOSPolicyTest, UpdateCheckAllowedWaitsForTheTimeout);
+ FRIEND_TEST(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringNewWaitPeriodApplies);
- FRIEND_TEST(PmChromeOSPolicyTest,
+ FRIEND_TEST(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringPrevWaitPeriodStillApplies);
- FRIEND_TEST(PmChromeOSPolicyTest,
+ FRIEND_TEST(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringNewCountThresholdApplies);
- FRIEND_TEST(PmChromeOSPolicyTest,
+ FRIEND_TEST(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringPrevCountThresholdStillApplies);
- FRIEND_TEST(PmChromeOSPolicyTest, UpdateCanStartAllowedScatteringSatisfied);
- FRIEND_TEST(PmChromeOSPolicyTest,
+ FRIEND_TEST(UmChromeOSPolicyTest, UpdateCanStartAllowedScatteringSatisfied);
+ FRIEND_TEST(UmChromeOSPolicyTest,
UpdateCanStartAllowedInteractivePreventsScattering);
// Auxiliary constant (zero by default).
@@ -106,6 +106,6 @@
DISALLOW_COPY_AND_ASSIGN(ChromeOSPolicy);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_CHROMEOS_POLICY_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_CHROMEOS_POLICY_H_
diff --git a/policy_manager/chromeos_policy_unittest.cc b/update_manager/chromeos_policy_unittest.cc
similarity index 93%
rename from policy_manager/chromeos_policy_unittest.cc
rename to update_manager/chromeos_policy_unittest.cc
index 88a6d28..0fa96b3 100644
--- a/policy_manager/chromeos_policy_unittest.cc
+++ b/update_manager/chromeos_policy_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/chromeos_policy.h"
+#include "update_engine/update_manager/chromeos_policy.h"
#include <set>
#include <string>
@@ -11,9 +11,9 @@
#include <gtest/gtest.h>
#include "update_engine/fake_clock.h"
-#include "update_engine/policy_manager/evaluation_context.h"
-#include "update_engine/policy_manager/fake_state.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
+#include "update_engine/update_manager/evaluation_context.h"
+#include "update_engine/update_manager/fake_state.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
using base::TimeDelta;
@@ -21,9 +21,9 @@
using std::set;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmChromeOSPolicyTest : public ::testing::Test {
+class UmChromeOSPolicyTest : public ::testing::Test {
protected:
virtual void SetUp() {
SetUpDefaultClock();
@@ -139,7 +139,7 @@
ChromeOSPolicy policy_; // ChromeOSPolicy under test.
};
-TEST_F(PmChromeOSPolicyTest, FirstCheckIsAtMostInitialIntervalAfterStart) {
+TEST_F(UmChromeOSPolicyTest, FirstCheckIsAtMostInitialIntervalAfterStart) {
Time next_update_check;
ExpectPolicyStatus(EvalStatus::kSucceeded,
@@ -151,7 +151,7 @@
ChromeOSPolicy::kTimeoutRegularFuzz), next_update_check);
}
-TEST_F(PmChromeOSPolicyTest, ExponentialBackoffIsCapped) {
+TEST_F(UmChromeOSPolicyTest, ExponentialBackoffIsCapped) {
Time next_update_check;
fake_state_.updater_provider()->var_consecutive_failed_update_checks()->
@@ -167,7 +167,7 @@
ChromeOSPolicy::kTimeoutRegularFuzz), next_update_check);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCheckAllowedWaitsForTheTimeout) {
+TEST_F(UmChromeOSPolicyTest, UpdateCheckAllowedWaitsForTheTimeout) {
// We get the next update_check timestamp from the policy's private method
// and then we check the public method respects that value on the normal
// case.
@@ -200,7 +200,7 @@
&Policy::UpdateCheckAllowed, &result);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartFailsCheckAllowedError) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartFailsCheckAllowedError) {
// The UpdateCanStart policy fails, not being able to query
// UpdateCheckAllowed.
@@ -214,7 +214,7 @@
&Policy::UpdateCanStart, &result, false, update_state);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartNotAllowedCheckDue) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartNotAllowedCheckDue) {
// The UpdateCanStart policy returns false because we are due for another
// update check.
@@ -229,7 +229,7 @@
EXPECT_EQ(UpdateCannotStartReason::kCheckDue, result.cannot_start_reason);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartAllowedNoDevicePolicy) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedNoDevicePolicy) {
// The UpdateCanStart policy returns true; no device policy is loaded.
SetUpdateCheckAllowed(false);
@@ -247,7 +247,7 @@
EXPECT_TRUE(result.target_channel.empty());
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartAllowedBlankPolicy) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedBlankPolicy) {
// The UpdateCanStart policy returns true; device policy is loaded but imposes
// no restrictions on updating.
@@ -264,7 +264,7 @@
EXPECT_TRUE(result.target_channel.empty());
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartNotAllowedUpdatesDisabled) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartNotAllowedUpdatesDisabled) {
// The UpdateCanStart should return false (kAskMeAgainlater) because a device
// policy is loaded and prohibits updates.
@@ -282,7 +282,7 @@
result.cannot_start_reason);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartFailsScatteringFailed) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartFailsScatteringFailed) {
// The UpdateCanStart policy fails because the UpdateScattering policy it
// depends on fails (unset variable).
@@ -299,7 +299,7 @@
&Policy::UpdateCanStart, &result, false, update_state);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringNewWaitPeriodApplies) {
// The UpdateCanStart policy returns false; device policy is loaded and
// scattering applies due to an unsatisfied wait period, which was newly
@@ -323,7 +323,7 @@
EXPECT_EQ(0, result.scatter_check_threshold);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringPrevWaitPeriodStillApplies) {
// The UpdateCanStart policy returns false w/ kAskMeAgainLater; device policy
// is loaded and a previously generated scattering period still applies, none
@@ -347,7 +347,7 @@
EXPECT_EQ(0, result.scatter_check_threshold);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringNewCountThresholdApplies) {
// The UpdateCanStart policy returns false; device policy is loaded and
// scattering applies due to an unsatisfied update check count threshold.
@@ -373,7 +373,7 @@
EXPECT_GE(5, result.scatter_check_threshold);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCanStartNotAllowedScatteringPrevCountThresholdStillApplies) {
// The UpdateCanStart policy returns false; device policy is loaded and
// scattering due to a previously generated count threshold still applies.
@@ -396,7 +396,7 @@
EXPECT_EQ(3, result.scatter_check_threshold);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartAllowedScatteringSatisfied) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedScatteringSatisfied) {
// The UpdateCanStart policy returns true; device policy is loaded and
// scattering is enabled, but both wait period and check threshold are
// satisfied.
@@ -421,7 +421,7 @@
EXPECT_EQ(0, result.scatter_check_threshold);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCanStartAllowedInteractivePreventsScattering) {
// The UpdateCanStart policy returns true; device policy is loaded and
// scattering would have applied, except that the update check is interactive
@@ -445,7 +445,7 @@
EXPECT_EQ(0, result.scatter_check_threshold);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCanStartAllowedOobePreventsScattering) {
// The UpdateCanStart policy returns true; device policy is loaded and
// scattering would have applied, except that OOBE was not completed and so it
@@ -470,7 +470,7 @@
EXPECT_EQ(0, result.scatter_check_threshold);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartAllowedWithAttributes) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedWithAttributes) {
// The UpdateCanStart policy returns true; device policy permits both HTTP and
// P2P updates, as well as a non-empty target channel string.
@@ -497,7 +497,7 @@
EXPECT_EQ("foo-channel", result.target_channel);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartAllowedWithP2PFromUpdater) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedWithP2PFromUpdater) {
// The UpdateCanStart policy returns true; device policy forbids both HTTP and
// P2P updates, but the updater is configured to allow P2P and overrules the
// setting.
@@ -522,7 +522,7 @@
EXPECT_EQ("foo-channel", result.target_channel);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCanStartAllowedWithHttpForUnofficialBuild) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedWithHttpForUnofficialBuild) {
// The UpdateCanStart policy returns true; device policy forbids both HTTP and
// P2P updates, but marking this an unofficial build overrules the HTTP
// setting.
@@ -548,7 +548,7 @@
EXPECT_EQ("foo-channel", result.target_channel);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCurrentConnectionAllowedEthernetDefault) {
+TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionAllowedEthernetDefault) {
// Ethernet is always allowed.
fake_state_.shill_provider()->var_conn_type()->
@@ -560,7 +560,7 @@
EXPECT_TRUE(result);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCurrentConnectionAllowedWifiDefault) {
+TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionAllowedWifiDefault) {
// Wifi is allowed if not tethered.
fake_state_.shill_provider()->var_conn_type()->
@@ -572,7 +572,7 @@
EXPECT_TRUE(result);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCurrentConnectionNotAllowedWifiTetheredDefault) {
// Tethered wifi is not allowed by default.
@@ -587,7 +587,7 @@
EXPECT_FALSE(result);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCurrentConnectionAllowedWifiTetheredPolicyOverride) {
// Tethered wifi can be allowed by policy.
@@ -607,7 +607,7 @@
EXPECT_TRUE(result);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCurrentConnectionAllowedWimaxDefault) {
+TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionAllowedWimaxDefault) {
// Wimax is always allowed.
fake_state_.shill_provider()->var_conn_type()->
@@ -619,7 +619,7 @@
EXPECT_TRUE(result);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCurrentConnectionNotAllowedBluetoothDefault) {
// Bluetooth is never allowed.
@@ -632,7 +632,7 @@
EXPECT_FALSE(result);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCurrentConnectionNotAllowedBluetoothPolicyCannotOverride) {
// Bluetooth cannot be allowed even by policy.
@@ -650,7 +650,7 @@
EXPECT_FALSE(result);
}
-TEST_F(PmChromeOSPolicyTest, UpdateCurrentConnectionNotAllowedCellularDefault) {
+TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionNotAllowedCellularDefault) {
// Cellular is not allowed by default.
fake_state_.shill_provider()->var_conn_type()->
@@ -662,7 +662,7 @@
EXPECT_FALSE(result);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCurrentConnectionAllowedCellularPolicyOverride) {
// Update over cellular can be enabled by policy.
@@ -680,7 +680,7 @@
EXPECT_TRUE(result);
}
-TEST_F(PmChromeOSPolicyTest,
+TEST_F(UmChromeOSPolicyTest,
UpdateCurrentConnectionAllowedCellularUserOverride) {
// Update over cellular can be enabled by user settings, but only if policy
// is present and does not determine allowed connections.
@@ -698,4 +698,4 @@
EXPECT_TRUE(result);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/config_provider.h b/update_manager/config_provider.h
similarity index 65%
rename from policy_manager/config_provider.h
rename to update_manager/config_provider.h
index b113f2a..55a4d7a 100644
--- a/policy_manager/config_provider.h
+++ b/update_manager/config_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_CONFIG_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_CONFIG_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_CONFIG_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_CONFIG_PROVIDER_H_
-#include "update_engine/policy_manager/provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/provider.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Provider for const system configurations. This provider reads the
// configuration from a file on /etc.
@@ -26,6 +26,6 @@
DISALLOW_COPY_AND_ASSIGN(ConfigProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_CONFIG_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_CONFIG_PROVIDER_H_
diff --git a/policy_manager/default_policy.h b/update_manager/default_policy.h
similarity index 81%
rename from policy_manager/default_policy.h
rename to update_manager/default_policy.h
index 1e2a471..b3767dc 100644
--- a/policy_manager/default_policy.h
+++ b/update_manager/default_policy.h
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEFAULT_POLICY_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEFAULT_POLICY_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_DEFAULT_POLICY_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_DEFAULT_POLICY_H_
#include <base/time/time.h>
-#include "update_engine/policy_manager/policy.h"
+#include "update_engine/update_manager/policy.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// The DefaultPolicy is a safe Policy implementation that doesn't fail. The
// values returned by this policy are safe default in case of failure of the
-// actual policy being used by the PolicyManager.
+// actual policy being used by the UpdateManager.
class DefaultPolicy : public Policy {
public:
DefaultPolicy() {}
@@ -57,6 +57,6 @@
DISALLOW_COPY_AND_ASSIGN(DefaultPolicy);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEFAULT_POLICY_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_DEFAULT_POLICY_H_
diff --git a/policy_manager/device_policy_provider.h b/update_manager/device_policy_provider.h
similarity index 79%
rename from policy_manager/device_policy_provider.h
rename to update_manager/device_policy_provider.h
index f6bbe2e..f612d55 100644
--- a/policy_manager/device_policy_provider.h
+++ b/update_manager/device_policy_provider.h
@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEVICE_POLICY_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEVICE_POLICY_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
#include <set>
#include <string>
-#include <policy/libpolicy.h>
#include <base/time/time.h>
+#include <policy/libpolicy.h>
-#include "update_engine/policy_manager/provider.h"
-#include "update_engine/policy_manager/shill_provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/provider.h"
+#include "update_engine/update_manager/shill_provider.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Provides access to the current DevicePolicy.
class DevicePolicyProvider : public Provider {
@@ -58,6 +58,6 @@
DISALLOW_COPY_AND_ASSIGN(DevicePolicyProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEVICE_POLICY_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
diff --git a/policy_manager/evaluation_context-inl.h b/update_manager/evaluation_context-inl.h
similarity index 81%
rename from policy_manager/evaluation_context-inl.h
rename to update_manager/evaluation_context-inl.h
index c8e3808..962d0e9 100644
--- a/policy_manager/evaluation_context-inl.h
+++ b/update_manager/evaluation_context-inl.h
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVALUATION_CONTEXT_INL_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVALUATION_CONTEXT_INL_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_INL_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_INL_H_
#include <base/logging.h>
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
template<typename T>
const T* EvaluationContext::GetValue(Variable<T>* var) {
@@ -36,6 +36,6 @@
return result;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVALUATION_CONTEXT_INL_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_INL_H_
diff --git a/policy_manager/evaluation_context.cc b/update_manager/evaluation_context.cc
similarity index 96%
rename from policy_manager/evaluation_context.cc
rename to update_manager/evaluation_context.cc
index 3a37618..4fc9a16 100644
--- a/policy_manager/evaluation_context.cc
+++ b/update_manager/evaluation_context.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/evaluation_context.h"
+#include "update_engine/update_manager/evaluation_context.h"
#include <string>
@@ -18,7 +18,7 @@
using chromeos_update_engine::ClockInterface;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
EvaluationContext::EvaluationContext(ClockInterface* clock)
: clock_(clock),
@@ -160,4 +160,4 @@
return json_str;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/evaluation_context.h b/update_manager/evaluation_context.h
similarity index 90%
rename from policy_manager/evaluation_context.h
rename to update_manager/evaluation_context.h
index 059256e..97e5b97 100644
--- a/policy_manager/evaluation_context.h
+++ b/update_manager/evaluation_context.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVALUATION_CONTEXT_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVALUATION_CONTEXT_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_H_
#include <map>
@@ -14,11 +14,11 @@
#include <base/time/time.h>
#include "update_engine/clock_interface.h"
-#include "update_engine/policy_manager/boxed_value.h"
-#include "update_engine/policy_manager/event_loop.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/boxed_value.h"
+#include "update_engine/update_manager/event_loop.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// The EvaluationContext class is the interface between a policy implementation
// and the state. The EvaluationContext tracks the variables used by a policy
@@ -69,7 +69,7 @@
bool IsTimeGreaterThan(base::Time timestamp);
// TODO(deymo): Move the following methods to an interface only visible by the
- // PolicyManager class and not the policy implementations.
+ // UpdateManager class and not the policy implementations.
// Resets the EvaluationContext to its initial state removing all the
// non-const cached variables and re-setting the evaluation time. This should
@@ -138,7 +138,7 @@
// The timeout of an evaluation, used to compute the RemainingTime() of an
// evaluation.
- // TODO(deymo): Receive the timeout from the PolicyManager. crbug.com/363790
+ // TODO(deymo): Receive the timeout from the UpdateManager. crbug.com/363790
base::TimeDelta evaluation_timeout_ = base::TimeDelta::FromSeconds(5);
// The timestamp in the ClockInterface::GetMonotonicTime() scale at which the
@@ -151,9 +151,9 @@
DISALLOW_COPY_AND_ASSIGN(EvaluationContext);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
// Include the implementation of the template methods.
-#include "update_engine/policy_manager/evaluation_context-inl.h"
+#include "update_engine/update_manager/evaluation_context-inl.h"
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVALUATION_CONTEXT_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_H_
diff --git a/policy_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc
similarity index 83%
rename from policy_manager/evaluation_context_unittest.cc
rename to update_manager/evaluation_context_unittest.cc
index ccc49c9..33d91a4 100644
--- a/policy_manager/evaluation_context_unittest.cc
+++ b/update_manager/evaluation_context_unittest.cc
@@ -8,12 +8,12 @@
#include <gtest/gtest.h>
#include "update_engine/fake_clock.h"
-#include "update_engine/policy_manager/evaluation_context.h"
-#include "update_engine/policy_manager/fake_variable.h"
-#include "update_engine/policy_manager/generic_variables.h"
-#include "update_engine/policy_manager/mock_variable.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
#include "update_engine/test_utils.h"
+#include "update_engine/update_manager/evaluation_context.h"
+#include "update_engine/update_manager/fake_variable.h"
+#include "update_engine/update_manager/generic_variables.h"
+#include "update_engine/update_manager/mock_variable.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::Bind;
using base::Time;
@@ -41,9 +41,9 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmEvaluationContextTest : public ::testing::Test {
+class UmEvaluationContextTest : public ::testing::Test {
protected:
virtual void SetUp() {
// Set the clock to a fixed values.
@@ -84,26 +84,26 @@
kVariableModePoll};
};
-TEST_F(PmEvaluationContextTest, GetValueFails) {
+TEST_F(UmEvaluationContextTest, GetValueFails) {
// FakeVariable is initialized as returning NULL.
- PMTEST_EXPECT_NULL(eval_ctx_->GetValue(&fake_int_var_));
+ UMTEST_EXPECT_NULL(eval_ctx_->GetValue(&fake_int_var_));
}
-TEST_F(PmEvaluationContextTest, GetValueFailsWithInvalidVar) {
- PMTEST_EXPECT_NULL(eval_ctx_->GetValue(
+TEST_F(UmEvaluationContextTest, GetValueFailsWithInvalidVar) {
+ UMTEST_EXPECT_NULL(eval_ctx_->GetValue(
reinterpret_cast<Variable<int>*>(NULL)));
}
-TEST_F(PmEvaluationContextTest, GetValueReturns) {
+TEST_F(UmEvaluationContextTest, GetValueReturns) {
const int* p_fake_int;
fake_int_var_.reset(new int(42));
p_fake_int = eval_ctx_->GetValue(&fake_int_var_);
- PMTEST_ASSERT_NOT_NULL(p_fake_int);
+ UMTEST_ASSERT_NOT_NULL(p_fake_int);
EXPECT_EQ(42, *p_fake_int);
}
-TEST_F(PmEvaluationContextTest, GetValueCached) {
+TEST_F(UmEvaluationContextTest, GetValueCached) {
const int* p_fake_int;
fake_int_var_.reset(new int(42));
@@ -114,22 +114,22 @@
fake_int_var_.reset(new int(5));
p_fake_int = eval_ctx_->GetValue(&fake_int_var_);
- PMTEST_ASSERT_NOT_NULL(p_fake_int);
+ UMTEST_ASSERT_NOT_NULL(p_fake_int);
EXPECT_EQ(42, *p_fake_int);
}
-TEST_F(PmEvaluationContextTest, GetValueCachesNull) {
+TEST_F(UmEvaluationContextTest, GetValueCachesNull) {
const int* p_fake_int = eval_ctx_->GetValue(&fake_int_var_);
- PMTEST_EXPECT_NULL(p_fake_int);
+ UMTEST_EXPECT_NULL(p_fake_int);
fake_int_var_.reset(new int(42));
// A second attempt to read the variable should not work because this
// EvaluationContext already got a NULL value.
p_fake_int = eval_ctx_->GetValue(&fake_int_var_);
- PMTEST_EXPECT_NULL(p_fake_int);
+ UMTEST_EXPECT_NULL(p_fake_int);
}
-TEST_F(PmEvaluationContextTest, GetValueMixedTypes) {
+TEST_F(UmEvaluationContextTest, GetValueMixedTypes) {
const int* p_fake_int;
const string* p_fake_string;
@@ -140,15 +140,15 @@
p_fake_int = eval_ctx_->GetValue(&fake_int_var_);
p_fake_string = eval_ctx_->GetValue(&fake_poll_var_);
- PMTEST_ASSERT_NOT_NULL(p_fake_int);
+ UMTEST_ASSERT_NOT_NULL(p_fake_int);
EXPECT_EQ(42, *p_fake_int);
- PMTEST_ASSERT_NOT_NULL(p_fake_string);
+ UMTEST_ASSERT_NOT_NULL(p_fake_string);
EXPECT_EQ("Hello world!", *p_fake_string);
}
// Test that we don't schedule an event if there's no variable to wait for.
-TEST_F(PmEvaluationContextTest, RunOnValueChangeOrTimeoutWithoutVariablesTest) {
+TEST_F(UmEvaluationContextTest, RunOnValueChangeOrTimeoutWithoutVariablesTest) {
fake_const_var_.reset(new string("Hello world!"));
EXPECT_EQ(*eval_ctx_->GetValue(&fake_const_var_), "Hello world!");
@@ -156,7 +156,7 @@
}
// Test that we don't schedule an event if there's no variable to wait for.
-TEST_F(PmEvaluationContextTest, RunOnValueChangeOrTimeoutWithVariablesTest) {
+TEST_F(UmEvaluationContextTest, RunOnValueChangeOrTimeoutWithVariablesTest) {
fake_async_var_.reset(new string("Async value"));
eval_ctx_->GetValue(&fake_async_var_);
@@ -175,7 +175,7 @@
}
// Test that we don't re-schedule the events if we are attending one.
-TEST_F(PmEvaluationContextTest, RunOnValueChangeOrTimeoutCalledTwiceTest) {
+TEST_F(UmEvaluationContextTest, RunOnValueChangeOrTimeoutCalledTwiceTest) {
fake_async_var_.reset(new string("Async value"));
eval_ctx_->GetValue(&fake_async_var_);
@@ -190,7 +190,7 @@
}
// Test that we clear the events when destroying the EvaluationContext.
-TEST_F(PmEvaluationContextTest, RemoveObserversAndTimeoutTest) {
+TEST_F(UmEvaluationContextTest, RemoveObserversAndTimeoutTest) {
fake_async_var_.reset(new string("Async value"));
eval_ctx_->GetValue(&fake_async_var_);
@@ -206,7 +206,7 @@
}
// Test that we don't schedule an event if there's no variable to wait for.
-TEST_F(PmEvaluationContextTest, RunOnValueChangeOrTimeoutRunsFromTimeoutTest) {
+TEST_F(UmEvaluationContextTest, RunOnValueChangeOrTimeoutRunsFromTimeoutTest) {
fake_poll_var_.reset(new string("Polled value"));
eval_ctx_->GetValue(&fake_poll_var_);
@@ -220,7 +220,7 @@
}
// Test that we can delete the EvaluationContext while having pending events.
-TEST_F(PmEvaluationContextTest, ObjectDeletedWithPendingEventsTest) {
+TEST_F(UmEvaluationContextTest, ObjectDeletedWithPendingEventsTest) {
fake_async_var_.reset(new string("Async value"));
fake_poll_var_.reset(new string("Polled value"));
eval_ctx_->GetValue(&fake_async_var_);
@@ -232,7 +232,7 @@
// Test that timed events fired after removal of the EvaluationContext don't
// crash.
-TEST_F(PmEvaluationContextTest, TimeoutEventAfterDeleteTest) {
+TEST_F(UmEvaluationContextTest, TimeoutEventAfterDeleteTest) {
FakeVariable<string> fake_short_poll_var = {"fake_short_poll", TimeDelta()};
fake_short_poll_var.reset(new string("Polled value"));
eval_ctx_->GetValue(&fake_short_poll_var);
@@ -247,14 +247,14 @@
EXPECT_FALSE(value);
}
-TEST_F(PmEvaluationContextTest, DefaultTimeout) {
+TEST_F(UmEvaluationContextTest, DefaultTimeout) {
// Test that the RemainingTime() uses the default timeout on setup.
EXPECT_CALL(mock_var_async_, GetValue(default_timeout_, _))
.WillOnce(Return(nullptr));
- PMTEST_EXPECT_NULL(eval_ctx_->GetValue(&mock_var_async_));
+ UMTEST_EXPECT_NULL(eval_ctx_->GetValue(&mock_var_async_));
}
-TEST_F(PmEvaluationContextTest, TimeoutUpdatesWithMonotonicTime) {
+TEST_F(UmEvaluationContextTest, TimeoutUpdatesWithMonotonicTime) {
fake_clock_.SetMonotonicTime(
fake_clock_.GetMonotonicTime() + TimeDelta::FromSeconds(1));
@@ -262,10 +262,10 @@
EXPECT_CALL(mock_var_async_, GetValue(timeout, _))
.WillOnce(Return(nullptr));
- PMTEST_EXPECT_NULL(eval_ctx_->GetValue(&mock_var_async_));
+ UMTEST_EXPECT_NULL(eval_ctx_->GetValue(&mock_var_async_));
}
-TEST_F(PmEvaluationContextTest, ResetEvaluationResetsTimes) {
+TEST_F(UmEvaluationContextTest, ResetEvaluationResetsTimes) {
base::Time cur_time = fake_clock_.GetWallclockTime();
// Advance the time on the clock but don't call ResetEvaluation yet.
fake_clock_.SetWallclockTime(cur_time + TimeDelta::FromSeconds(4));
@@ -286,7 +286,7 @@
TimeDelta::FromSeconds(1)));
}
-TEST_F(PmEvaluationContextTest, IsTimeGreaterThanSignalsTriggerReevaluation) {
+TEST_F(UmEvaluationContextTest, IsTimeGreaterThanSignalsTriggerReevaluation) {
EXPECT_FALSE(eval_ctx_->IsTimeGreaterThan(
fake_clock_.GetWallclockTime() + TimeDelta::FromSeconds(1)));
@@ -295,7 +295,7 @@
EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
}
-TEST_F(PmEvaluationContextTest, IsTimeGreaterThanDoesntRecordPastTimestamps) {
+TEST_F(UmEvaluationContextTest, IsTimeGreaterThanDoesntRecordPastTimestamps) {
// IsTimeGreaterThan() should ignore timestamps on the past for reevaluation.
EXPECT_TRUE(eval_ctx_->IsTimeGreaterThan(
fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(20)));
@@ -306,7 +306,7 @@
EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
}
-TEST_F(PmEvaluationContextTest, DumpContext) {
+TEST_F(UmEvaluationContextTest, DumpContext) {
// |fail_var_| yield "(no value)" since it is unset.
eval_ctx_->GetValue(&fail_var_);
@@ -319,7 +319,7 @@
eval_ctx_->GetValue(&fake_poll_var_);
// Note that the variables are printed in alphabetical order. Also
- // see PmEvaluationContextText::SetUp() where the value used for
+ // see UmEvaluationContextText::SetUp() where the value used for
// |evaluation_start| is set.
EXPECT_EQ("{\n"
" \"evaluation_start\": \"3/2/2006 1:23:45 GMT\",\n"
@@ -332,4 +332,4 @@
eval_ctx_->DumpContext());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/event_loop.cc b/update_manager/event_loop.cc
similarity index 91%
rename from policy_manager/event_loop.cc
rename to update_manager/event_loop.cc
index dc6eb30..6ae6d36 100644
--- a/policy_manager/event_loop.cc
+++ b/update_manager/event_loop.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/event_loop.h"
+#include "update_engine/update_manager/event_loop.h"
#include <cmath>
@@ -23,7 +23,7 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
EventId RunFromMainLoop(const Closure& callback) {
Closure* callback_p = new Closure(callback);
@@ -48,4 +48,4 @@
return false;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/event_loop.h b/update_manager/event_loop.h
similarity index 80%
rename from policy_manager/event_loop.h
rename to update_manager/event_loop.h
index 8a1e59e..a24e0b7 100644
--- a/policy_manager/event_loop.h
+++ b/update_manager/event_loop.h
@@ -6,15 +6,15 @@
// be replaced by the libbase main loop once the process is migrated to that
// main loop.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVENT_LOOP_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVENT_LOOP_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVENT_LOOP_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVENT_LOOP_H_
#include <glib.h>
#include <base/callback.h>
#include <base/time/time.h>
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
typedef guint EventId;
@@ -32,6 +32,6 @@
// Returns whether the event was found and removed.
bool CancelMainLoopEvent(EventId event);
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_EVENT_LOOP_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_EVENT_LOOP_H_
diff --git a/policy_manager/event_loop_unittest.cc b/update_manager/event_loop_unittest.cc
similarity index 92%
rename from policy_manager/event_loop_unittest.cc
rename to update_manager/event_loop_unittest.cc
index e568594..69325fe 100644
--- a/policy_manager/event_loop_unittest.cc
+++ b/update_manager/event_loop_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/event_loop.h"
+#include "update_engine/update_manager/event_loop.h"
#include <base/bind.h>
#include <gtest/gtest.h>
@@ -27,7 +27,7 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
class EventLoopTest : public ::testing::Test {};
@@ -59,4 +59,4 @@
EXPECT_TRUE(called);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/fake_config_provider.h b/update_manager/fake_config_provider.h
similarity index 62%
rename from policy_manager/fake_config_provider.h
rename to update_manager/fake_config_provider.h
index 7c30190..84a1794 100644
--- a/policy_manager/fake_config_provider.h
+++ b/update_manager/fake_config_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_CONFIG_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_CONFIG_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_CONFIG_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_CONFIG_PROVIDER_H_
-#include "update_engine/policy_manager/config_provider.h"
-#include "update_engine/policy_manager/fake_variable.h"
+#include "update_engine/update_manager/config_provider.h"
+#include "update_engine/update_manager/fake_variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Fake implementation of the ConfigProvider base class.
class FakeConfigProvider : public ConfigProvider {
@@ -27,6 +27,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeConfigProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_CONFIG_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_CONFIG_PROVIDER_H_
diff --git a/policy_manager/fake_device_policy_provider.h b/update_manager/fake_device_policy_provider.h
similarity index 87%
rename from policy_manager/fake_device_policy_provider.h
rename to update_manager/fake_device_policy_provider.h
index 4fa592f..665d2bb 100644
--- a/policy_manager/fake_device_policy_provider.h
+++ b/update_manager/fake_device_policy_provider.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
#include <set>
#include <string>
-#include "update_engine/policy_manager/device_policy_provider.h"
-#include "update_engine/policy_manager/fake_variable.h"
+#include "update_engine/update_manager/device_policy_provider.h"
+#include "update_engine/update_manager/fake_variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Fake implementation of the DevicePolicyProvider base class.
class FakeDevicePolicyProvider : public DevicePolicyProvider {
@@ -83,6 +83,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeDevicePolicyProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_DEVICE_POLICY_PROVIDER_H_
diff --git a/policy_manager/fake_random_provider.h b/update_manager/fake_random_provider.h
similarity index 60%
rename from policy_manager/fake_random_provider.h
rename to update_manager/fake_random_provider.h
index bfec2eb..2cf847c 100644
--- a/policy_manager/fake_random_provider.h
+++ b/update_manager/fake_random_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_RANDOM_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_RANDOM_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_RANDOM_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_RANDOM_PROVIDER_H_
-#include "update_engine/policy_manager/fake_variable.h"
-#include "update_engine/policy_manager/random_provider.h"
+#include "update_engine/update_manager/fake_variable.h"
+#include "update_engine/update_manager/random_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Fake implementation of the RandomProvider base class.
class FakeRandomProvider : public RandomProvider {
@@ -23,6 +23,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeRandomProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_RANDOM_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_RANDOM_PROVIDER_H_
diff --git a/policy_manager/fake_shill_provider.h b/update_manager/fake_shill_provider.h
similarity index 75%
rename from policy_manager/fake_shill_provider.h
rename to update_manager/fake_shill_provider.h
index ffe8751..7528cc4 100644
--- a/policy_manager/fake_shill_provider.h
+++ b/update_manager/fake_shill_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_SHILL_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_SHILL_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SHILL_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SHILL_PROVIDER_H_
-#include "update_engine/policy_manager/fake_variable.h"
-#include "update_engine/policy_manager/shill_provider.h"
+#include "update_engine/update_manager/fake_variable.h"
+#include "update_engine/update_manager/shill_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Fake implementation of the ShillProvider base class.
class FakeShillProvider : public ShillProvider {
@@ -43,6 +43,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeShillProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_SHILL_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SHILL_PROVIDER_H_
diff --git a/policy_manager/fake_state.h b/update_manager/fake_state.h
similarity index 71%
rename from policy_manager/fake_state.h
rename to update_manager/fake_state.h
index b6495e5..2af8fe8 100644
--- a/policy_manager/fake_state.h
+++ b/update_manager/fake_state.h
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_STATE_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_STATE_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_STATE_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_STATE_H_
-#include "update_engine/policy_manager/fake_config_provider.h"
-#include "update_engine/policy_manager/fake_device_policy_provider.h"
-#include "update_engine/policy_manager/fake_random_provider.h"
-#include "update_engine/policy_manager/fake_shill_provider.h"
-#include "update_engine/policy_manager/fake_system_provider.h"
-#include "update_engine/policy_manager/fake_time_provider.h"
-#include "update_engine/policy_manager/fake_updater_provider.h"
-#include "update_engine/policy_manager/state.h"
+#include "update_engine/update_manager/fake_config_provider.h"
+#include "update_engine/update_manager/fake_device_policy_provider.h"
+#include "update_engine/update_manager/fake_random_provider.h"
+#include "update_engine/update_manager/fake_shill_provider.h"
+#include "update_engine/update_manager/fake_system_provider.h"
+#include "update_engine/update_manager/fake_time_provider.h"
+#include "update_engine/update_manager/fake_updater_provider.h"
+#include "update_engine/update_manager/state.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A fake State class that creates fake providers for all the providers.
// This fake can be used in unit testing of Policy subclasses. To fake out the
@@ -74,6 +74,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeState);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_STATE_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_STATE_H_
diff --git a/policy_manager/fake_system_provider.h b/update_manager/fake_system_provider.h
similarity index 72%
rename from policy_manager/fake_system_provider.h
rename to update_manager/fake_system_provider.h
index d86e015..6a6b474 100644
--- a/policy_manager/fake_system_provider.h
+++ b/update_manager/fake_system_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_SYSTEM_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_SYSTEM_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
-#include "update_engine/policy_manager/fake_variable.h"
-#include "update_engine/policy_manager/system_provider.h"
+#include "update_engine/update_manager/fake_variable.h"
+#include "update_engine/update_manager/system_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Fake implementation of the SystemProvider base class.
class FakeSystemProvider : public SystemProvider {
@@ -38,6 +38,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeSystemProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_SYSTEM_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
diff --git a/policy_manager/fake_time_provider.h b/update_manager/fake_time_provider.h
similarity index 66%
rename from policy_manager/fake_time_provider.h
rename to update_manager/fake_time_provider.h
index d160289..861b70a 100644
--- a/policy_manager/fake_time_provider.h
+++ b/update_manager/fake_time_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_TIME_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_TIME_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_TIME_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_TIME_PROVIDER_H_
-#include "update_engine/policy_manager/fake_variable.h"
-#include "update_engine/policy_manager/time_provider.h"
+#include "update_engine/update_manager/fake_variable.h"
+#include "update_engine/update_manager/time_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Fake implementation of the TimeProvider base class.
class FakeTimeProvider : public TimeProvider {
@@ -30,6 +30,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeTimeProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_TIME_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_TIME_PROVIDER_H_
diff --git a/update_manager/fake_update_manager.h b/update_manager/fake_update_manager.h
new file mode 100644
index 0000000..0831b2e
--- /dev/null
+++ b/update_manager/fake_update_manager.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATE_MANAGER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATE_MANAGER_H_
+
+#include "update_engine/update_manager/update_manager.h"
+
+#include "update_engine/update_manager/default_policy.h"
+#include "update_engine/update_manager/fake_state.h"
+
+namespace chromeos_update_manager {
+
+class FakeUpdateManager : public UpdateManager {
+ public:
+ explicit FakeUpdateManager(chromeos_update_engine::ClockInterface* clock)
+ : UpdateManager(clock, new FakeState()) {
+ // The FakeUpdateManager uses a DefaultPolicy.
+ set_policy(new DefaultPolicy());
+ }
+
+ // UpdateManager overrides.
+ using UpdateManager::set_policy;
+
+ FakeState* state() {
+ return reinterpret_cast<FakeState*>(UpdateManager::state());
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FakeUpdateManager);
+};
+
+} // namespace chromeos_update_manager
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATE_MANAGER_H_
diff --git a/policy_manager/fake_updater_provider.h b/update_manager/fake_updater_provider.h
similarity index 87%
rename from policy_manager/fake_updater_provider.h
rename to update_manager/fake_updater_provider.h
index e8fee63..22cb9bf 100644
--- a/policy_manager/fake_updater_provider.h
+++ b/update_manager/fake_updater_provider.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_UPDATER_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_UPDATER_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATER_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATER_PROVIDER_H_
#include <string>
-#include "update_engine/policy_manager/fake_variable.h"
-#include "update_engine/policy_manager/updater_provider.h"
+#include "update_engine/update_manager/fake_variable.h"
+#include "update_engine/update_manager/updater_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Fake implementation of the UpdaterProvider base class.
class FakeUpdaterProvider : public UpdaterProvider {
@@ -89,6 +89,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeUpdaterProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_UPDATER_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_UPDATER_PROVIDER_H_
diff --git a/policy_manager/fake_variable.h b/update_manager/fake_variable.h
similarity index 85%
rename from policy_manager/fake_variable.h
rename to update_manager/fake_variable.h
index b1de9d2..0f976e3 100644
--- a/policy_manager/fake_variable.h
+++ b/update_manager/fake_variable.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_VARIABLE_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_VARIABLE_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_VARIABLE_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_VARIABLE_H_
#include <string>
#include <base/memory/scoped_ptr.h>
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A fake typed variable to use while testing policy implementations. The
// variable can be instructed to return any object of its type.
@@ -57,6 +57,6 @@
DISALLOW_COPY_AND_ASSIGN(FakeVariable);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_VARIABLE_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_FAKE_VARIABLE_H_
diff --git a/policy_manager/generic_variables.h b/update_manager/generic_variables.h
similarity index 92%
rename from policy_manager/generic_variables.h
rename to update_manager/generic_variables.h
index b010a33..5831463 100644
--- a/policy_manager/generic_variables.h
+++ b/update_manager/generic_variables.h
@@ -6,16 +6,16 @@
// used by any state provider to implement simple variables to avoid repeat the
// same common code on different state providers.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_GENERIC_VARIABLES_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_GENERIC_VARIABLES_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_GENERIC_VARIABLES_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_GENERIC_VARIABLES_H_
#include <string>
#include <base/callback.h>
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Variable class returning a copy of a given object using the copy constructor.
// This template class can be used to define variables that expose as a variable
@@ -65,8 +65,8 @@
: PollCopyVariable(name, poll_interval, ref, nullptr) {}
protected:
- FRIEND_TEST(PmPollCopyVariableTest, SimpleTest);
- FRIEND_TEST(PmPollCopyVariableTest, UseCopyConstructorTest);
+ FRIEND_TEST(UmPollCopyVariableTest, SimpleTest);
+ FRIEND_TEST(UmPollCopyVariableTest, UseCopyConstructorTest);
// Variable override.
virtual inline const T* GetValue(base::TimeDelta /* timeout */,
@@ -140,7 +140,7 @@
}
private:
- FRIEND_TEST(PmCallCopyVariableTest, SimpleTest);
+ FRIEND_TEST(UmCallCopyVariableTest, SimpleTest);
// The function to be called, stored as a base::Callback.
base::Callback<T(void)> func_;
@@ -201,6 +201,6 @@
T value_;
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_GENERIC_VARIABLES_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_GENERIC_VARIABLES_H_
diff --git a/policy_manager/generic_variables_unittest.cc b/update_manager/generic_variables_unittest.cc
similarity index 72%
rename from policy_manager/generic_variables_unittest.cc
rename to update_manager/generic_variables_unittest.cc
index 370da04..51ae4bd 100644
--- a/policy_manager/generic_variables_unittest.cc
+++ b/update_manager/generic_variables_unittest.cc
@@ -2,32 +2,32 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/generic_variables.h"
+#include "update_engine/update_manager/generic_variables.h"
#include <base/callback.h>
#include <base/memory/scoped_ptr.h>
#include <gtest/gtest.h>
-#include "update_engine/policy_manager/pmtest_utils.h"
#include "update_engine/test_utils.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::TimeDelta;
using chromeos_update_engine::RunGMainLoopMaxIterations;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmPollCopyVariableTest : public ::testing::Test {};
+class UmPollCopyVariableTest : public ::testing::Test {};
-TEST_F(PmPollCopyVariableTest, SimpleTest) {
+TEST_F(UmPollCopyVariableTest, SimpleTest) {
// Tests that copies are generated as intended.
int source = 5;
PollCopyVariable<int> var("var", source);
// Generate and validate a copy.
scoped_ptr<const int> copy_1(var.GetValue(
- PmTestUtils::DefaultTimeout(), NULL));
- PMTEST_ASSERT_NOT_NULL(copy_1.get());
+ UmTestUtils::DefaultTimeout(), NULL));
+ UMTEST_ASSERT_NOT_NULL(copy_1.get());
EXPECT_EQ(5, *copy_1);
// Assign a different value to the source variable.
@@ -37,21 +37,21 @@
EXPECT_EQ(5, *copy_1);
// Generate and validate a second copy.
- PmTestUtils::ExpectVariableHasValue(42, &var);
+ UmTestUtils::ExpectVariableHasValue(42, &var);
}
-TEST_F(PmPollCopyVariableTest, SetFlagTest) {
+TEST_F(UmPollCopyVariableTest, SetFlagTest) {
// Tests that the set flag is being referred to as expected.
int source = 5;
bool is_set = false;
PollCopyVariable<int> var("var", source, &is_set);
// Flag marked unset, nothing should be returned.
- PmTestUtils::ExpectVariableNotSet(&var);
+ UmTestUtils::ExpectVariableNotSet(&var);
// Flag marked set, we should be getting a value.
is_set = true;
- PmTestUtils::ExpectVariableHasValue(5, &var);
+ UmTestUtils::ExpectVariableHasValue(5, &var);
}
@@ -69,40 +69,40 @@
};
-TEST_F(PmPollCopyVariableTest, UseCopyConstructorTest) {
+TEST_F(UmPollCopyVariableTest, UseCopyConstructorTest) {
// Ensures that CopyVariables indeed uses the copy contructor.
const CopyConstructorTestClass source;
ASSERT_FALSE(source.copied_);
PollCopyVariable<CopyConstructorTestClass> var("var", source);
scoped_ptr<const CopyConstructorTestClass> copy(
- var.GetValue(PmTestUtils::DefaultTimeout(), NULL));
- PMTEST_ASSERT_NOT_NULL(copy.get());
+ var.GetValue(UmTestUtils::DefaultTimeout(), NULL));
+ UMTEST_ASSERT_NOT_NULL(copy.get());
EXPECT_TRUE(copy->copied_);
}
-class PmConstCopyVariableTest : public ::testing::Test {};
+class UmConstCopyVariableTest : public ::testing::Test {};
-TEST_F(PmConstCopyVariableTest, SimpleTest) {
+TEST_F(UmConstCopyVariableTest, SimpleTest) {
int source = 5;
ConstCopyVariable<int> var("var", source);
- PmTestUtils::ExpectVariableHasValue(5, &var);
+ UmTestUtils::ExpectVariableHasValue(5, &var);
// Ensure the value is cached.
source = 42;
- PmTestUtils::ExpectVariableHasValue(5, &var);
+ UmTestUtils::ExpectVariableHasValue(5, &var);
}
-class PmCallCopyVariableTest : public ::testing::Test {};
+class UmCallCopyVariableTest : public ::testing::Test {};
CopyConstructorTestClass test_func(CopyConstructorTestClass* obj) {
obj->val_++; // So we can check that the function was called.
return *obj;
}
-TEST_F(PmCallCopyVariableTest, SimpleTest) {
+TEST_F(UmCallCopyVariableTest, SimpleTest) {
// Tests that the returned value is generated by copying the value returned by
// the function call.
@@ -115,22 +115,22 @@
CallCopyVariable<CopyConstructorTestClass> var("var", cb);
scoped_ptr<const CopyConstructorTestClass> copy(
- var.GetValue(PmTestUtils::DefaultTimeout(), nullptr));
+ var.GetValue(UmTestUtils::DefaultTimeout(), nullptr));
EXPECT_EQ(6, test_obj.val_); // Check that the function was called.
- PMTEST_ASSERT_NOT_NULL(copy.get());
+ UMTEST_ASSERT_NOT_NULL(copy.get());
EXPECT_TRUE(copy->copied_);
EXPECT_EQ(12, copy->val_); // Check that copying occurred once.
}
-TEST_F(PmCallCopyVariableTest, NullTest) {
+TEST_F(UmCallCopyVariableTest, NullTest) {
// Ensures that the variable returns null when the callback is null.
base::Callback<bool(void)> cb;
CallCopyVariable<bool> var("var", cb);
- PmTestUtils::ExpectVariableNotSet(&var);
+ UmTestUtils::ExpectVariableNotSet(&var);
}
-class PmAsyncCopyVariableTest : public ::testing::Test {
+class UmAsyncCopyVariableTest : public ::testing::Test {
public:
void TearDown() {
// No remaining event on the main loop.
@@ -138,24 +138,24 @@
}
};
-TEST_F(PmAsyncCopyVariableTest, ConstructorTest) {
+TEST_F(UmAsyncCopyVariableTest, ConstructorTest) {
AsyncCopyVariable<int> var("var");
- PmTestUtils::ExpectVariableNotSet(&var);
+ UmTestUtils::ExpectVariableNotSet(&var);
EXPECT_EQ(kVariableModeAsync, var.GetMode());
}
-TEST_F(PmAsyncCopyVariableTest, SetValueTest) {
+TEST_F(UmAsyncCopyVariableTest, SetValueTest) {
AsyncCopyVariable<int> var("var");
var.SetValue(5);
- PmTestUtils::ExpectVariableHasValue(5, &var);
+ UmTestUtils::ExpectVariableHasValue(5, &var);
// Execute all the pending observers.
RunGMainLoopMaxIterations(100);
}
-TEST_F(PmAsyncCopyVariableTest, UnsetValueTest) {
+TEST_F(UmAsyncCopyVariableTest, UnsetValueTest) {
AsyncCopyVariable<int> var("var", 42);
var.UnsetValue();
- PmTestUtils::ExpectVariableNotSet(&var);
+ UmTestUtils::ExpectVariableNotSet(&var);
// Execute all the pending observers.
RunGMainLoopMaxIterations(100);
}
@@ -169,7 +169,7 @@
int calls_count_ = 0;
};
-TEST_F(PmAsyncCopyVariableTest, ObserverCalledTest) {
+TEST_F(UmAsyncCopyVariableTest, ObserverCalledTest) {
AsyncCopyVariable<int> var("var", 42);
CallCounterObserver observer;
var.AddObserver(&observer);
@@ -198,4 +198,4 @@
var.RemoveObserver(&observer);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/mock_policy.h b/update_manager/mock_policy.h
similarity index 75%
rename from policy_manager/mock_policy.h
rename to update_manager/mock_policy.h
index dbee0c2..262b246 100644
--- a/policy_manager/mock_policy.h
+++ b/update_manager/mock_policy.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_MOCK_POLICY_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_MOCK_POLICY_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_MOCK_POLICY_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_MOCK_POLICY_H_
#include <gmock/gmock.h>
-#include "update_engine/policy_manager/policy.h"
+#include "update_engine/update_manager/policy.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A mocked implementation of Policy.
class MockPolicy : public Policy {
@@ -35,6 +35,6 @@
DISALLOW_COPY_AND_ASSIGN(MockPolicy);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_MOCK_POLICY_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_MOCK_POLICY_H_
diff --git a/policy_manager/mock_variable.h b/update_manager/mock_variable.h
similarity index 61%
rename from policy_manager/mock_variable.h
rename to update_manager/mock_variable.h
index 73ae8d9..c2ba375 100644
--- a/policy_manager/mock_variable.h
+++ b/update_manager/mock_variable.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_MOCK_VARIABLE_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_MOCK_VARIABLE_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_MOCK_VARIABLE_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_MOCK_VARIABLE_H_
#include <gmock/gmock.h>
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// This is a generic mock of the Variable class.
template<typename T>
@@ -23,6 +23,6 @@
DISALLOW_COPY_AND_ASSIGN(MockVariable);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_MOCK_VARIABLE_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_MOCK_VARIABLE_H_
diff --git a/policy_manager/policy.cc b/update_manager/policy.cc
similarity index 85%
rename from policy_manager/policy.cc
rename to update_manager/policy.cc
index 32c6439..41ff8c1 100644
--- a/policy_manager/policy.cc
+++ b/update_manager/policy.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/policy.h"
+#include "update_engine/update_manager/policy.h"
#include <string>
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
string ToString(EvalStatus status) {
switch (status) {
diff --git a/policy_manager/policy.h b/update_manager/policy.h
similarity index 92%
rename from policy_manager/policy.h
rename to update_manager/policy.h
index f5fd257..65f236c 100644
--- a/policy_manager/policy.h
+++ b/update_manager/policy.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_POLICY_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_POLICY_H_
#include <string>
-#include "update_engine/policy_manager/evaluation_context.h"
-#include "update_engine/policy_manager/state.h"
+#include "update_engine/update_manager/evaluation_context.h"
+#include "update_engine/update_manager/state.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// The three different results of a policy request.
enum class EvalStatus {
@@ -132,6 +132,6 @@
DISALLOW_COPY_AND_ASSIGN(Policy);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_POLICY_H_
diff --git a/policy_manager/policy_utils.h b/update_manager/policy_utils.h
similarity index 76%
rename from policy_manager/policy_utils.h
rename to update_manager/policy_utils.h
index 61e0413..9e60167 100644
--- a/policy_manager/policy_utils.h
+++ b/update_manager/policy_utils.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_UTILS_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_UTILS_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_POLICY_UTILS_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_POLICY_UTILS_H_
-#include "update_engine/policy_manager/policy.h"
+#include "update_engine/update_manager/policy.h"
// Checks that the passed pointer value is not null, returning kFailed on the
// current context and setting the *error description when it is null. The
@@ -23,4 +23,4 @@
} \
} while (false)
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_UTILS_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_POLICY_UTILS_H_
diff --git a/policy_manager/prng.h b/update_manager/prng.h
similarity index 75%
rename from policy_manager/prng.h
rename to update_manager/prng.h
index 2063bb2..ca07e5e 100644
--- a/policy_manager/prng.h
+++ b/update_manager/prng.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PRNG_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PRNG_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_PRNG_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_PRNG_H_
#include <random>
#include <base/logging.h>
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A thread-safe, unsecure, 32-bit pseudo-random number generator based on
// std::mt19937.
@@ -34,6 +34,6 @@
DISALLOW_COPY_AND_ASSIGN(PRNG);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PRNG_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_PRNG_H_
diff --git a/policy_manager/prng_unittest.cc b/update_manager/prng_unittest.cc
similarity index 79%
rename from policy_manager/prng_unittest.cc
rename to update_manager/prng_unittest.cc
index cbe7690..4d165b3 100644
--- a/policy_manager/prng_unittest.cc
+++ b/update_manager/prng_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/prng.h"
+#include "update_engine/update_manager/prng.h"
#include <vector>
@@ -10,9 +10,9 @@
using std::vector;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-TEST(PmPRNGTest, ShouldBeDeterministic) {
+TEST(UmPRNGTest, ShouldBeDeterministic) {
PRNG a(42);
PRNG b(42);
@@ -21,7 +21,7 @@
}
}
-TEST(PmPRNGTest, SeedChangesGeneratedSequence) {
+TEST(UmPRNGTest, SeedChangesGeneratedSequence) {
PRNG a(42);
PRNG b(5);
@@ -35,7 +35,7 @@
EXPECT_NE(values_a, values_b);
}
-TEST(PmPRNGTest, IsNotConstant) {
+TEST(UmPRNGTest, IsNotConstant) {
PRNG prng(5);
uint32_t initial_value = prng.Rand();
@@ -49,7 +49,7 @@
EXPECT_FALSE(prng_is_constant) << "After 100 iterations.";
}
-TEST(PmPRNGTest, RandCoversRange) {
+TEST(UmPRNGTest, RandCoversRange) {
PRNG a(42);
int hits[11] = { 0 };
@@ -64,4 +64,4 @@
EXPECT_LT(0, hit);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/update_manager/provider.h b/update_manager/provider.h
new file mode 100644
index 0000000..3fb1d90
--- /dev/null
+++ b/update_manager/provider.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_PROVIDER_H_
+
+#include <base/basictypes.h>
+
+namespace chromeos_update_manager {
+
+// Abstract base class for a policy provider.
+class Provider {
+ public:
+ virtual ~Provider() {}
+
+ protected:
+ Provider() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Provider);
+};
+
+} // namespace chromeos_update_manager
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_PROVIDER_H_
diff --git a/policy_manager/random_provider.h b/update_manager/random_provider.h
similarity index 66%
rename from policy_manager/random_provider.h
rename to update_manager/random_provider.h
index 1a63b2d..dede41c 100644
--- a/policy_manager/random_provider.h
+++ b/update_manager/random_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_RANDOM_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_RANDOM_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_RANDOM_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_RANDOM_PROVIDER_H_
-#include "update_engine/policy_manager/provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/provider.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Provider of random values.
class RandomProvider : public Provider {
@@ -28,6 +28,6 @@
DISALLOW_COPY_AND_ASSIGN(RandomProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_RANDOM_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_RANDOM_PROVIDER_H_
diff --git a/policy_manager/real_config_provider.cc b/update_manager/real_config_provider.cc
similarity index 77%
rename from policy_manager/real_config_provider.cc
rename to update_manager/real_config_provider.cc
index df15ab3..0e76b73 100644
--- a/policy_manager/real_config_provider.cc
+++ b/update_manager/real_config_provider.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_config_provider.h"
+#include "update_engine/update_manager/real_config_provider.h"
#include <base/logging.h>
#include "update_engine/constants.h"
-#include "update_engine/policy_manager/generic_variables.h"
#include "update_engine/simple_key_value_store.h"
+#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/utils.h"
using chromeos_update_engine::KeyValueStore;
@@ -16,14 +16,14 @@
namespace {
-const char* kConfigFilePath = "/etc/policy_manager.conf";
+const char* kConfigFilePath = "/etc/update_manager.conf";
// Config options:
const char* kConfigOptsIsOOBEEnabled = "is_oobe_enabled";
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
bool RealConfigProvider::Init() {
KeyValueStore store;
@@ -33,7 +33,7 @@
} else {
if (store.Load(root_prefix_ + chromeos_update_engine::kStatefulPartition +
kConfigFilePath)) {
- LOG(INFO) << "PolicyManager Config loaded from stateful partition.";
+ LOG(INFO) << "UpdateManager Config loaded from stateful partition.";
} else {
store.Load(root_prefix_ + kConfigFilePath);
}
@@ -48,4 +48,4 @@
return true;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_config_provider.h b/update_manager/real_config_provider.h
similarity index 74%
rename from policy_manager/real_config_provider.h
rename to update_manager/real_config_provider.h
index b3a30e7..e525e38 100644
--- a/policy_manager/real_config_provider.h
+++ b/update_manager/real_config_provider.h
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_CONFIG_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_CONFIG_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_CONFIG_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_CONFIG_PROVIDER_H_
#include <string>
#include <base/memory/scoped_ptr.h>
#include "update_engine/hardware_interface.h"
-#include "update_engine/policy_manager/config_provider.h"
-#include "update_engine/policy_manager/generic_variables.h"
+#include "update_engine/update_manager/config_provider.h"
+#include "update_engine/update_manager/generic_variables.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// ConfigProvider concrete implementation.
class RealConfigProvider : public ConfigProvider {
@@ -30,7 +30,7 @@
}
private:
- friend class PmRealConfigProviderTest;
+ friend class UmRealConfigProviderTest;
// Used for testing. Sets the root prefix, which is by default "". Call this
// method before calling Init() in order to mock out the place where the files
@@ -49,6 +49,6 @@
DISALLOW_COPY_AND_ASSIGN(RealConfigProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_CONFIG_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_CONFIG_PROVIDER_H_
diff --git a/policy_manager/real_config_provider_unittest.cc b/update_manager/real_config_provider_unittest.cc
similarity index 67%
rename from policy_manager/real_config_provider_unittest.cc
rename to update_manager/real_config_provider_unittest.cc
index 2ece08b..fc20e36 100644
--- a/policy_manager/real_config_provider_unittest.cc
+++ b/update_manager/real_config_provider_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_config_provider.h"
+#include "update_engine/update_manager/real_config_provider.h"
#include <base/file_util.h>
#include <base/files/scoped_temp_dir.h>
@@ -11,16 +11,16 @@
#include "update_engine/constants.h"
#include "update_engine/fake_hardware.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
#include "update_engine/test_utils.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::TimeDelta;
using chromeos_update_engine::WriteFileString;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmRealConfigProviderTest : public ::testing::Test {
+class UmRealConfigProviderTest : public ::testing::Test {
protected:
virtual void SetUp() {
ASSERT_TRUE(root_dir_.CreateUniqueTempDir());
@@ -31,14 +31,14 @@
void WriteStatefulConfig(const string& config) {
base::FilePath kFile(root_dir_.path().value()
+ chromeos_update_engine::kStatefulPartition
- + "/etc/policy_manager.conf");
+ + "/etc/update_manager.conf");
ASSERT_TRUE(base::CreateDirectory(kFile.DirName()));
ASSERT_TRUE(WriteFileString(kFile.value(), config));
}
void WriteRootfsConfig(const string& config) {
base::FilePath kFile(root_dir_.path().value()
- + "/etc/policy_manager.conf");
+ + "/etc/update_manager.conf");
ASSERT_TRUE(base::CreateDirectory(kFile.DirName()));
ASSERT_TRUE(WriteFileString(kFile.value(), config));
}
@@ -49,40 +49,40 @@
base::ScopedTempDir root_dir_;
};
-TEST_F(PmRealConfigProviderTest, InitTest) {
+TEST_F(UmRealConfigProviderTest, InitTest) {
EXPECT_TRUE(provider_->Init());
- PMTEST_EXPECT_NOT_NULL(provider_->var_is_oobe_enabled());
+ UMTEST_EXPECT_NOT_NULL(provider_->var_is_oobe_enabled());
}
-TEST_F(PmRealConfigProviderTest, NoFileFoundReturnsDefault) {
+TEST_F(UmRealConfigProviderTest, NoFileFoundReturnsDefault) {
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableHasValue(true, provider_->var_is_oobe_enabled());
+ UmTestUtils::ExpectVariableHasValue(true, provider_->var_is_oobe_enabled());
}
-TEST_F(PmRealConfigProviderTest, DontReadStatefulInNormalMode) {
+TEST_F(UmRealConfigProviderTest, DontReadStatefulInNormalMode) {
fake_hardware_.SetIsNormalBootMode(true);
WriteStatefulConfig("is_oobe_enabled=false");
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableHasValue(true, provider_->var_is_oobe_enabled());
+ UmTestUtils::ExpectVariableHasValue(true, provider_->var_is_oobe_enabled());
}
-TEST_F(PmRealConfigProviderTest, ReadStatefulInDevMode) {
+TEST_F(UmRealConfigProviderTest, ReadStatefulInDevMode) {
fake_hardware_.SetIsNormalBootMode(false);
WriteRootfsConfig("is_oobe_enabled=true");
// Since the stateful is present, this should read that one.
WriteStatefulConfig("is_oobe_enabled=false");
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_is_oobe_enabled());
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_is_oobe_enabled());
}
-TEST_F(PmRealConfigProviderTest, ReadRootfsIfStatefulNotFound) {
+TEST_F(UmRealConfigProviderTest, ReadRootfsIfStatefulNotFound) {
fake_hardware_.SetIsNormalBootMode(false);
WriteRootfsConfig("is_oobe_enabled=false");
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_is_oobe_enabled());
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_is_oobe_enabled());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_device_policy_provider.cc b/update_manager/real_device_policy_provider.cc
similarity index 93%
rename from policy_manager/real_device_policy_provider.cc
rename to update_manager/real_device_policy_provider.cc
index d0356da..e26ffe0 100644
--- a/policy_manager/real_device_policy_provider.cc
+++ b/update_manager/real_device_policy_provider.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_device_policy_provider.h"
+#include "update_engine/update_manager/real_device_policy_provider.h"
#include <base/logging.h>
#include <base/time/time.h>
#include <policy/device_policy.h>
-#include "update_engine/policy_manager/generic_variables.h"
-#include "update_engine/policy_manager/real_shill_provider.h"
+#include "update_engine/update_manager/generic_variables.h"
+#include "update_engine/update_manager/real_shill_provider.h"
#include "update_engine/utils.h"
using base::TimeDelta;
@@ -23,7 +23,7 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
RealDevicePolicyProvider::~RealDevicePolicyProvider() {
CancelMainLoopEvent(scheduled_refresh_);
@@ -133,4 +133,4 @@
UpdateVariable(&var_au_p2p_enabled_, &DevicePolicy::GetAuP2PEnabled);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_device_policy_provider.h b/update_manager/real_device_policy_provider.h
similarity index 87%
rename from policy_manager/real_device_policy_provider.h
rename to update_manager/real_device_policy_provider.h
index bfbb299..fdbfcd9 100644
--- a/policy_manager/real_device_policy_provider.h
+++ b/update_manager/real_device_policy_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_DEVICE_POLICY_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_DEVICE_POLICY_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_DEVICE_POLICY_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_DEVICE_POLICY_PROVIDER_H_
#include <set>
#include <string>
@@ -11,11 +11,11 @@
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include <policy/libpolicy.h>
-#include "update_engine/policy_manager/device_policy_provider.h"
-#include "update_engine/policy_manager/event_loop.h"
-#include "update_engine/policy_manager/generic_variables.h"
+#include "update_engine/update_manager/device_policy_provider.h"
+#include "update_engine/update_manager/event_loop.h"
+#include "update_engine/update_manager/generic_variables.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// DevicePolicyProvider concrete implementation.
class RealDevicePolicyProvider : public DevicePolicyProvider {
@@ -69,9 +69,9 @@
}
private:
- FRIEND_TEST(PmRealDevicePolicyProviderTest, RefreshScheduledTest);
- FRIEND_TEST(PmRealDevicePolicyProviderTest, NonExistentDevicePolicyReloaded);
- FRIEND_TEST(PmRealDevicePolicyProviderTest, ValuesUpdated);
+ FRIEND_TEST(UmRealDevicePolicyProviderTest, RefreshScheduledTest);
+ FRIEND_TEST(UmRealDevicePolicyProviderTest, NonExistentDevicePolicyReloaded);
+ FRIEND_TEST(UmRealDevicePolicyProviderTest, ValuesUpdated);
// Schedules a call to periodically refresh the device policy.
void RefreshDevicePolicyAndReschedule();
@@ -130,6 +130,6 @@
DISALLOW_COPY_AND_ASSIGN(RealDevicePolicyProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_DEVICE_POLICY_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_DEVICE_POLICY_PROVIDER_H_
diff --git a/policy_manager/real_device_policy_provider_unittest.cc b/update_manager/real_device_policy_provider_unittest.cc
similarity index 73%
rename from policy_manager/real_device_policy_provider_unittest.cc
rename to update_manager/real_device_policy_provider_unittest.cc
index 6d6ccae..3b3d3e9 100644
--- a/policy_manager/real_device_policy_provider_unittest.cc
+++ b/update_manager/real_device_policy_provider_unittest.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_device_policy_provider.h"
+#include "update_engine/update_manager/real_device_policy_provider.h"
#include <base/memory/scoped_ptr.h>
#include <gtest/gtest.h>
#include <policy/mock_device_policy.h>
#include <policy/mock_libpolicy.h>
-#include "update_engine/policy_manager/pmtest_utils.h"
#include "update_engine/test_utils.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::TimeDelta;
using chromeos_update_engine::RunGMainLoopMaxIterations;
@@ -24,9 +24,9 @@
using testing::SetArgumentPointee;
using testing::_;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmRealDevicePolicyProviderTest : public ::testing::Test {
+class UmRealDevicePolicyProviderTest : public ::testing::Test {
protected:
virtual void SetUp() {
provider_.reset(new RealDevicePolicyProvider(&mock_policy_provider_));
@@ -63,19 +63,19 @@
scoped_ptr<RealDevicePolicyProvider> provider_;
};
-TEST_F(PmRealDevicePolicyProviderTest, RefreshScheduledTest) {
+TEST_F(UmRealDevicePolicyProviderTest, RefreshScheduledTest) {
// Check that the RefreshPolicy gets scheduled by checking the EventId.
EXPECT_TRUE(provider_->Init());
EXPECT_NE(kEventIdNull, provider_->scheduled_refresh_);
}
-TEST_F(PmRealDevicePolicyProviderTest, FirstReload) {
+TEST_F(UmRealDevicePolicyProviderTest, FirstReload) {
// Checks that the policy is reloaded and the DevicePolicy is consulted.
EXPECT_CALL(mock_policy_provider_, Reload());
EXPECT_TRUE(provider_->Init());
}
-TEST_F(PmRealDevicePolicyProviderTest, NonExistentDevicePolicyReloaded) {
+TEST_F(UmRealDevicePolicyProviderTest, NonExistentDevicePolicyReloaded) {
// Checks that the policy is reloaded by RefreshDevicePolicy().
SetUpNonExistentDevicePolicy();
EXPECT_CALL(mock_policy_provider_, Reload()).Times(2);
@@ -84,27 +84,27 @@
provider_->RefreshDevicePolicy();
}
-TEST_F(PmRealDevicePolicyProviderTest, NonExistentDevicePolicyEmptyVariables) {
+TEST_F(UmRealDevicePolicyProviderTest, NonExistentDevicePolicyEmptyVariables) {
SetUpNonExistentDevicePolicy();
EXPECT_CALL(mock_policy_provider_, GetDevicePolicy()).Times(0);
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableHasValue(false,
+ UmTestUtils::ExpectVariableHasValue(false,
provider_->var_device_policy_is_loaded());
- PmTestUtils::ExpectVariableNotSet(provider_->var_release_channel());
- PmTestUtils::ExpectVariableNotSet(provider_->var_release_channel_delegated());
- PmTestUtils::ExpectVariableNotSet(provider_->var_update_disabled());
- PmTestUtils::ExpectVariableNotSet(provider_->var_target_version_prefix());
- PmTestUtils::ExpectVariableNotSet(provider_->var_scatter_factor());
- PmTestUtils::ExpectVariableNotSet(
+ UmTestUtils::ExpectVariableNotSet(provider_->var_release_channel());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_release_channel_delegated());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_update_disabled());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_target_version_prefix());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_scatter_factor());
+ UmTestUtils::ExpectVariableNotSet(
provider_->var_allowed_connection_types_for_update());
- PmTestUtils::ExpectVariableNotSet(provider_->var_get_owner());
- PmTestUtils::ExpectVariableNotSet(provider_->var_http_downloads_enabled());
- PmTestUtils::ExpectVariableNotSet(provider_->var_au_p2p_enabled());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_get_owner());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_http_downloads_enabled());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_au_p2p_enabled());
}
-TEST_F(PmRealDevicePolicyProviderTest, ValuesUpdated) {
+TEST_F(UmRealDevicePolicyProviderTest, ValuesUpdated) {
SetUpNonExistentDevicePolicy();
EXPECT_TRUE(provider_->Init());
Mock::VerifyAndClearExpectations(&mock_policy_provider_);
@@ -120,36 +120,36 @@
provider_->RefreshDevicePolicy();
- PmTestUtils::ExpectVariableHasValue(true,
+ UmTestUtils::ExpectVariableHasValue(true,
provider_->var_device_policy_is_loaded());
// Test that at least one variable is set, to ensure the refresh ocurred.
- PmTestUtils::ExpectVariableHasValue(string("mychannel"),
+ UmTestUtils::ExpectVariableHasValue(string("mychannel"),
provider_->var_release_channel());
- PmTestUtils::ExpectVariableNotSet(
+ UmTestUtils::ExpectVariableNotSet(
provider_->var_allowed_connection_types_for_update());
}
-TEST_F(PmRealDevicePolicyProviderTest, ScatterFactorConverted) {
+TEST_F(UmRealDevicePolicyProviderTest, ScatterFactorConverted) {
SetUpExistentDevicePolicy();
EXPECT_CALL(mock_device_policy_, GetScatterFactorInSeconds(_))
.WillOnce(DoAll(SetArgumentPointee<0>(1234), Return(true)));
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableHasValue(base::TimeDelta::FromSeconds(1234),
+ UmTestUtils::ExpectVariableHasValue(base::TimeDelta::FromSeconds(1234),
provider_->var_scatter_factor());
}
-TEST_F(PmRealDevicePolicyProviderTest, NegativeScatterFactorIgnored) {
+TEST_F(UmRealDevicePolicyProviderTest, NegativeScatterFactorIgnored) {
SetUpExistentDevicePolicy();
EXPECT_CALL(mock_device_policy_, GetScatterFactorInSeconds(_))
.WillOnce(DoAll(SetArgumentPointee<0>(-1), Return(true)));
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableNotSet(provider_->var_scatter_factor());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_scatter_factor());
}
-TEST_F(PmRealDevicePolicyProviderTest, AllowedTypesConverted) {
+TEST_F(UmRealDevicePolicyProviderTest, AllowedTypesConverted) {
SetUpExistentDevicePolicy();
EXPECT_CALL(mock_device_policy_, GetAllowedConnectionTypesForUpdate(_))
.WillOnce(DoAll(SetArgumentPointee<0>(
@@ -157,9 +157,9 @@
Return(true)));
EXPECT_TRUE(provider_->Init());
- PmTestUtils::ExpectVariableHasValue(
+ UmTestUtils::ExpectVariableHasValue(
set<ConnectionType>{ConnectionType::kWifi, ConnectionType::kBluetooth},
provider_->var_allowed_connection_types_for_update());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_random_provider.cc b/update_manager/real_random_provider.cc
similarity index 90%
rename from policy_manager/real_random_provider.cc
rename to update_manager/real_random_provider.cc
index 17706a9..c151c4f 100644
--- a/policy_manager/real_random_provider.cc
+++ b/update_manager/real_random_provider.cc
@@ -9,8 +9,8 @@
#include <base/files/scoped_file.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/policy_manager/real_random_provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/real_random_provider.h"
+#include "update_engine/update_manager/variable.h"
using std::string;
@@ -21,7 +21,7 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A random seed variable.
class RandomSeedVariable : public Variable<uint64_t> {
@@ -71,4 +71,4 @@
return true;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_random_provider.h b/update_manager/real_random_provider.h
similarity index 67%
rename from policy_manager/real_random_provider.h
rename to update_manager/real_random_provider.h
index 07b6e47..d1de79e 100644
--- a/policy_manager/real_random_provider.h
+++ b/update_manager/real_random_provider.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_RANDOM_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_RANDOM_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_
#include <base/memory/scoped_ptr.h>
-#include "update_engine/policy_manager/random_provider.h"
+#include "update_engine/update_manager/random_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// RandomProvider implementation class.
class RealRandomProvider : public RandomProvider {
@@ -28,6 +28,6 @@
DISALLOW_COPY_AND_ASSIGN(RealRandomProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_RANDOM_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_
diff --git a/policy_manager/real_random_provider_unittest.cc b/update_manager/real_random_provider_unittest.cc
similarity index 61%
rename from policy_manager/real_random_provider_unittest.cc
rename to update_manager/real_random_provider_unittest.cc
index f61dbba..55e17fa 100644
--- a/policy_manager/real_random_provider_unittest.cc
+++ b/update_manager/real_random_provider_unittest.cc
@@ -5,19 +5,19 @@
#include <base/memory/scoped_ptr.h>
#include <gtest/gtest.h>
-#include "update_engine/policy_manager/pmtest_utils.h"
-#include "update_engine/policy_manager/real_random_provider.h"
+#include "update_engine/update_manager/real_random_provider.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::TimeDelta;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmRealRandomProviderTest : public ::testing::Test {
+class UmRealRandomProviderTest : public ::testing::Test {
protected:
virtual void SetUp() {
// The provider initializes correctly.
provider_.reset(new RealRandomProvider());
- PMTEST_ASSERT_NOT_NULL(provider_.get());
+ UMTEST_ASSERT_NOT_NULL(provider_.get());
ASSERT_TRUE(provider_->Init());
provider_->var_seed();
@@ -26,28 +26,28 @@
scoped_ptr<RealRandomProvider> provider_;
};
-TEST_F(PmRealRandomProviderTest, InitFinalize) {
+TEST_F(UmRealRandomProviderTest, InitFinalize) {
// The provider initializes all variables with valid objects.
- PMTEST_EXPECT_NOT_NULL(provider_->var_seed());
+ UMTEST_EXPECT_NOT_NULL(provider_->var_seed());
}
-TEST_F(PmRealRandomProviderTest, GetRandomValues) {
+TEST_F(UmRealRandomProviderTest, GetRandomValues) {
// Should not return the same random seed repeatedly.
scoped_ptr<const uint64_t> value(
- provider_->var_seed()->GetValue(PmTestUtils::DefaultTimeout(), nullptr));
- PMTEST_ASSERT_NOT_NULL(value.get());
+ provider_->var_seed()->GetValue(UmTestUtils::DefaultTimeout(), nullptr));
+ UMTEST_ASSERT_NOT_NULL(value.get());
// Test that at least the returned values are different. This test fails,
// by design, once every 2^320 runs.
bool is_same_value = true;
for (int i = 0; i < 5; i++) {
scoped_ptr<const uint64_t> other_value(
- provider_->var_seed()->GetValue(PmTestUtils::DefaultTimeout(),
+ provider_->var_seed()->GetValue(UmTestUtils::DefaultTimeout(),
nullptr));
- PMTEST_ASSERT_NOT_NULL(other_value.get());
+ UMTEST_ASSERT_NOT_NULL(other_value.get());
is_same_value = is_same_value && *other_value == *value;
}
EXPECT_FALSE(is_same_value);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_shill_provider.cc b/update_manager/real_shill_provider.cc
similarity index 97%
rename from policy_manager/real_shill_provider.cc
rename to update_manager/real_shill_provider.cc
index 4fbb6b2..b7a36d5 100644
--- a/policy_manager/real_shill_provider.cc
+++ b/update_manager/real_shill_provider.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_shill_provider.h"
+#include "update_engine/update_manager/real_shill_provider.h"
#include <string>
@@ -26,7 +26,7 @@
}; // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
RealShillProvider::~RealShillProvider() {
// Detach signal handler, free manager proxy.
@@ -188,4 +188,4 @@
obj->HandlePropertyChanged(proxy, name, value);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_shill_provider.h b/update_manager/real_shill_provider.h
similarity index 88%
rename from policy_manager/real_shill_provider.h
rename to update_manager/real_shill_provider.h
index 5af3232..df4f622 100644
--- a/policy_manager/real_shill_provider.h
+++ b/update_manager/real_shill_provider.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SHILL_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SHILL_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_SHILL_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_SHILL_PROVIDER_H_
// TODO(garnold) Much of the functionality in this module was adapted from the
// update engine's connection_manager. We need to make sure to deprecate use of
@@ -15,13 +15,13 @@
#include "update_engine/clock_interface.h"
#include "update_engine/dbus_wrapper_interface.h"
-#include "update_engine/policy_manager/generic_variables.h"
-#include "update_engine/policy_manager/shill_provider.h"
+#include "update_engine/update_manager/generic_variables.h"
+#include "update_engine/update_manager/shill_provider.h"
using chromeos_update_engine::ClockInterface;
using chromeos_update_engine::DBusWrapperInterface;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// ShillProvider concrete implementation.
class RealShillProvider : public ShillProvider {
@@ -92,6 +92,6 @@
DISALLOW_COPY_AND_ASSIGN(RealShillProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SHILL_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_SHILL_PROVIDER_H_
diff --git a/policy_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
similarity index 88%
rename from policy_manager/real_shill_provider_unittest.cc
rename to update_manager/real_shill_provider_unittest.cc
index 42c2ef6..faa6e05 100644
--- a/policy_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -12,9 +12,9 @@
#include "update_engine/fake_clock.h"
#include "update_engine/mock_dbus_wrapper.h"
-#include "update_engine/policy_manager/real_shill_provider.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
#include "update_engine/test_utils.h"
+#include "update_engine/update_manager/real_shill_provider.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
using base::TimeDelta;
@@ -58,9 +58,9 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmRealShillProviderTest : public ::testing::Test {
+class UmRealShillProviderTest : public ::testing::Test {
protected:
virtual void SetUp() {
// By default, initialize the provider so that it gets an initial connection
@@ -82,7 +82,7 @@
Shutdown();
provider_.reset(new RealShillProvider(&mock_dbus_, &fake_clock_));
- PMTEST_ASSERT_NOT_NULL(provider_.get());
+ UMTEST_ASSERT_NOT_NULL(provider_.get());
fake_clock_.SetWallclockTime(InitTime());
// A DBus connection should only be obtained once.
@@ -246,8 +246,8 @@
g_hash_table_unref(service_properties);
// Query the connection status, ensure last change time reported correctly.
- PmTestUtils::ExpectVariableHasValue(true, provider_->var_is_connected());
- PmTestUtils::ExpectVariableHasValue(conn_change_time,
+ UmTestUtils::ExpectVariableHasValue(true, provider_->var_is_connected());
+ UmTestUtils::ExpectVariableHasValue(conn_change_time,
provider_->var_conn_last_changed());
// Write the connection change time to the output argument.
@@ -268,9 +268,9 @@
&conn_change_time);
// Query the connection type, ensure last change time did not change.
- PmTestUtils::ExpectVariableHasValue(expected_conn_type,
+ UmTestUtils::ExpectVariableHasValue(expected_conn_type,
provider_->var_conn_type());
- PmTestUtils::ExpectVariableHasValue(conn_change_time,
+ UmTestUtils::ExpectVariableHasValue(conn_change_time,
provider_->var_conn_last_changed());
}
@@ -286,9 +286,9 @@
shill_tethering_str, &conn_change_time);
// Query the connection tethering, ensure last change time did not change.
- PmTestUtils::ExpectVariableHasValue(expected_conn_tethering,
+ UmTestUtils::ExpectVariableHasValue(expected_conn_tethering,
provider_->var_conn_tethering());
- PmTestUtils::ExpectVariableHasValue(conn_change_time,
+ UmTestUtils::ExpectVariableHasValue(conn_change_time,
provider_->var_conn_last_changed());
}
@@ -301,16 +301,16 @@
// Query the connection status, type and time last changed, as they were set
// during initialization (no signals).
-TEST_F(PmRealShillProviderTest, ReadBaseValues) {
+TEST_F(UmRealShillProviderTest, ReadBaseValues) {
// Query the provider variables.
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_is_connected());
- PmTestUtils::ExpectVariableNotSet(provider_->var_conn_type());
- PmTestUtils::ExpectVariableHasValue(InitTime(),
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_is_connected());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_conn_type());
+ UmTestUtils::ExpectVariableHasValue(InitTime(),
provider_->var_conn_last_changed());
}
// Test that Ethernet connection is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTypeEthernet) {
+TEST_F(UmRealShillProviderTest, ReadConnTypeEthernet) {
SetupConnectionAndTestType(kFakeEthernetServicePath,
kFakeEthernetServiceProxy,
shill::kTypeEthernet,
@@ -318,7 +318,7 @@
}
// Test that Wifi connection is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTypeWifi) {
+TEST_F(UmRealShillProviderTest, ReadConnTypeWifi) {
SetupConnectionAndTestType(kFakeWifiServicePath,
kFakeWifiServiceProxy,
shill::kTypeWifi,
@@ -326,7 +326,7 @@
}
// Test that Wimax connection is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTypeWimax) {
+TEST_F(UmRealShillProviderTest, ReadConnTypeWimax) {
SetupConnectionAndTestType(kFakeWimaxServicePath,
kFakeWimaxServiceProxy,
shill::kTypeWimax,
@@ -334,7 +334,7 @@
}
// Test that Bluetooth connection is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTypeBluetooth) {
+TEST_F(UmRealShillProviderTest, ReadConnTypeBluetooth) {
SetupConnectionAndTestType(kFakeBluetoothServicePath,
kFakeBluetoothServiceProxy,
shill::kTypeBluetooth,
@@ -342,7 +342,7 @@
}
// Test that Cellular connection is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTypeCellular) {
+TEST_F(UmRealShillProviderTest, ReadConnTypeCellular) {
SetupConnectionAndTestType(kFakeCellularServicePath,
kFakeCellularServiceProxy,
shill::kTypeCellular,
@@ -350,7 +350,7 @@
}
// Test that an unknown connection is identified as such.
-TEST_F(PmRealShillProviderTest, ReadConnTypeUnknown) {
+TEST_F(UmRealShillProviderTest, ReadConnTypeUnknown) {
SetupConnectionAndTestType(kFakeUnknownServicePath,
kFakeUnknownServiceProxy,
"FooConnectionType",
@@ -358,7 +358,7 @@
}
// Tests that VPN connection is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTypeVpn) {
+TEST_F(UmRealShillProviderTest, ReadConnTypeVpn) {
// Mock logic for returning a default service path and its type.
EXPECT_CALL(mock_dbus_, ProxyNewForName(
kFakeConnection, StrEq(shill::kFlimflamServiceName),
@@ -377,9 +377,9 @@
Time conn_change_time = SendDefaultServiceSignal(kFakeVpnServicePath);
// Query the connection type, ensure last change time reported correctly.
- PmTestUtils::ExpectVariableHasValue(ConnectionType::kWifi,
+ UmTestUtils::ExpectVariableHasValue(ConnectionType::kWifi,
provider_->var_conn_type());
- PmTestUtils::ExpectVariableHasValue(conn_change_time,
+ UmTestUtils::ExpectVariableHasValue(conn_change_time,
provider_->var_conn_last_changed());
// Release properties hash tables.
@@ -388,19 +388,19 @@
// Ensure that the connection type is properly cached in the provider through
// subsequent variable readings.
-TEST_F(PmRealShillProviderTest, ConnTypeCacheUsed) {
+TEST_F(UmRealShillProviderTest, ConnTypeCacheUsed) {
SetupConnectionAndTestType(kFakeEthernetServicePath,
kFakeEthernetServiceProxy,
shill::kTypeEthernet,
ConnectionType::kEthernet);
- PmTestUtils::ExpectVariableHasValue(ConnectionType::kEthernet,
+ UmTestUtils::ExpectVariableHasValue(ConnectionType::kEthernet,
provider_->var_conn_type());
}
// Ensure that the cached connection type remains valid even when a default
// connection signal occurs but the connection is not changed.
-TEST_F(PmRealShillProviderTest, ConnTypeCacheRemainsValid) {
+TEST_F(UmRealShillProviderTest, ConnTypeCacheRemainsValid) {
SetupConnectionAndTestType(kFakeEthernetServicePath,
kFakeEthernetServiceProxy,
shill::kTypeEthernet,
@@ -408,13 +408,13 @@
SendDefaultServiceSignal(kFakeEthernetServicePath);
- PmTestUtils::ExpectVariableHasValue(ConnectionType::kEthernet,
+ UmTestUtils::ExpectVariableHasValue(ConnectionType::kEthernet,
provider_->var_conn_type());
}
// Ensure that the cached connection type is invalidated and re-read when the
// default connection changes.
-TEST_F(PmRealShillProviderTest, ConnTypeCacheInvalidated) {
+TEST_F(UmRealShillProviderTest, ConnTypeCacheInvalidated) {
SetupConnectionAndTestType(kFakeEthernetServicePath,
kFakeEthernetServiceProxy,
shill::kTypeEthernet,
@@ -427,7 +427,7 @@
}
// Test that a non-tethering mode is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTetheringNotDetected) {
+TEST_F(UmRealShillProviderTest, ReadConnTetheringNotDetected) {
SetupConnectionAndTestTethering(kFakeWifiServicePath,
kFakeWifiServiceProxy,
shill::kTetheringNotDetectedState,
@@ -435,7 +435,7 @@
}
// Test that a suspected tethering mode is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTetheringSuspected) {
+TEST_F(UmRealShillProviderTest, ReadConnTetheringSuspected) {
SetupConnectionAndTestTethering(kFakeWifiServicePath,
kFakeWifiServiceProxy,
shill::kTetheringSuspectedState,
@@ -443,7 +443,7 @@
}
// Test that a confirmed tethering mode is identified correctly.
-TEST_F(PmRealShillProviderTest, ReadConnTetheringConfirmed) {
+TEST_F(UmRealShillProviderTest, ReadConnTetheringConfirmed) {
SetupConnectionAndTestTethering(kFakeWifiServicePath,
kFakeWifiServiceProxy,
shill::kTetheringConfirmedState,
@@ -451,7 +451,7 @@
}
// Test that an unknown tethering mode is identified as such.
-TEST_F(PmRealShillProviderTest, ReadConnTetheringUnknown) {
+TEST_F(UmRealShillProviderTest, ReadConnTetheringUnknown) {
SetupConnectionAndTestTethering(kFakeWifiServicePath,
kFakeWifiServiceProxy,
"FooConnTethering",
@@ -459,19 +459,19 @@
}
// Ensure that the connection tethering mode is properly cached in the provider.
-TEST_F(PmRealShillProviderTest, ConnTetheringCacheUsed) {
+TEST_F(UmRealShillProviderTest, ConnTetheringCacheUsed) {
SetupConnectionAndTestTethering(kFakeEthernetServicePath,
kFakeEthernetServiceProxy,
shill::kTetheringNotDetectedState,
ConnectionTethering::kNotDetected);
- PmTestUtils::ExpectVariableHasValue(ConnectionTethering::kNotDetected,
+ UmTestUtils::ExpectVariableHasValue(ConnectionTethering::kNotDetected,
provider_->var_conn_tethering());
}
// Ensure that the cached connection tethering mode remains valid even when a
// default connection signal occurs but the connection is not changed.
-TEST_F(PmRealShillProviderTest, ConnTetheringCacheRemainsValid) {
+TEST_F(UmRealShillProviderTest, ConnTetheringCacheRemainsValid) {
SetupConnectionAndTestTethering(kFakeEthernetServicePath,
kFakeEthernetServiceProxy,
shill::kTetheringNotDetectedState,
@@ -479,13 +479,13 @@
SendDefaultServiceSignal(kFakeEthernetServicePath);
- PmTestUtils::ExpectVariableHasValue(ConnectionTethering::kNotDetected,
+ UmTestUtils::ExpectVariableHasValue(ConnectionTethering::kNotDetected,
provider_->var_conn_tethering());
}
// Ensure that the cached connection tethering mode is invalidated and re-read
// when the default connection changes.
-TEST_F(PmRealShillProviderTest, ConnTetheringCacheInvalidated) {
+TEST_F(UmRealShillProviderTest, ConnTetheringCacheInvalidated) {
SetupConnectionAndTestTethering(kFakeEthernetServicePath,
kFakeEthernetServiceProxy,
shill::kTetheringNotDetectedState,
@@ -501,7 +501,7 @@
// give the same service path. Check connection status and the time it was last
// changed, making sure that it is the time when the first signal was sent (and
// not the second).
-TEST_F(PmRealShillProviderTest, ReadLastChangedTimeTwoSignals) {
+TEST_F(UmRealShillProviderTest, ReadLastChangedTimeTwoSignals) {
// Send a default service signal twice, advancing the clock in between.
Time conn_change_time;
SetupConnectionAndAttrs(kFakeEthernetServicePath, kFakeEthernetServiceProxy,
@@ -510,25 +510,25 @@
SendDefaultServiceSignal(kFakeEthernetServicePath);
// Query the connection status, ensure last change time reported correctly.
- PmTestUtils::ExpectVariableHasValue(true, provider_->var_is_connected());
- PmTestUtils::ExpectVariableHasValue(conn_change_time,
+ UmTestUtils::ExpectVariableHasValue(true, provider_->var_is_connected());
+ UmTestUtils::ExpectVariableHasValue(conn_change_time,
provider_->var_conn_last_changed());
}
// Make sure that the provider initializes correctly even if shill is not
// responding, that variables can be obtained, and that they all return a null
// value (indicating that the underlying values were not set).
-TEST_F(PmRealShillProviderTest, NoInitConnStatusReadBaseValues) {
+TEST_F(UmRealShillProviderTest, NoInitConnStatusReadBaseValues) {
// Re-initialize the provider, no initial connection status response.
Init(false);
- PmTestUtils::ExpectVariableNotSet(provider_->var_is_connected());
- PmTestUtils::ExpectVariableNotSet(provider_->var_conn_type());
- PmTestUtils::ExpectVariableNotSet(provider_->var_conn_last_changed());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_is_connected());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_conn_type());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_conn_last_changed());
}
// Test that, once a signal is received, the connection status and other info
// can be read correctly.
-TEST_F(PmRealShillProviderTest, NoInitConnStatusReadConnTypeEthernet) {
+TEST_F(UmRealShillProviderTest, NoInitConnStatusReadConnTypeEthernet) {
// Re-initialize the provider, no initial connection status response.
Init(false);
SetupConnectionAndTestType(kFakeEthernetServicePath,
@@ -537,4 +537,4 @@
ConnectionType::kEthernet);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_state.h b/update_manager/real_state.h
similarity index 86%
rename from policy_manager/real_state.h
rename to update_manager/real_state.h
index 7349d58..0f74214 100644
--- a/policy_manager/real_state.h
+++ b/update_manager/real_state.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_STATE_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_STATE_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_STATE_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_STATE_H_
#include <base/memory/scoped_ptr.h>
-#include "update_engine/policy_manager/state.h"
+#include "update_engine/update_manager/state.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// State concrete implementation.
class RealState : public State {
@@ -65,6 +65,6 @@
scoped_ptr<UpdaterProvider> updater_provider_;
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_STATE_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_STATE_H_
diff --git a/policy_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
similarity index 85%
rename from policy_manager/real_system_provider.cc
rename to update_manager/real_system_provider.cc
index e00c87b..c397027 100644
--- a/policy_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_system_provider.h"
+#include "update_engine/update_manager/real_system_provider.h"
#include <string.h>
#include <sys/stat.h>
@@ -17,7 +17,7 @@
#include <base/time/time.h>
#include <vboot/crossystem.h>
-#include "update_engine/policy_manager/generic_variables.h"
+#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/utils.h"
using base::StringPrintf;
@@ -26,7 +26,7 @@
using std::string;
using std::vector;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
bool RealSystemProvider::Init() {
var_is_normal_boot_mode_.reset(
@@ -46,4 +46,4 @@
return true;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_system_provider.h b/update_manager/real_system_provider.h
similarity index 78%
rename from policy_manager/real_system_provider.h
rename to update_manager/real_system_provider.h
index 8d95387..b4c401e 100644
--- a/policy_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SYSTEM_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SYSTEM_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
#include <base/memory/scoped_ptr.h>
#include <string>
#include "update_engine/hardware_interface.h"
-#include "update_engine/policy_manager/system_provider.h"
+#include "update_engine/update_manager/system_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// SystemProvider concrete implementation.
class RealSystemProvider : public SystemProvider {
@@ -46,6 +46,6 @@
DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SYSTEM_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
diff --git a/update_manager/real_system_provider_unittest.cc b/update_manager/real_system_provider_unittest.cc
new file mode 100644
index 0000000..d744671
--- /dev/null
+++ b/update_manager/real_system_provider_unittest.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "update_engine/update_manager/real_system_provider.h"
+
+#include <base/memory/scoped_ptr.h>
+#include <base/time/time.h>
+#include <gtest/gtest.h>
+
+#include "update_engine/fake_hardware.h"
+#include "update_engine/update_manager/umtest_utils.h"
+
+namespace chromeos_update_manager {
+
+class UmRealSystemProviderTest : public ::testing::Test {
+ protected:
+ virtual void SetUp() {
+ provider_.reset(new RealSystemProvider(&fake_hardware_));
+ EXPECT_TRUE(provider_->Init());
+ }
+
+ chromeos_update_engine::FakeHardware fake_hardware_;
+ scoped_ptr<RealSystemProvider> provider_;
+};
+
+TEST_F(UmRealSystemProviderTest, InitTest) {
+ UMTEST_EXPECT_NOT_NULL(provider_->var_is_normal_boot_mode());
+ UMTEST_EXPECT_NOT_NULL(provider_->var_is_official_build());
+ UMTEST_EXPECT_NOT_NULL(provider_->var_is_oobe_complete());
+}
+
+TEST_F(UmRealSystemProviderTest, IsOOBECompleteTrue) {
+ fake_hardware_.SetIsOOBEComplete(base::Time());
+ UmTestUtils::ExpectVariableHasValue(true, provider_->var_is_oobe_complete());
+}
+
+TEST_F(UmRealSystemProviderTest, IsOOBECompleteFalse) {
+ fake_hardware_.UnsetIsOOBEComplete();
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_is_oobe_complete());
+}
+
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_time_provider.cc b/update_manager/real_time_provider.cc
similarity index 93%
rename from policy_manager/real_time_provider.cc
rename to update_manager/real_time_provider.cc
index 1693c73..9067bdd 100644
--- a/policy_manager/real_time_provider.cc
+++ b/update_manager/real_time_provider.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_time_provider.h"
+#include "update_engine/update_manager/real_time_provider.h"
#include <base/time/time.h>
@@ -13,7 +13,7 @@
using chromeos_update_engine::ClockInterface;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A variable returning the current date.
class CurrDateVariable : public Variable<Time> {
@@ -66,4 +66,4 @@
return true;
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_time_provider.h b/update_manager/real_time_provider.h
similarity index 76%
rename from policy_manager/real_time_provider.h
rename to update_manager/real_time_provider.h
index d6d1177..ac60336 100644
--- a/policy_manager/real_time_provider.h
+++ b/update_manager/real_time_provider.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_TIME_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_TIME_PROVIDER_H_
#include <base/memory/scoped_ptr.h>
#include <base/time/time.h>
#include "update_engine/clock_interface.h"
-#include "update_engine/policy_manager/time_provider.h"
+#include "update_engine/update_manager/time_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// TimeProvider concrete implementation.
class RealTimeProvider : public TimeProvider {
@@ -40,6 +40,6 @@
DISALLOW_COPY_AND_ASSIGN(RealTimeProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_TIME_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_TIME_PROVIDER_H_
diff --git a/policy_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc
similarity index 75%
rename from policy_manager/real_time_provider_unittest.cc
rename to update_manager/real_time_provider_unittest.cc
index e6594aa..6b236db 100644
--- a/policy_manager/real_time_provider_unittest.cc
+++ b/update_manager/real_time_provider_unittest.cc
@@ -8,21 +8,21 @@
#include <gtest/gtest.h>
#include "update_engine/fake_clock.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
-#include "update_engine/policy_manager/real_time_provider.h"
+#include "update_engine/update_manager/real_time_provider.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
using base::TimeDelta;
using chromeos_update_engine::FakeClock;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmRealTimeProviderTest : public ::testing::Test {
+class UmRealTimeProviderTest : public ::testing::Test {
protected:
virtual void SetUp() {
// The provider initializes correctly.
provider_.reset(new RealTimeProvider(&fake_clock_));
- PMTEST_ASSERT_NOT_NULL(provider_.get());
+ UMTEST_ASSERT_NOT_NULL(provider_.get());
ASSERT_TRUE(provider_->Init());
}
@@ -44,7 +44,7 @@
scoped_ptr<RealTimeProvider> provider_;
};
-TEST_F(PmRealTimeProviderTest, CurrDateValid) {
+TEST_F(UmRealTimeProviderTest, CurrDateValid) {
const Time now = CurrTime();
Time::Exploded exploded;
now.LocalExplode(&exploded);
@@ -55,16 +55,16 @@
const Time expected = Time::FromLocalExploded(exploded);
fake_clock_.SetWallclockTime(now);
- PmTestUtils::ExpectVariableHasValue(expected, provider_->var_curr_date());
+ UmTestUtils::ExpectVariableHasValue(expected, provider_->var_curr_date());
}
-TEST_F(PmRealTimeProviderTest, CurrHourValid) {
+TEST_F(UmRealTimeProviderTest, CurrHourValid) {
const Time now = CurrTime();
Time::Exploded expected;
now.LocalExplode(&expected);
fake_clock_.SetWallclockTime(now);
- PmTestUtils::ExpectVariableHasValue(expected.hour,
+ UmTestUtils::ExpectVariableHasValue(expected.hour,
provider_->var_curr_hour());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_updater_provider.cc b/update_manager/real_updater_provider.cc
similarity index 98%
rename from policy_manager/real_updater_provider.cc
rename to update_manager/real_updater_provider.cc
index 4455e7f..7863019 100644
--- a/policy_manager/real_updater_provider.cc
+++ b/update_manager/real_updater_provider.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_updater_provider.h"
+#include "update_engine/update_manager/real_updater_provider.h"
#include <inttypes.h>
@@ -24,7 +24,7 @@
using chromeos_update_engine::SystemState;
using std::string;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A templated base class for all update related variables. Provides uniform
// construction and a system state handle.
@@ -355,4 +355,4 @@
new ConsecutiveFailedUpdateChecksVariable(
"consecutive_failed_update_checks", system_state_)) {}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/real_updater_provider.h b/update_manager/real_updater_provider.h
similarity index 88%
rename from policy_manager/real_updater_provider.h
rename to update_manager/real_updater_provider.h
index 7ed0b4e..d7e3f06 100644
--- a/policy_manager/real_updater_provider.h
+++ b/update_manager/real_updater_provider.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_UPDATER_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_UPDATER_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_UPDATER_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_UPDATER_PROVIDER_H_
#include <base/memory/scoped_ptr.h>
-#include "update_engine/policy_manager/generic_variables.h"
-#include "update_engine/policy_manager/updater_provider.h"
#include "update_engine/system_state.h"
+#include "update_engine/update_manager/generic_variables.h"
+#include "update_engine/update_manager/updater_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// A concrete UpdaterProvider implementation using local (in-process) bindings.
class RealUpdaterProvider : public UpdaterProvider {
@@ -97,6 +97,6 @@
DISALLOW_COPY_AND_ASSIGN(RealUpdaterProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_UPDATER_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_REAL_UPDATER_PROVIDER_H_
diff --git a/policy_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
similarity index 69%
rename from policy_manager/real_updater_provider_unittest.cc
rename to update_manager/real_updater_provider_unittest.cc
index 7e2be74..7bea777 100644
--- a/policy_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/real_updater_provider.h"
+#include "update_engine/update_manager/real_updater_provider.h"
#include <string>
@@ -14,9 +14,9 @@
#include "update_engine/fake_clock.h"
#include "update_engine/fake_system_state.h"
#include "update_engine/omaha_request_params.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
#include "update_engine/prefs_mock.h"
#include "update_engine/update_attempter_mock.h"
+#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
using base::TimeDelta;
@@ -58,14 +58,14 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmRealUpdaterProviderTest : public ::testing::Test {
+class UmRealUpdaterProviderTest : public ::testing::Test {
protected:
virtual void SetUp() {
fake_clock_ = fake_sys_state_.fake_clock();
provider_.reset(new RealUpdaterProvider(&fake_sys_state_));
- PMTEST_ASSERT_NOT_NULL(provider_.get());
+ UMTEST_ASSERT_NOT_NULL(provider_.get());
// Check that provider initializes corrrectly.
ASSERT_TRUE(provider_->Init());
}
@@ -111,347 +111,347 @@
scoped_ptr<RealUpdaterProvider> provider_;
};
-TEST_F(PmRealUpdaterProviderTest, UpdaterStartedTimeIsWallclockTime) {
+TEST_F(UmRealUpdaterProviderTest, UpdaterStartedTimeIsWallclockTime) {
fake_clock_->SetWallclockTime(Time::FromDoubleT(123.456));
fake_clock_->SetMonotonicTime(Time::FromDoubleT(456.123));
// Run SetUp again to re-setup the provider under test to use these values.
SetUp();
- PmTestUtils::ExpectVariableHasValue(Time::FromDoubleT(123.456),
+ UmTestUtils::ExpectVariableHasValue(Time::FromDoubleT(123.456),
provider_->var_updater_started_time());
}
-TEST_F(PmRealUpdaterProviderTest, GetLastCheckedTimeOkay) {
+TEST_F(UmRealUpdaterProviderTest, GetLastCheckedTimeOkay) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<0>(FixedTime().ToTimeT()), Return(true)));
- PmTestUtils::ExpectVariableHasValue(RoundedToSecond(FixedTime()),
+ UmTestUtils::ExpectVariableHasValue(RoundedToSecond(FixedTime()),
provider_->var_last_checked_time());
}
-TEST_F(PmRealUpdaterProviderTest, GetLastCheckedTimeFailNoValue) {
+TEST_F(UmRealUpdaterProviderTest, GetLastCheckedTimeFailNoValue) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(Return(false));
- PmTestUtils::ExpectVariableNotSet(provider_->var_last_checked_time());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_last_checked_time());
}
-TEST_F(PmRealUpdaterProviderTest, GetProgressOkayMin) {
+TEST_F(UmRealUpdaterProviderTest, GetProgressOkayMin) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<1>(0.0), Return(true)));
- PmTestUtils::ExpectVariableHasValue(0.0, provider_->var_progress());
+ UmTestUtils::ExpectVariableHasValue(0.0, provider_->var_progress());
}
-TEST_F(PmRealUpdaterProviderTest, GetProgressOkayMid) {
+TEST_F(UmRealUpdaterProviderTest, GetProgressOkayMid) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<1>(0.3), Return(true)));
- PmTestUtils::ExpectVariableHasValue(0.3, provider_->var_progress());
+ UmTestUtils::ExpectVariableHasValue(0.3, provider_->var_progress());
}
-TEST_F(PmRealUpdaterProviderTest, GetProgressOkayMax) {
+TEST_F(UmRealUpdaterProviderTest, GetProgressOkayMax) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<1>(1.0), Return(true)));
- PmTestUtils::ExpectVariableHasValue(1.0, provider_->var_progress());
+ UmTestUtils::ExpectVariableHasValue(1.0, provider_->var_progress());
}
-TEST_F(PmRealUpdaterProviderTest, GetProgressFailNoValue) {
+TEST_F(UmRealUpdaterProviderTest, GetProgressFailNoValue) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(Return(false));
- PmTestUtils::ExpectVariableNotSet(provider_->var_progress());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_progress());
}
-TEST_F(PmRealUpdaterProviderTest, GetProgressFailTooSmall) {
+TEST_F(UmRealUpdaterProviderTest, GetProgressFailTooSmall) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<1>(-2.0), Return(true)));
- PmTestUtils::ExpectVariableNotSet(provider_->var_progress());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_progress());
}
-TEST_F(PmRealUpdaterProviderTest, GetProgressFailTooBig) {
+TEST_F(UmRealUpdaterProviderTest, GetProgressFailTooBig) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<1>(2.0), Return(true)));
- PmTestUtils::ExpectVariableNotSet(provider_->var_progress());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_progress());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayIdle) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayIdle) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<2>(update_engine::kUpdateStatusIdle),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kIdle, provider_->var_stage());
+ UmTestUtils::ExpectVariableHasValue(Stage::kIdle, provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayCheckingForUpdate) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayCheckingForUpdate) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(
SetArgPointee<2>(update_engine::kUpdateStatusCheckingForUpdate),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kCheckingForUpdate,
+ UmTestUtils::ExpectVariableHasValue(Stage::kCheckingForUpdate,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayUpdateAvailable) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayUpdateAvailable) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(
SetArgPointee<2>(update_engine::kUpdateStatusUpdateAvailable),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kUpdateAvailable,
+ UmTestUtils::ExpectVariableHasValue(Stage::kUpdateAvailable,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayDownloading) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayDownloading) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<2>(update_engine::kUpdateStatusDownloading),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kDownloading,
+ UmTestUtils::ExpectVariableHasValue(Stage::kDownloading,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayVerifying) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayVerifying) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<2>(update_engine::kUpdateStatusVerifying),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kVerifying,
+ UmTestUtils::ExpectVariableHasValue(Stage::kVerifying,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayFinalizing) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayFinalizing) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<2>(update_engine::kUpdateStatusFinalizing),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kFinalizing,
+ UmTestUtils::ExpectVariableHasValue(Stage::kFinalizing,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayUpdatedNeedReboot) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayUpdatedNeedReboot) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(
SetArgPointee<2>(update_engine::kUpdateStatusUpdatedNeedReboot),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kUpdatedNeedReboot,
+ UmTestUtils::ExpectVariableHasValue(Stage::kUpdatedNeedReboot,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayReportingErrorEvent) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayReportingErrorEvent) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(
SetArgPointee<2>(update_engine::kUpdateStatusReportingErrorEvent),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kReportingErrorEvent,
+ UmTestUtils::ExpectVariableHasValue(Stage::kReportingErrorEvent,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageOkayAttemptingRollback) {
+TEST_F(UmRealUpdaterProviderTest, GetStageOkayAttemptingRollback) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(
SetArgPointee<2>(update_engine::kUpdateStatusAttemptingRollback),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(Stage::kAttemptingRollback,
+ UmTestUtils::ExpectVariableHasValue(Stage::kAttemptingRollback,
provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageFailNoValue) {
+TEST_F(UmRealUpdaterProviderTest, GetStageFailNoValue) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(Return(false));
- PmTestUtils::ExpectVariableNotSet(provider_->var_stage());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageFailUnknown) {
+TEST_F(UmRealUpdaterProviderTest, GetStageFailUnknown) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<2>("FooUpdateEngineState"),
Return(true)));
- PmTestUtils::ExpectVariableNotSet(provider_->var_stage());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetStageFailEmpty) {
+TEST_F(UmRealUpdaterProviderTest, GetStageFailEmpty) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<2>(""), Return(true)));
- PmTestUtils::ExpectVariableNotSet(provider_->var_stage());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_stage());
}
-TEST_F(PmRealUpdaterProviderTest, GetNewVersionOkay) {
+TEST_F(UmRealUpdaterProviderTest, GetNewVersionOkay) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<3>("1.2.0"), Return(true)));
- PmTestUtils::ExpectVariableHasValue(string("1.2.0"),
+ UmTestUtils::ExpectVariableHasValue(string("1.2.0"),
provider_->var_new_version());
}
-TEST_F(PmRealUpdaterProviderTest, GetNewVersionFailNoValue) {
+TEST_F(UmRealUpdaterProviderTest, GetNewVersionFailNoValue) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(Return(false));
- PmTestUtils::ExpectVariableNotSet(provider_->var_new_version());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_new_version());
}
-TEST_F(PmRealUpdaterProviderTest, GetPayloadSizeOkayZero) {
+TEST_F(UmRealUpdaterProviderTest, GetPayloadSizeOkayZero) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<4>(static_cast<int64_t>(0)), Return(true)));
- PmTestUtils::ExpectVariableHasValue(static_cast<int64_t>(0),
+ UmTestUtils::ExpectVariableHasValue(static_cast<int64_t>(0),
provider_->var_payload_size());
}
-TEST_F(PmRealUpdaterProviderTest, GetPayloadSizeOkayArbitrary) {
+TEST_F(UmRealUpdaterProviderTest, GetPayloadSizeOkayArbitrary) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<4>(static_cast<int64_t>(567890)),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(static_cast<int64_t>(567890),
+ UmTestUtils::ExpectVariableHasValue(static_cast<int64_t>(567890),
provider_->var_payload_size());
}
-TEST_F(PmRealUpdaterProviderTest, GetPayloadSizeOkayTwoGigabytes) {
+TEST_F(UmRealUpdaterProviderTest, GetPayloadSizeOkayTwoGigabytes) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<4>(static_cast<int64_t>(1) << 31),
Return(true)));
- PmTestUtils::ExpectVariableHasValue(static_cast<int64_t>(1) << 31,
+ UmTestUtils::ExpectVariableHasValue(static_cast<int64_t>(1) << 31,
provider_->var_payload_size());
}
-TEST_F(PmRealUpdaterProviderTest, GetPayloadSizeFailNoValue) {
+TEST_F(UmRealUpdaterProviderTest, GetPayloadSizeFailNoValue) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(Return(false));
- PmTestUtils::ExpectVariableNotSet(provider_->var_payload_size());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_payload_size());
}
-TEST_F(PmRealUpdaterProviderTest, GetPayloadSizeFailNegative) {
+TEST_F(UmRealUpdaterProviderTest, GetPayloadSizeFailNegative) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
GetStatus(_, _, _, _, _))
.WillOnce(DoAll(SetArgPointee<4>(static_cast<int64_t>(-1024)),
Return(true)));
- PmTestUtils::ExpectVariableNotSet(provider_->var_payload_size());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_payload_size());
}
-TEST_F(PmRealUpdaterProviderTest, GetCurrChannelOkay) {
+TEST_F(UmRealUpdaterProviderTest, GetCurrChannelOkay) {
const string kChannelName("foo-channel");
OmahaRequestParams request_params(&fake_sys_state_);
request_params.Init("", "", false);
request_params.set_current_channel(kChannelName);
fake_sys_state_.set_request_params(&request_params);
- PmTestUtils::ExpectVariableHasValue(kChannelName,
+ UmTestUtils::ExpectVariableHasValue(kChannelName,
provider_->var_curr_channel());
}
-TEST_F(PmRealUpdaterProviderTest, GetCurrChannelFailEmpty) {
+TEST_F(UmRealUpdaterProviderTest, GetCurrChannelFailEmpty) {
OmahaRequestParams request_params(&fake_sys_state_);
request_params.Init("", "", false);
request_params.set_current_channel("");
fake_sys_state_.set_request_params(&request_params);
- PmTestUtils::ExpectVariableNotSet(provider_->var_curr_channel());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_curr_channel());
}
-TEST_F(PmRealUpdaterProviderTest, GetNewChannelOkay) {
+TEST_F(UmRealUpdaterProviderTest, GetNewChannelOkay) {
const string kChannelName("foo-channel");
OmahaRequestParams request_params(&fake_sys_state_);
request_params.Init("", "", false);
request_params.set_target_channel(kChannelName);
fake_sys_state_.set_request_params(&request_params);
- PmTestUtils::ExpectVariableHasValue(kChannelName,
+ UmTestUtils::ExpectVariableHasValue(kChannelName,
provider_->var_new_channel());
}
-TEST_F(PmRealUpdaterProviderTest, GetNewChannelFailEmpty) {
+TEST_F(UmRealUpdaterProviderTest, GetNewChannelFailEmpty) {
OmahaRequestParams request_params(&fake_sys_state_);
request_params.Init("", "", false);
request_params.set_target_channel("");
fake_sys_state_.set_request_params(&request_params);
- PmTestUtils::ExpectVariableNotSet(provider_->var_new_channel());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_new_channel());
}
-TEST_F(PmRealUpdaterProviderTest, GetP2PEnabledOkayPrefDoesntExist) {
+TEST_F(UmRealUpdaterProviderTest, GetP2PEnabledOkayPrefDoesntExist) {
SetupReadBooleanPref(chromeos_update_engine::kPrefsP2PEnabled,
false, false, false);
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_p2p_enabled());
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_p2p_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetP2PEnabledOkayPrefReadsFalse) {
+TEST_F(UmRealUpdaterProviderTest, GetP2PEnabledOkayPrefReadsFalse) {
SetupReadBooleanPref(chromeos_update_engine::kPrefsP2PEnabled,
true, true, false);
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_p2p_enabled());
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_p2p_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetP2PEnabledOkayPrefReadsTrue) {
+TEST_F(UmRealUpdaterProviderTest, GetP2PEnabledOkayPrefReadsTrue) {
SetupReadBooleanPref(chromeos_update_engine::kPrefsP2PEnabled,
true, true, true);
- PmTestUtils::ExpectVariableHasValue(true, provider_->var_p2p_enabled());
+ UmTestUtils::ExpectVariableHasValue(true, provider_->var_p2p_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetP2PEnabledFailCannotReadPref) {
+TEST_F(UmRealUpdaterProviderTest, GetP2PEnabledFailCannotReadPref) {
SetupReadBooleanPref(chromeos_update_engine::kPrefsP2PEnabled,
true, false, false);
- PmTestUtils::ExpectVariableNotSet(provider_->var_p2p_enabled());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_p2p_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetCellularEnabledOkayPrefDoesntExist) {
+TEST_F(UmRealUpdaterProviderTest, GetCellularEnabledOkayPrefDoesntExist) {
SetupReadBooleanPref(
chromeos_update_engine::kPrefsUpdateOverCellularPermission,
false, false, false);
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_cellular_enabled());
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_cellular_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetCellularEnabledOkayPrefReadsFalse) {
+TEST_F(UmRealUpdaterProviderTest, GetCellularEnabledOkayPrefReadsFalse) {
SetupReadBooleanPref(
chromeos_update_engine::kPrefsUpdateOverCellularPermission,
true, true, false);
- PmTestUtils::ExpectVariableHasValue(false, provider_->var_cellular_enabled());
+ UmTestUtils::ExpectVariableHasValue(false, provider_->var_cellular_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetCellularEnabledOkayPrefReadsTrue) {
+TEST_F(UmRealUpdaterProviderTest, GetCellularEnabledOkayPrefReadsTrue) {
SetupReadBooleanPref(
chromeos_update_engine::kPrefsUpdateOverCellularPermission,
true, true, true);
- PmTestUtils::ExpectVariableHasValue(true, provider_->var_cellular_enabled());
+ UmTestUtils::ExpectVariableHasValue(true, provider_->var_cellular_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetCellularEnabledFailCannotReadPref) {
+TEST_F(UmRealUpdaterProviderTest, GetCellularEnabledFailCannotReadPref) {
SetupReadBooleanPref(
chromeos_update_engine::kPrefsUpdateOverCellularPermission,
true, false, false);
- PmTestUtils::ExpectVariableNotSet(provider_->var_cellular_enabled());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_cellular_enabled());
}
-TEST_F(PmRealUpdaterProviderTest, GetUpdateCompletedTimeOkay) {
+TEST_F(UmRealUpdaterProviderTest, GetUpdateCompletedTimeOkay) {
Time expected = SetupUpdateCompletedTime(true);
- PmTestUtils::ExpectVariableHasValue(expected,
+ UmTestUtils::ExpectVariableHasValue(expected,
provider_->var_update_completed_time());
}
-TEST_F(PmRealUpdaterProviderTest, GetUpdateCompletedTimeFailNoValue) {
+TEST_F(UmRealUpdaterProviderTest, GetUpdateCompletedTimeFailNoValue) {
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(), GetBootTimeAtUpdate(_))
.WillOnce(Return(false));
- PmTestUtils::ExpectVariableNotSet(provider_->var_update_completed_time());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_update_completed_time());
}
-TEST_F(PmRealUpdaterProviderTest, GetUpdateCompletedTimeFailInvalidValue) {
+TEST_F(UmRealUpdaterProviderTest, GetUpdateCompletedTimeFailInvalidValue) {
SetupUpdateCompletedTime(false);
- PmTestUtils::ExpectVariableNotSet(provider_->var_update_completed_time());
+ UmTestUtils::ExpectVariableNotSet(provider_->var_update_completed_time());
}
-TEST_F(PmRealUpdaterProviderTest, GetConsecutiveFailedUpdateChecks) {
+TEST_F(UmRealUpdaterProviderTest, GetConsecutiveFailedUpdateChecks) {
const unsigned int kNumFailedChecks = 3;
EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
consecutive_failed_update_checks())
.WillRepeatedly(Return(kNumFailedChecks));
- PmTestUtils::ExpectVariableHasValue(
+ UmTestUtils::ExpectVariableHasValue(
kNumFailedChecks, provider_->var_consecutive_failed_update_checks());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/shill_provider.h b/update_manager/shill_provider.h
similarity index 77%
rename from policy_manager/shill_provider.h
rename to update_manager/shill_provider.h
index cd9743b..51180fa 100644
--- a/policy_manager/shill_provider.h
+++ b/update_manager/shill_provider.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SHILL_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SHILL_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
#include <base/time/time.h>
-#include "update_engine/policy_manager/provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/provider.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
enum class ConnectionType {
kEthernet,
@@ -55,6 +55,6 @@
DISALLOW_COPY_AND_ASSIGN(ShillProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SHILL_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
diff --git a/update_manager/state.h b/update_manager/state.h
new file mode 100644
index 0000000..0fe4116
--- /dev/null
+++ b/update_manager/state.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_STATE_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_STATE_H_
+
+#include "update_engine/update_manager/config_provider.h"
+#include "update_engine/update_manager/device_policy_provider.h"
+#include "update_engine/update_manager/random_provider.h"
+#include "update_engine/update_manager/shill_provider.h"
+#include "update_engine/update_manager/system_provider.h"
+#include "update_engine/update_manager/time_provider.h"
+#include "update_engine/update_manager/updater_provider.h"
+
+namespace chromeos_update_manager {
+
+// The State class is an interface to the ensemble of providers. This class
+// gives visibility of the state providers to policy implementations.
+class State {
+ public:
+ virtual ~State() {}
+
+ // These methods return the given provider.
+ virtual ConfigProvider* config_provider() = 0;
+ virtual DevicePolicyProvider* device_policy_provider() = 0;
+ virtual RandomProvider* random_provider() = 0;
+ virtual ShillProvider* shill_provider() = 0;
+ virtual SystemProvider* system_provider() = 0;
+ virtual TimeProvider* time_provider() = 0;
+ virtual UpdaterProvider* updater_provider() = 0;
+
+ protected:
+ State() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(State);
+};
+
+} // namespace chromeos_update_manager
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_STATE_H_
diff --git a/policy_manager/state_factory.cc b/update_manager/state_factory.cc
similarity index 75%
rename from policy_manager/state_factory.cc
rename to update_manager/state_factory.cc
index 88a8ee0..6aa1761 100644
--- a/policy_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/state_factory.h"
+#include "update_engine/update_manager/state_factory.h"
#include <base/logging.h>
#include <base/memory/scoped_ptr.h>
#include "update_engine/clock_interface.h"
-#include "update_engine/policy_manager/real_config_provider.h"
-#include "update_engine/policy_manager/real_device_policy_provider.h"
-#include "update_engine/policy_manager/real_random_provider.h"
-#include "update_engine/policy_manager/real_shill_provider.h"
-#include "update_engine/policy_manager/real_state.h"
-#include "update_engine/policy_manager/real_system_provider.h"
-#include "update_engine/policy_manager/real_time_provider.h"
-#include "update_engine/policy_manager/real_updater_provider.h"
+#include "update_engine/update_manager/real_config_provider.h"
+#include "update_engine/update_manager/real_device_policy_provider.h"
+#include "update_engine/update_manager/real_random_provider.h"
+#include "update_engine/update_manager/real_shill_provider.h"
+#include "update_engine/update_manager/real_state.h"
+#include "update_engine/update_manager/real_system_provider.h"
+#include "update_engine/update_manager/real_time_provider.h"
+#include "update_engine/update_manager/real_updater_provider.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
State* DefaultStateFactory(policy::PolicyProvider* policy_provider,
chromeos_update_engine::DBusWrapperInterface* dbus,
@@ -56,4 +56,4 @@
updater_provider.release());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/state_factory.h b/update_manager/state_factory.h
similarity index 66%
rename from policy_manager/state_factory.h
rename to update_manager/state_factory.h
index bc60ba1..8e97554 100644
--- a/policy_manager/state_factory.h
+++ b/update_manager/state_factory.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_STATE_FACTORY_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_STATE_FACTORY_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_STATE_FACTORY_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_STATE_FACTORY_H_
#include "update_engine/dbus_wrapper_interface.h"
-#include "update_engine/policy_manager/state.h"
#include "update_engine/system_state.h"
+#include "update_engine/update_manager/state.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-// Creates and initializes a new PolicyManager State instance containing real
+// Creates and initializes a new UpdateManager State instance containing real
// providers instantiated using the passed interfaces. The State doesn't take
// ownership of the passed interfaces, which need to remain available during the
// life of this instance. Returns null if one of the underlying providers fails
@@ -21,6 +21,6 @@
chromeos_update_engine::DBusWrapperInterface* dbus,
chromeos_update_engine::SystemState* system_state);
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_STATE_FACTORY_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_STATE_FACTORY_H_
diff --git a/policy_manager/system_provider.h b/update_manager/system_provider.h
similarity index 72%
rename from policy_manager/system_provider.h
rename to update_manager/system_provider.h
index dae3a9a..831f377 100644
--- a/policy_manager/system_provider.h
+++ b/update_manager/system_provider.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_SYSTEM_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_SYSTEM_PROVIDER_H_
-#include "update_engine/policy_manager/provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/provider.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Provider for system information, mostly constant, such as the information
// reported by crossystem, the kernel boot command line and the partition table.
@@ -34,6 +34,6 @@
DISALLOW_COPY_AND_ASSIGN(SystemProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_SYSTEM_PROVIDER_H_
diff --git a/policy_manager/time_provider.h b/update_manager/time_provider.h
similarity index 66%
rename from policy_manager/time_provider.h
rename to update_manager/time_provider.h
index 5baa140..146d250 100644
--- a/policy_manager/time_provider.h
+++ b/update_manager/time_provider.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_TIME_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_TIME_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_
#include <base/time/time.h>
-#include "update_engine/policy_manager/provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/provider.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Provider for time related information.
class TimeProvider : public Provider {
@@ -31,6 +31,6 @@
DISALLOW_COPY_AND_ASSIGN(TimeProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_TIME_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_TIME_PROVIDER_H_
diff --git a/policy_manager/pmtest_utils.cc b/update_manager/umtest_utils.cc
similarity index 61%
rename from policy_manager/pmtest_utils.cc
rename to update_manager/umtest_utils.cc
index 1c53099..41dc0a6 100644
--- a/policy_manager/pmtest_utils.cc
+++ b/update_manager/umtest_utils.cc
@@ -4,14 +4,14 @@
#include <base/time/time.h>
-#include "update_engine/policy_manager/pmtest_utils.h"
+#include "update_engine/update_manager/umtest_utils.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-const unsigned PmTestUtils::kDefaultTimeoutInSeconds = 1;
+const unsigned UmTestUtils::kDefaultTimeoutInSeconds = 1;
void PrintTo(const EvalStatus& status, ::std::ostream* os) {
*os << ToString(status);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/pmtest_utils.h b/update_manager/umtest_utils.h
similarity index 68%
rename from policy_manager/pmtest_utils.h
rename to update_manager/umtest_utils.h
index 79a7733..bd8da8c 100644
--- a/policy_manager/pmtest_utils.h
+++ b/update_manager/umtest_utils.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PMTEST_UTILS_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PMTEST_UTILS_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UMTEST_UTILS_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UMTEST_UTILS_H_
#include <iostream>
@@ -11,8 +11,8 @@
#include <base/time/time.h>
#include <gtest/gtest.h>
-#include "update_engine/policy_manager/policy.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/policy.h"
+#include "update_engine/update_manager/variable.h"
// Convenience macros for checking null-ness of pointers.
//
@@ -24,16 +24,16 @@
//
// Note that checking nullness of the content of a scoped_ptr requires getting
// the inner pointer value via get().
-#define PMTEST_ASSERT_NULL(p) ASSERT_EQ(NULL, p)
-#define PMTEST_ASSERT_NOT_NULL(p) ASSERT_NE(reinterpret_cast<void*>(NULL), p)
-#define PMTEST_EXPECT_NULL(p) EXPECT_EQ(NULL, p)
-#define PMTEST_EXPECT_NOT_NULL(p) EXPECT_NE(reinterpret_cast<void*>(NULL), p)
+#define UMTEST_ASSERT_NULL(p) ASSERT_EQ(NULL, p)
+#define UMTEST_ASSERT_NOT_NULL(p) ASSERT_NE(reinterpret_cast<void*>(NULL), p)
+#define UMTEST_EXPECT_NULL(p) EXPECT_EQ(NULL, p)
+#define UMTEST_EXPECT_NOT_NULL(p) EXPECT_NE(reinterpret_cast<void*>(NULL), p)
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-// A help class with common functionality for use in Policy Manager testing.
-class PmTestUtils {
+// A help class with common functionality for use in Update Manager testing.
+class UmTestUtils {
public:
// A default timeout to use when making various queries.
static const base::TimeDelta DefaultTimeout() {
@@ -43,18 +43,18 @@
// Calls GetValue on |variable| and expects its result to be |expected|.
template<typename T>
static void ExpectVariableHasValue(const T& expected, Variable<T>* variable) {
- PMTEST_ASSERT_NOT_NULL(variable);
+ UMTEST_ASSERT_NOT_NULL(variable);
scoped_ptr<const T> value(variable->GetValue(DefaultTimeout(), nullptr));
- PMTEST_ASSERT_NOT_NULL(value.get()) << "Variable: " << variable->GetName();
+ UMTEST_ASSERT_NOT_NULL(value.get()) << "Variable: " << variable->GetName();
EXPECT_EQ(expected, *value) << "Variable: " << variable->GetName();
}
// Calls GetValue on |variable| and expects its result to be null.
template<typename T>
static void ExpectVariableNotSet(Variable<T>* variable) {
- PMTEST_ASSERT_NOT_NULL(variable);
+ UMTEST_ASSERT_NOT_NULL(variable);
scoped_ptr<const T> value(variable->GetValue(DefaultTimeout(), nullptr));
- PMTEST_EXPECT_NULL(value.get()) << "Variable: " << variable->GetName();
+ UMTEST_EXPECT_NULL(value.get()) << "Variable: " << variable->GetName();
}
private:
@@ -65,6 +65,6 @@
// defined on the same namespace where the type was defined.
void PrintTo(const EvalStatus& status, ::std::ostream* os);
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PMTEST_UTILS_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UMTEST_UTILS_H_
diff --git a/policy_manager/policy_manager-inl.h b/update_manager/update_manager-inl.h
similarity index 83%
rename from policy_manager/policy_manager-inl.h
rename to update_manager/update_manager-inl.h
index 81cc808..1b1dc49 100644
--- a/policy_manager/policy_manager-inl.h
+++ b/update_manager/update_manager-inl.h
@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_MANAGER_INL_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_MANAGER_INL_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_INL_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_INL_H_
#include <string>
#include <base/bind.h>
-#include "update_engine/policy_manager/evaluation_context.h"
-#include "update_engine/policy_manager/event_loop.h"
+#include "update_engine/update_manager/evaluation_context.h"
+#include "update_engine/update_manager/event_loop.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
template<typename R, typename... Args>
-EvalStatus PolicyManager::EvaluatePolicy(
+EvalStatus UpdateManager::EvaluatePolicy(
EvaluationContext* ec,
EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
std::string*, R*,
@@ -42,7 +42,7 @@
}
template<typename R, typename... Args>
-void PolicyManager::OnPolicyReadyToEvaluate(
+void UpdateManager::OnPolicyReadyToEvaluate(
scoped_refptr<EvaluationContext> ec,
base::Callback<void(EvalStatus status, const R& result)> callback,
EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
@@ -60,7 +60,7 @@
}
// Re-schedule the policy request based on used variables.
base::Closure closure = base::Bind(
- &PolicyManager::OnPolicyReadyToEvaluate<R, Args...>,
+ &UpdateManager::OnPolicyReadyToEvaluate<R, Args...>,
base::Unretained(this), ec, callback, policy_method, args...);
if (!ec->RunOnValueChangeOrTimeout(closure)) {
@@ -75,7 +75,7 @@
}
template<typename R, typename... ActualArgs, typename... ExpectedArgs>
-EvalStatus PolicyManager::PolicyRequest(
+EvalStatus UpdateManager::PolicyRequest(
EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
std::string*, R*,
ExpectedArgs...) const,
@@ -90,7 +90,7 @@
}
template<typename R, typename... ActualArgs, typename... ExpectedArgs>
-void PolicyManager::AsyncPolicyRequest(
+void UpdateManager::AsyncPolicyRequest(
base::Callback<void(EvalStatus, const R& result)> callback,
EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
std::string*, R*,
@@ -98,14 +98,14 @@
ActualArgs... args) {
scoped_refptr<EvaluationContext> ec = new EvaluationContext(clock_);
// IMPORTANT: To ensure that ActualArgs can be converted to ExpectedArgs, we
- // explicitly instantiate PolicyManager::OnPolicyReadyToEvaluate with the
+ // explicitly instantiate UpdateManager::OnPolicyReadyToEvaluate with the
// latter in lieu of the former.
base::Closure closure = base::Bind(
- &PolicyManager::OnPolicyReadyToEvaluate<R, ExpectedArgs...>,
+ &UpdateManager::OnPolicyReadyToEvaluate<R, ExpectedArgs...>,
base::Unretained(this), ec, callback, policy_method, args...);
RunFromMainLoop(closure);
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_MANAGER_INL_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_INL_H_
diff --git a/update_manager/update_manager.cc b/update_manager/update_manager.cc
new file mode 100644
index 0000000..d3281fd
--- /dev/null
+++ b/update_manager/update_manager.cc
@@ -0,0 +1,20 @@
+// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "update_engine/update_manager/update_manager.h"
+
+#include "update_engine/update_manager/chromeos_policy.h"
+#include "update_engine/update_manager/state.h"
+
+namespace chromeos_update_manager {
+
+UpdateManager::UpdateManager(chromeos_update_engine::ClockInterface* clock,
+ State* state)
+ : state_(state), clock_(clock) {
+ // TODO(deymo): Make it possible to replace this policy with a different
+ // implementation with a build-time flag.
+ policy_.reset(new ChromeOSPolicy());
+}
+
+} // namespace chromeos_update_manager
diff --git a/policy_manager/policy_manager.conf.example b/update_manager/update_manager.conf.example
similarity index 69%
rename from policy_manager/policy_manager.conf.example
rename to update_manager/update_manager.conf.example
index 9215971..2d77974 100644
--- a/policy_manager/policy_manager.conf.example
+++ b/update_manager/update_manager.conf.example
@@ -1,13 +1,13 @@
-# Configuration file for the policy-manager component of update_engine.
+# Configuration file for the update-manager component of update_engine.
#
-# Normally this file is loaded from /etc/policy_manager.conf. If
+# Normally this file is loaded from /etc/update_manager.conf. If
# running update_engine in developer mode (and only if running in
# developer mode), we attempt to load
#
-# /mnt/stateful_partition/etc/policy_manager.conf
+# /mnt/stateful_partition/etc/update_manager.conf
#
# and use it if it exists. If it doesn't exist, we fall back to
-# /etc/policy_manager.conf.
+# /etc/update_manager.conf.
#
# Note: changes to this file are not automatically applied. Use the
# command "restart update-engine" from a root shell to make your
diff --git a/policy_manager/policy_manager.h b/update_manager/update_manager.h
similarity index 76%
rename from policy_manager/policy_manager.h
rename to update_manager/update_manager.h
index 586854f..b3dfc7f 100644
--- a/policy_manager/policy_manager.h
+++ b/update_manager/update_manager.h
@@ -2,33 +2,33 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_MANAGER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_MANAGER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_H_
#include <base/callback.h>
#include <base/memory/ref_counted.h>
#include <base/memory/scoped_ptr.h>
#include "update_engine/clock_interface.h"
-#include "update_engine/policy_manager/default_policy.h"
-#include "update_engine/policy_manager/policy.h"
-#include "update_engine/policy_manager/state.h"
+#include "update_engine/update_manager/default_policy.h"
+#include "update_engine/update_manager/policy.h"
+#include "update_engine/update_manager/state.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-// The main Policy Manager singleton class.
-class PolicyManager {
+// The main Update Manager singleton class.
+class UpdateManager {
public:
- // Creates the PolicyManager instance, assuming ownership on the provided
+ // Creates the UpdateManager instance, assuming ownership on the provided
// |state|.
- PolicyManager(chromeos_update_engine::ClockInterface* clock,
+ UpdateManager(chromeos_update_engine::ClockInterface* clock,
State* state);
- virtual ~PolicyManager() {}
+ virtual ~UpdateManager() {}
// PolicyRequest() evaluates the given policy with the provided arguments and
// returns the result. The |policy_method| is the pointer-to-method of the
- // Policy class for the policy request to call. The PolicyManager will call
+ // Policy class for the policy request to call. The UpdateManager will call
// this method on the right policy. The pointer |result| must not be NULL and
// the remaining |args| depend on the arguments required by the passed
// |policy_method|.
@@ -41,7 +41,7 @@
// not be NULL.
//
// An example call to this method is:
- // pm.PolicyRequest(&Policy::SomePolicyMethod, &bool_result, arg1, arg2);
+ // um.PolicyRequest(&Policy::SomePolicyMethod, &bool_result, arg1, arg2);
template<typename R, typename... ActualArgs, typename... ExpectedArgs>
EvalStatus PolicyRequest(
EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
@@ -53,7 +53,7 @@
// arguments and calls the |callback| callback with the result when done.
//
// If the policy implementation should block, returning a
- // EvalStatus::kAskMeAgainLater status the policy manager will re-evaluate the
+ // EvalStatus::kAskMeAgainLater status the Update Manager will re-evaluate the
// policy until another status is returned. If the policy implementation based
// its return value solely on const variables, the callback will be called
// with the EvalStatus::kAskMeAgainLater status.
@@ -66,7 +66,7 @@
ActualArgs... args);
protected:
- // The PolicyManager receives ownership of the passed Policy instance.
+ // The UpdateManager receives ownership of the passed Policy instance.
void set_policy(const Policy* policy) {
policy_.reset(policy);
}
@@ -75,10 +75,10 @@
State* state() { return state_.get(); }
private:
- FRIEND_TEST(PmPolicyManagerTest, PolicyRequestCallsPolicy);
- FRIEND_TEST(PmPolicyManagerTest, PolicyRequestCallsDefaultOnError);
- FRIEND_TEST(PmPolicyManagerTest, PolicyRequestDoesntBlock);
- FRIEND_TEST(PmPolicyManagerTest, AsyncPolicyRequestDelaysEvaluation);
+ FRIEND_TEST(UmUpdateManagerTest, PolicyRequestCallsPolicy);
+ FRIEND_TEST(UmUpdateManagerTest, PolicyRequestCallsDefaultOnError);
+ FRIEND_TEST(UmUpdateManagerTest, PolicyRequestDoesntBlock);
+ FRIEND_TEST(UmUpdateManagerTest, AsyncPolicyRequestDelaysEvaluation);
// EvaluatePolicy() evaluates the passed |policy_method| method on the current
// policy with the given |args| arguments. If the method fails, the default
@@ -106,7 +106,7 @@
Args...) const,
Args... args);
- // The policy used by the PolicyManager. Note that since it is a const Policy,
+ // The policy used by the UpdateManager. Note that since it is a const Policy,
// policy implementations are not allowed to persist state on this class.
scoped_ptr<const Policy> policy_;
@@ -120,12 +120,12 @@
// Pointer to the mockable clock interface;
chromeos_update_engine::ClockInterface* clock_;
- DISALLOW_COPY_AND_ASSIGN(PolicyManager);
+ DISALLOW_COPY_AND_ASSIGN(UpdateManager);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
// Include the implementation of the template methods.
-#include "update_engine/policy_manager/policy_manager-inl.h"
+#include "update_engine/update_manager/update_manager-inl.h"
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_MANAGER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_H_
diff --git a/policy_manager/policy_manager_unittest.cc b/update_manager/update_manager_unittest.cc
similarity index 75%
rename from policy_manager/policy_manager_unittest.cc
rename to update_manager/update_manager_unittest.cc
index 89da2a4..39427b3 100644
--- a/policy_manager/policy_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -14,12 +14,12 @@
#include <gtest/gtest.h>
#include "update_engine/fake_clock.h"
-#include "update_engine/policy_manager/default_policy.h"
-#include "update_engine/policy_manager/fake_state.h"
-#include "update_engine/policy_manager/mock_policy.h"
-#include "update_engine/policy_manager/pmtest_utils.h"
-#include "update_engine/policy_manager/policy_manager.h"
#include "update_engine/test_utils.h"
+#include "update_engine/update_manager/default_policy.h"
+#include "update_engine/update_manager/fake_state.h"
+#include "update_engine/update_manager/mock_policy.h"
+#include "update_engine/update_manager/umtest_utils.h"
+#include "update_engine/update_manager/update_manager.h"
using base::Bind;
using base::Callback;
@@ -51,18 +51,18 @@
} // namespace
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
-class PmPolicyManagerTest : public ::testing::Test {
+class UmUpdateManagerTest : public ::testing::Test {
protected:
virtual void SetUp() {
fake_state_ = new FakeState();
- pmut_.reset(new PolicyManager(&fake_clock_, fake_state_));
+ umut_.reset(new UpdateManager(&fake_clock_, fake_state_));
}
- FakeState* fake_state_; // Owned by the pmut_.
+ FakeState* fake_state_; // Owned by the umut_.
FakeClock fake_clock_;
- scoped_ptr<PolicyManager> pmut_;
+ scoped_ptr<UpdateManager> umut_;
};
// The FailingPolicy implements a single method and make it always fail. This
@@ -89,7 +89,7 @@
// AccumulateCallsCallback() adds to the passed |acc| accumulator vector pairs
// of EvalStatus and T instances. This allows to create a callback that keeps
// track of when it is called and the arguments passed to it, to be used with
-// the PolicyManager::AsyncPolicyRequest().
+// the UpdateManager::AsyncPolicyRequest().
template<typename T>
static void AccumulateCallsCallback(vector<pair<EvalStatus, T>>* acc,
EvalStatus status, const T& result) {
@@ -98,61 +98,61 @@
// Tests that policy requests are completed successfully. It is important that
// this tests cover all policy requests as defined in Policy.
-TEST_F(PmPolicyManagerTest, PolicyRequestCallUpdateCheckAllowed) {
+TEST_F(UmUpdateManagerTest, PolicyRequestCallUpdateCheckAllowed) {
UpdateCheckParams result;
- EXPECT_EQ(EvalStatus::kSucceeded, pmut_->PolicyRequest(
+ EXPECT_EQ(EvalStatus::kSucceeded, umut_->PolicyRequest(
&Policy::UpdateCheckAllowed, &result));
}
-TEST_F(PmPolicyManagerTest, PolicyRequestCallUpdateCanStart) {
+TEST_F(UmUpdateManagerTest, PolicyRequestCallUpdateCanStart) {
const UpdateState update_state = {
FixedTime(), 1, TimeDelta::FromSeconds(15), TimeDelta::FromSeconds(60),
4, 2, 8
};
UpdateCanStartResult result;
EXPECT_EQ(EvalStatus::kSucceeded,
- pmut_->PolicyRequest(&Policy::UpdateCanStart, &result, true,
+ umut_->PolicyRequest(&Policy::UpdateCanStart, &result, true,
update_state));
}
-TEST_F(PmPolicyManagerTest, PolicyRequestCallsDefaultOnError) {
- pmut_->set_policy(new FailingPolicy());
+TEST_F(UmUpdateManagerTest, PolicyRequestCallsDefaultOnError) {
+ umut_->set_policy(new FailingPolicy());
// Tests that the DefaultPolicy instance is called when the method fails,
// which will set this as true.
UpdateCheckParams result;
result.updates_enabled = false;
- EvalStatus status = pmut_->PolicyRequest(
+ EvalStatus status = umut_->PolicyRequest(
&Policy::UpdateCheckAllowed, &result);
EXPECT_EQ(EvalStatus::kSucceeded, status);
EXPECT_TRUE(result.updates_enabled);
}
-TEST_F(PmPolicyManagerTest, PolicyRequestDoesntBlock) {
+TEST_F(UmUpdateManagerTest, PolicyRequestDoesntBlock) {
UpdateCheckParams result;
- pmut_->set_policy(new LazyPolicy());
+ umut_->set_policy(new LazyPolicy());
- EvalStatus status = pmut_->PolicyRequest(
+ EvalStatus status = umut_->PolicyRequest(
&Policy::UpdateCheckAllowed, &result);
EXPECT_EQ(EvalStatus::kAskMeAgainLater, status);
}
-TEST_F(PmPolicyManagerTest, AsyncPolicyRequestDelaysEvaluation) {
+TEST_F(UmUpdateManagerTest, AsyncPolicyRequestDelaysEvaluation) {
// To avoid differences in code execution order between an AsyncPolicyRequest
// call on a policy that returns AskMeAgainLater the first time and one that
// succeeds the first time, we ensure that the passed callback is called from
// the main loop in both cases even when we could evaluate it right now.
- pmut_->set_policy(new FailingPolicy());
+ umut_->set_policy(new FailingPolicy());
vector<pair<EvalStatus, UpdateCheckParams>> calls;
Callback<void(EvalStatus, const UpdateCheckParams& result)> callback =
Bind(AccumulateCallsCallback<UpdateCheckParams>, &calls);
- pmut_->AsyncPolicyRequest(callback, &Policy::UpdateCheckAllowed);
+ umut_->AsyncPolicyRequest(callback, &Policy::UpdateCheckAllowed);
// The callback should wait until we run the main loop for it to be executed.
EXPECT_EQ(0, calls.size());
chromeos_update_engine::RunGMainLoopMaxIterations(100);
EXPECT_EQ(1, calls.size());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
diff --git a/policy_manager/updater_provider.h b/update_manager/updater_provider.h
similarity index 87%
rename from policy_manager/updater_provider.h
rename to update_manager/updater_provider.h
index 293dcdc..051ad3a 100644
--- a/policy_manager/updater_provider.h
+++ b/update_manager/updater_provider.h
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATER_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATER_PROVIDER_H_
#include <string>
#include <base/time/time.h>
-#include "update_engine/policy_manager/provider.h"
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/provider.h"
+#include "update_engine/update_manager/variable.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
enum class Stage {
kIdle,
@@ -86,6 +86,6 @@
DISALLOW_COPY_AND_ASSIGN(UpdaterProvider);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_UPDATER_PROVIDER_H_
diff --git a/policy_manager/variable.h b/update_manager/variable.h
similarity index 90%
rename from policy_manager/variable.h
rename to update_manager/variable.h
index 5b16b5d..3b77d0a 100644
--- a/policy_manager/variable.h
+++ b/update_manager/variable.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_VARIABLE_H_
-#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_VARIABLE_H_
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_VARIABLE_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_VARIABLE_H_
#include <algorithm>
#include <list>
@@ -14,9 +14,9 @@
#include <base/time/time.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include "update_engine/policy_manager/event_loop.h"
+#include "update_engine/update_manager/event_loop.h"
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// The VariableMode specifies important behavior of the variable in terms of
// whether, how and when the value of the variable changes.
@@ -114,10 +114,10 @@
}
private:
- friend class PmEvaluationContextTest;
- FRIEND_TEST(PmBaseVariableTest, RepeatedObserverTest);
- FRIEND_TEST(PmBaseVariableTest, NotifyValueChangedTest);
- FRIEND_TEST(PmBaseVariableTest, NotifyValueRemovesObserversTest);
+ friend class UmEvaluationContextTest;
+ FRIEND_TEST(UmBaseVariableTest, RepeatedObserverTest);
+ FRIEND_TEST(UmBaseVariableTest, NotifyValueChangedTest);
+ FRIEND_TEST(UmBaseVariableTest, NotifyValueRemovesObserversTest);
BaseVariable(const std::string& name, VariableMode mode,
base::TimeDelta poll_interval)
@@ -160,7 +160,7 @@
DISALLOW_COPY_AND_ASSIGN(BaseVariable);
};
-// Interface to a Policy Manager variable of a given type. Implementation
+// Interface to an Update Manager variable of a given type. Implementation
// internals are hidden as protected members, since policies should not be
// using them directly.
template<typename T>
@@ -174,8 +174,8 @@
friend class EvaluationContext;
// Needed to be able to verify variable contents during unit testing.
- friend class PmTestUtils;
- FRIEND_TEST(PmRealRandomProviderTest, GetRandomValues);
+ friend class UmTestUtils;
+ FRIEND_TEST(UmRealRandomProviderTest, GetRandomValues);
Variable(const std::string& name, VariableMode mode)
: BaseVariable(name, mode) {}
@@ -198,6 +198,6 @@
DISALLOW_COPY_AND_ASSIGN(Variable);
};
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_VARIABLE_H_
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_MANAGER_VARIABLE_H_
diff --git a/policy_manager/variable_unittest.cc b/update_manager/variable_unittest.cc
similarity index 90%
rename from policy_manager/variable_unittest.cc
rename to update_manager/variable_unittest.cc
index f68f7d3..09c7649 100644
--- a/policy_manager/variable_unittest.cc
+++ b/update_manager/variable_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "update_engine/policy_manager/variable.h"
+#include "update_engine/update_manager/variable.h"
#include <vector>
@@ -11,11 +11,11 @@
#include "update_engine/test_utils.h"
using base::TimeDelta;
+using chromeos_update_engine::RunGMainLoopMaxIterations;
using std::string;
using std::vector;
-using chromeos_update_engine::RunGMainLoopMaxIterations;
-namespace chromeos_policy_manager {
+namespace chromeos_update_manager {
// Variable class that returns a value constructed with the default value.
template <typename T>
@@ -37,26 +37,26 @@
DISALLOW_COPY_AND_ASSIGN(DefaultVariable);
};
-TEST(PmBaseVariableTest, GetNameTest) {
+TEST(UmBaseVariableTest, GetNameTest) {
DefaultVariable<int> var("var", kVariableModeConst);
EXPECT_EQ(var.GetName(), string("var"));
}
-TEST(PmBaseVariableTest, GetModeTest) {
+TEST(UmBaseVariableTest, GetModeTest) {
DefaultVariable<int> var("var", kVariableModeConst);
EXPECT_EQ(var.GetMode(), kVariableModeConst);
DefaultVariable<int> other_var("other_var", kVariableModePoll);
EXPECT_EQ(other_var.GetMode(), kVariableModePoll);
}
-TEST(PmBaseVariableTest, DefaultPollIntervalTest) {
+TEST(UmBaseVariableTest, DefaultPollIntervalTest) {
DefaultVariable<int> const_var("const_var", kVariableModeConst);
EXPECT_EQ(const_var.GetPollInterval(), TimeDelta());
DefaultVariable<int> poll_var("poll_var", kVariableModePoll);
EXPECT_EQ(poll_var.GetPollInterval(), TimeDelta::FromMinutes(5));
}
-TEST(PmBaseVariableTest, GetPollIntervalTest) {
+TEST(UmBaseVariableTest, GetPollIntervalTest) {
DefaultVariable<int> var("var", TimeDelta::FromMinutes(3));
EXPECT_EQ(var.GetMode(), kVariableModePoll);
EXPECT_EQ(var.GetPollInterval(), TimeDelta::FromMinutes(3));
@@ -72,7 +72,7 @@
vector<BaseVariable*> calls_;
};
-TEST(PmBaseVariableTest, RepeatedObserverTest) {
+TEST(UmBaseVariableTest, RepeatedObserverTest) {
DefaultVariable<int> var("var", kVariableModeAsync);
BaseVariableObserver observer;
var.AddObserver(&observer);
@@ -85,7 +85,7 @@
EXPECT_EQ(var.observer_list_.size(), 0);
}
-TEST(PmBaseVariableTest, NotifyValueChangedTest) {
+TEST(UmBaseVariableTest, NotifyValueChangedTest) {
DefaultVariable<int> var("var", kVariableModeAsync);
BaseVariableObserver observer1;
var.AddObserver(&observer1);
@@ -135,7 +135,7 @@
// Tests that we can remove an observer from a Variable on the ValueChanged()
// call to that observer.
-TEST(PmBaseVariableTest, NotifyValueRemovesObserversTest) {
+TEST(UmBaseVariableTest, NotifyValueRemovesObserversTest) {
DefaultVariable<int> var("var", kVariableModeAsync);
BaseVariableObserverRemover observer1;
BaseVariableObserverRemover observer2;
@@ -155,4 +155,4 @@
EXPECT_EQ(1, observer1.get_calls() + observer2.get_calls());
}
-} // namespace chromeos_policy_manager
+} // namespace chromeos_update_manager