buffet: Migrate StateChange to native_types::Object.

chromeos::Any is convenient for DBus, but the rest of
the system prefers to work with higher level abstractions.

Also it is somewhat too late to analyze Any when processing
StateChange, as to do that properly one needs full package
definition.

BUG=chromium:434767
TEST=cros_workon_make --test buffet

Change-Id: Iaf12c2e8e7e8f9c84f6492d9fbd8a495be3c0a94
Reviewed-on: https://chromium-review.googlesource.com/231035
Tested-by: Anton Muhin <antonm@chromium.org>
Reviewed-by: Anton Muhin <antonm@chromium.org>
Commit-Queue: Anton Muhin <antonm@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/unittest_utils.h b/buffet/commands/unittest_utils.h
index 665a2d1..577405a 100644
--- a/buffet/commands/unittest_utils.h
+++ b/buffet/commands/unittest_utils.h
@@ -10,6 +10,9 @@
 
 #include <base/values.h>
 
+#include "buffet/commands/prop_types.h"
+#include "buffet/commands/prop_values.h"
+
 namespace buffet {
 namespace unittests {
 
@@ -25,6 +28,34 @@
 // apostrophes for easy comparisons in C++ source code.
 std::string ValueToString(const base::Value* value);
 
+template <typename PV, typename T> std::shared_ptr<const PV>
+make_prop_value(const PropType* type, const T& value) {
+  auto result = std::make_shared<PV>(type);
+  result->SetValue(value);
+  return result;
+}
+
+inline std::shared_ptr<const IntValue> make_int_prop_value(int value) {
+  static const PropType* int_prop_type = new IntPropType();
+  return make_prop_value<IntValue, int>(int_prop_type, value);
+}
+
+inline std::shared_ptr<const DoubleValue> make_double_prop_value(double value) {
+  static const PropType* double_prop_type = new DoublePropType();
+  return make_prop_value<DoubleValue, double>(double_prop_type, value);
+}
+
+inline std::shared_ptr<const BooleanValue> make_bool_prop_value(bool value) {
+  static const PropType* boolean_prop_type = new BooleanPropType();
+  return make_prop_value<BooleanValue, bool>(boolean_prop_type, value);
+}
+
+inline std::shared_ptr<const StringValue>
+make_string_prop_value(const std::string& value) {
+  static const PropType* string_prop_type = new StringPropType();
+  return make_prop_value<StringValue, std::string>(string_prop_type, value);
+}
+
 }  // namespace unittests
 }  // namespace buffet