PolicyManager: Add a new State class grouping the state providers.
The policy implementations need access to the providers to discover
the variables exposed by them. Instead of having global variables to
access each providers, we add a new State interface that groups all
the providers in the same way a provider groups all the variables.
This interface class allows to create a mock/fake class for testing
the policies.
Other minor fixes to the fakes are included in this patch.
BUG=chromium:338591
TEST=Simple unit test passes.
Change-Id: I7fe46dfc8416ee39ace3290628b7bae440213b29
Reviewed-on: https://chromium-review.googlesource.com/187705
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/fake_state.h b/policy_manager/fake_state.h
new file mode 100644
index 0000000..4d97a37
--- /dev/null
+++ b/policy_manager/fake_state.h
@@ -0,0 +1,25 @@
+// 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_STATE_H
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_STATE_H
+
+#include "update_engine/policy_manager/state.h"
+
+namespace chromeos_policy_manager {
+
+// A fake State class that creates Fake providers for all the providers.
+class FakeState : public State {
+ public:
+ // Initializes the State with fake providers.
+ FakeState();
+ virtual ~FakeState() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FakeState);
+};
+
+} // namespace chromeos_policy_manager
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_FAKE_STATE_H