[shill] Add properties to Manager, Device and subclasses. Clean up unit tests

1) Pull much of the properties stuff (the maps, Register*(), Contains()) up
   into PropertyStore, and make it a class, not an interface.
2) Add proper property stuff to Manager and Device.  Move Cellular- and Wifi-
   specific properties to Cellular, CellularService, WiFi, WiFiService as
   appropriate.
3) clean up unit tests.

BUG=chromium-os:16343
TEST=unit tests

Change-Id: Iba88f384a5fbe383608cb79fa2134d978f1b81e8
Reviewed-on: http://gerrit.chromium.org/gerrit/3136
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/device_unittest.cc b/device_unittest.cc
index 6d84221..c452931 100644
--- a/device_unittest.cc
+++ b/device_unittest.cc
@@ -29,6 +29,7 @@
 using ::testing::NiceMock;
 using ::testing::Return;
 using ::testing::Test;
+using ::testing::Values;
 
 namespace shill {
 
@@ -59,48 +60,51 @@
   ::DBus::Error error;
   EXPECT_TRUE(DBusAdaptor::DispatchOnType(device_.get(),
                                           flimflam::kPoweredProperty,
-                                          bool_v_,
+                                          PropertyStoreTest::kBoolV,
+                                          error));
+  EXPECT_TRUE(DBusAdaptor::DispatchOnType(device_.get(),
+                                          flimflam::kBgscanMethodProperty,
+                                          PropertyStoreTest::kStringV,
                                           error));
   EXPECT_TRUE(DBusAdaptor::DispatchOnType(
       device_.get(),
       flimflam::kBgscanSignalThresholdProperty,
-      int32_v_,
+      PropertyStoreTest::kInt32V,
       error));
   EXPECT_TRUE(DBusAdaptor::DispatchOnType(device_.get(),
                                           flimflam::kScanIntervalProperty,
-                                          uint16_v_,
+                                          PropertyStoreTest::kUint16V,
                                           error));
 
-  EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(), "", byte_v_, error));
-  EXPECT_EQ(invalid_prop_, error.name());
+  // Ensure that an attempt to write a R/O property returns InvalidArgs error.
   EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(),
-                                           "",
-                                           stringmap_v_,
-                                           error));
-  EXPECT_EQ(invalid_prop_, error.name());
-  EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(),
-                                           "",
-                                           uint32_v_,
-                                           error));
-  EXPECT_EQ(invalid_prop_, error.name());
-
-  EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(),
-                                           flimflam::kCarrierProperty,
-                                           string_v_,
-                                           error));
-  EXPECT_EQ(invalid_args_, error.name());
-  EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(),
-                                           flimflam::kNetworksProperty,
-                                           strings_v_,
-                                           error));
-  EXPECT_EQ(invalid_args_, error.name());
-  EXPECT_FALSE(DBusAdaptor::DispatchOnType(device_.get(),
-                                           flimflam::kPRLVersionProperty,
-                                           int16_v_,
+                                           flimflam::kAddressProperty,
+                                           PropertyStoreTest::kStringV,
                                            error));
   EXPECT_EQ(invalid_args_, error.name());
 }
 
+TEST_P(DeviceTest, TestProperty) {
+  // Ensure that an attempt to write unknown properties returns InvalidProperty.
+  ::DBus::Error error;
+  EXPECT_FALSE(DBusAdaptor::DispatchOnType(&manager_, "", GetParam(), error));
+  EXPECT_EQ(invalid_prop_, error.name());
+}
+
+INSTANTIATE_TEST_CASE_P(
+    DeviceTestInstance,
+    DeviceTest,
+    Values(PropertyStoreTest::kBoolV,
+           PropertyStoreTest::kByteV,
+           PropertyStoreTest::kStringV,
+           PropertyStoreTest::kInt16V,
+           PropertyStoreTest::kInt32V,
+           PropertyStoreTest::kUint16V,
+           PropertyStoreTest::kUint32V,
+           PropertyStoreTest::kStringsV,
+           PropertyStoreTest::kStringmapV,
+           PropertyStoreTest::kStringmapsV));
+
 TEST_F(DeviceTest, TechnologyIs) {
   EXPECT_FALSE(device_->TechnologyIs(Device::kEthernet));
 }