shill: Fix marshalling of dictionary-valued properties.
The method DBusAdaptor::KeyValueStoreToVariant(), which was added to
allow for dictionary-valued properties such as Cellular.SIMLockStatus,
was incorrect. It was writing three maps - a string map, a bool
map, and a uint map, to the variant container. What it needs
to do is create a single a map of <string, variant> entries.
BUG=chromium-os:26498
TEST=Before this change, shill would crash either on startup, or
when a GetProperties call was made on the Device interface for a
cellular device. After the change, shill does not crash, and reports
the correct value for the device Cellular.SIMLockStatus property.
Change-Id: I9b297b759ed91c0d6db887c35bd870a51d080bd2
Reviewed-on: https://gerrit.chromium.org/gerrit/16043
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
Commit-Ready: Eric Shienbrood <ers@chromium.org>
diff --git a/property_store_unittest.cc b/property_store_unittest.cc
index 33a77f6..f69107a 100644
--- a/property_store_unittest.cc
+++ b/property_store_unittest.cc
@@ -97,7 +97,6 @@
PropertyStoreTest::kByteV,
PropertyStoreTest::kInt16V,
PropertyStoreTest::kInt32V,
- PropertyStoreTest::kKeyValueStoreV,
PropertyStoreTest::kStringV,
PropertyStoreTest::kStringmapV,
PropertyStoreTest::kStringsV,
@@ -219,6 +218,14 @@
EXPECT_EQ(internal_error(), error.name());
}
+TEST_F(PropertyStoreTest, SetKeyValueStoreProperty) {
+ PropertyStore store;
+ ::DBus::Error error;
+ EXPECT_FALSE(DBusAdaptor::SetProperty(
+ &store, "", PropertyStoreTest::kKeyValueStoreV, &error));
+ EXPECT_EQ(internal_error(), error.name());
+}
+
TEST_F(PropertyStoreTest, WriteOnlyProperties) {
// Test that properties registered as write-only are not returned
// when using Get*PropertiesIter().