PolicyManager: Add a Variable "Mode" property.
There are three kinds of Variables: Const, Poll and Async; that
reflect how the value on the variable changes. Const variables don't
change its value, Poll variables can change the value without notice
and Async variables can change the value but notify the observers
with those changes.
This patch adds the Mode property to the BaseVariable class. This
property can be used by the EvaluationContext to determine how to
treat a given variable.
BUG=chromium:341209
TEST=unit test added and passing.
Change-Id: Ifd4ebcfb84cdb9c6cca1ccbb34004cbac0ea2d2f
Reviewed-on: https://chromium-review.googlesource.com/187240
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/generic_variables_unittest.cc b/policy_manager/generic_variables_unittest.cc
index ea7da59..0e909f5 100644
--- a/policy_manager/generic_variables_unittest.cc
+++ b/policy_manager/generic_variables_unittest.cc
@@ -25,7 +25,7 @@
TEST_F(PmCopyVariableTest, SimpleTest) {
// Tests that copies are generated as intended.
int source = 5;
- CopyVariable<int> var("var", source);
+ CopyVariable<int> var("var", kVariableModePoll, source);
// Generate and validate a copy.
scoped_ptr<const int> copy_1(var.GetValue(default_timeout_, NULL));
@@ -61,7 +61,7 @@
const CopyConstructorTestClass source;
ASSERT_FALSE(source.copied_);
- CopyVariable<CopyConstructorTestClass> var("var", source);
+ CopyVariable<CopyConstructorTestClass> var("var", kVariableModePoll, source);
scoped_ptr<const CopyConstructorTestClass> copy(
var.GetValue(default_timeout_, NULL));
PMTEST_ASSERT_NOT_NULL(copy.get());