PolicyManager: New System provider.

The system provider exposes information about the device from
crossystem and the kernel boot command line options.

BUG=chromium:338587
TEST=Unit tests.

Change-Id: I2837a97740b63562155717cfe6a12fad69fd8cea
Reviewed-on: https://chromium-review.googlesource.com/191121
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/generic_variables_unittest.cc b/policy_manager/generic_variables_unittest.cc
index 0e909f5..96de97e 100644
--- a/policy_manager/generic_variables_unittest.cc
+++ b/policy_manager/generic_variables_unittest.cc
@@ -2,10 +2,11 @@
 // 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 <base/memory/scoped_ptr.h>
 #include <gtest/gtest.h>
 
-#include "update_engine/policy_manager/generic_variables.h"
 #include "update_engine/policy_manager/pmtest_utils.h"
 
 using base::TimeDelta;
@@ -14,11 +15,7 @@
 
 class PmCopyVariableTest : public ::testing::Test {
  protected:
-  virtual void SetUp() {
-    default_timeout_ = TimeDelta::FromSeconds(1);
-  }
-
-  TimeDelta default_timeout_;
+  TimeDelta default_timeout_ = TimeDelta::FromSeconds(1);
 };
 
 
@@ -68,4 +65,24 @@
   EXPECT_TRUE(copy->copied_);
 }
 
+
+class PmConstCopyVariableTest : public ::testing::Test {
+ protected:
+  TimeDelta default_timeout_ = TimeDelta::FromSeconds(1);
+};
+
+TEST_F(PmConstCopyVariableTest, SimpleTest) {
+  int source = 5;
+  ConstCopyVariable<int> var("var", source);
+  scoped_ptr<const int> copy(var.GetValue(default_timeout_, NULL));
+  PMTEST_ASSERT_NOT_NULL(copy.get());
+  EXPECT_EQ(5, *copy);
+
+  // Ensure the value is cached.
+  source = 42;
+  copy.reset(var.GetValue(default_timeout_, NULL));
+  PMTEST_ASSERT_NOT_NULL(copy.get());
+  EXPECT_EQ(5, *copy);
+}
+
 }  // namespace chromeos_policy_manager