shill: service: Allow trivial set of "Name" property

ONC is wont to set the "Name" property on services it does a "GetService"
on.  Allow this in the case where this would not have actually changed
the service.

BUG=chromium-os:29285
TEST=New unit test

Change-Id: I28c5469e6a2c655f2623229a72654bab93e7c521
Reviewed-on: https://gerrit.chromium.org/gerrit/19981
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/service_unittest.cc b/service_unittest.cc
index 50551e5..df224fe 100644
--- a/service_unittest.cc
+++ b/service_unittest.cc
@@ -170,6 +170,25 @@
                                           &error));
     EXPECT_EQ(invalid_args(), error.name());
   }
+  // Ensure that we can perform a trivial set of the Name property (to its
+  // current value) but an attempt to set the property to a different value
+  // fails.
+  {
+    ::DBus::Error error;
+    EXPECT_TRUE(DBusAdaptor::SetProperty(service_->mutable_store(),
+                                         flimflam::kNameProperty,
+                                         DBusAdaptor::StringToVariant(
+                                             service_->friendly_name()),
+                                         &error));
+  }
+  {
+    ::DBus::Error error;
+    EXPECT_FALSE(DBusAdaptor::SetProperty(service_->mutable_store(),
+                                          flimflam::kNameProperty,
+                                          PropertyStoreTest::kStringV,
+                                          &error));
+    EXPECT_EQ(invalid_args(), error.name());
+  }
 }
 
 TEST_F(ServiceTest, Load) {