PolicyManager: Add a random number provider.
This patch adds a new provider with a single variable that returns a
random value from /dev/urandom every time it is called. The variable
is exported to all the policy implementations (currently none) in the
policy_manager/all_variables.h file.
BUG=None
TEST=unittests.
Change-Id: I6efdecd0f37f1a706b5a0dfd3a77ac4205e35aa0
Reviewed-on: https://chromium-review.googlesource.com/181537
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/variable.h b/policy_manager/variable.h
index 46defbc..6acd31f 100644
--- a/policy_manager/variable.h
+++ b/policy_manager/variable.h
@@ -8,6 +8,7 @@
#include <string>
#include <base/time.h>
+#include <gtest/gtest_prod.h> // for FRIEND_TEST
namespace chromeos_policy_manager {
@@ -18,6 +19,9 @@
virtual ~Variable() {}
protected:
+ friend class PMRandomProviderTest;
+ FRIEND_TEST(PMRandomProviderTest, GetRandomValues);
+
// Gets the current value of the variable. The current value is copied to a
// new object and returned. The caller of this method owns the object and
// should delete it.