Create a PolicyManager instance on the SystemState.

This patch creates the PolicyManager object on the update engine's
SystemState class, which aggregates all the singleton classes.

This patch doesn't add any functionality, other than initialize and
destroy the PolicyManager, State and Providers from the SystemState.

BUG=chromium:354079
TEST=Build.

Change-Id: Ib06d9c3d24926eaca43de2d11770ef6da7d16985
Reviewed-on: https://chromium-review.googlesource.com/191502
Reviewed-by: Gilad Arnold <garnold@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
index 159b96b..2d5b9c9 100644
--- a/policy_manager/fake_state.h
+++ b/policy_manager/fake_state.h
@@ -5,18 +5,41 @@
 #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/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/state.h"
 
 namespace chromeos_policy_manager {
 
-// A fake State class that creates Fake providers for all the providers.
+// A fake State class that creates fake providers for all the providers.
 class FakeState : public State {
  public:
-  // Initializes the State with fake providers.
-  FakeState();
+  // Creates and initializes the FakeState using fake providers. Returns NULL
+  // if the initialization fails.
+  static FakeState* Construct();
+
   virtual ~FakeState() {}
 
+  // Downcasted getters, to allow access to the fake instances during testing.
+  virtual FakeRandomProvider* random_provider() override {
+    return reinterpret_cast<FakeRandomProvider*>(State::random_provider());
+  }
+  virtual FakeShillProvider* shill_provider() override {
+    return reinterpret_cast<FakeShillProvider*>(State::shill_provider());
+  }
+  virtual FakeTimeProvider* time_provider() override {
+    return reinterpret_cast<FakeTimeProvider*>(State::time_provider());
+  }
+  virtual FakeSystemProvider* system_provider() override {
+    return reinterpret_cast<FakeSystemProvider*>(State::system_provider());
+  }
+
  private:
+  // Creates a FakeState instance using FakeProviders.
+  FakeState();
+
   DISALLOW_COPY_AND_ASSIGN(FakeState);
 };