shill: allow property accessors to return an error message if a
property's value cannot be changed.
also, reduce some code duplication in property_store.cc
BUG=chromium-os:21384
TEST=unittests
Change-Id: Iaac8d40bbb9e9a1341d6c6d01642885d88ac0e27
Reviewed-on: http://gerrit.chromium.org/gerrit/8925
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/property_store_unittest.cc b/property_store_unittest.cc
index 3149146..26f8382 100644
--- a/property_store_unittest.cc
+++ b/property_store_unittest.cc
@@ -62,7 +62,8 @@
DBusAdaptor::Uint32ToVariant(0);
PropertyStoreTest::PropertyStoreTest()
- : invalid_args_(Error::GetName(Error::kInvalidArguments)),
+ : internal_error_(Error::GetName(Error::kInternalError)),
+ invalid_args_(Error::GetName(Error::kInvalidArguments)),
invalid_prop_(Error::GetName(Error::kInvalidProperty)),
path_(dir_.CreateUniqueTempDir() ? dir_.path().value() : ""),
manager_(control_interface(),
@@ -97,10 +98,17 @@
PropertyStoreTest::kInt16V,
PropertyStoreTest::kInt32V,
PropertyStoreTest::kStringmapV,
- PropertyStoreTest::kStringmapsV,
PropertyStoreTest::kStringsV,
PropertyStoreTest::kStrIntPairV,
PropertyStoreTest::kUint16V,
PropertyStoreTest::kUint32V));
+TEST_F(PropertyStoreTest, SetStringmapsProperty) {
+ PropertyStore store;
+ ::DBus::Error error;
+ EXPECT_FALSE(DBusAdaptor::DispatchOnType(
+ &store, "", PropertyStoreTest::kStringmapsV, &error));
+ EXPECT_EQ(internal_error(), error.name());
+}
+
} // namespace shill