[shill] Enable the getting of properties, and wire to dbus.
PropertyStore exposes getters for iterators pointing to the beginning
and end of its property maps, and a static utility method in DBusAdaptor
uses these to iterate through all the properties in the PropertyStore and build
up a map of property name -> DBus::Variant-wrapped value.
BUG=chromium-os:16343
TEST=unit tests
Change-Id: I85ebbaee167ab2feed0fcf8fe654274de352aca0
Reviewed-on: http://gerrit.chromium.org/gerrit/3359
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/wifi_unittest.cc b/wifi_unittest.cc
index a1ec8d3..1e24d7b 100644
--- a/wifi_unittest.cc
+++ b/wifi_unittest.cc
@@ -47,33 +47,43 @@
}
TEST_F(WiFiTest, Dispatch) {
- ::DBus::Error e1, e2, e3, e4;
- EXPECT_TRUE(DBusAdaptor::DispatchOnType(device_.get(),
- flimflam::kBgscanMethodProperty,
- PropertyStoreTest::kStringV,
- e1));
- EXPECT_TRUE(DBusAdaptor::DispatchOnType(
- device_.get(),
- flimflam::kBgscanSignalThresholdProperty,
- PropertyStoreTest::kInt32V,
- e2));
- EXPECT_TRUE(DBusAdaptor::DispatchOnType(device_.get(),
- flimflam::kScanIntervalProperty,
- PropertyStoreTest::kUint16V,
- e3));
-
+ {
+ ::DBus::Error error;
+ EXPECT_TRUE(DBusAdaptor::DispatchOnType(device_.get(),
+ flimflam::kBgscanMethodProperty,
+ PropertyStoreTest::kStringV,
+ &error));
+ }
+ {
+ ::DBus::Error error;
+ EXPECT_TRUE(DBusAdaptor::DispatchOnType(
+ device_.get(),
+ flimflam::kBgscanSignalThresholdProperty,
+ PropertyStoreTest::kInt32V,
+ &error));
+ }
+ {
+ ::DBus::Error error;
+ EXPECT_TRUE(DBusAdaptor::DispatchOnType(device_.get(),
+ flimflam::kScanIntervalProperty,
+ PropertyStoreTest::kUint16V,
+ &error));
+ }
// Ensure that an attempt to write a R/O property returns InvalidArgs error.
- EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(),
- flimflam::kScanningProperty,
- PropertyStoreTest::kBoolV,
- e4));
- EXPECT_EQ(invalid_args_, e4.name());
+ {
+ ::DBus::Error error;
+ EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(),
+ flimflam::kScanningProperty,
+ PropertyStoreTest::kBoolV,
+ &error));
+ EXPECT_EQ(invalid_args_, error.name());
+ }
}
TEST_P(WiFiTest, TestProperty) {
// Ensure that an attempt to write unknown properties returns InvalidProperty.
::DBus::Error error;
- EXPECT_FALSE(DBusAdaptor::DispatchOnType(&manager_, "", GetParam(), error));
+ EXPECT_FALSE(DBusAdaptor::DispatchOnType(&manager_, "", GetParam(), &error));
EXPECT_EQ(invalid_prop_, error.name());
}