shill: make access to Service.AutoConnect consistent with flimflam

Service.AutoConnect is writable only if the Favorite property is true.

BUG=chromium-os:23342
TEST=Unit tests, network_WiFiManager (7/9)

Change-Id: Ia76e1bfb39e51b62352b97131d14a672fdc45f6d
Reviewed-on: https://gerrit.chromium.org/gerrit/15156
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/service_unittest.cc b/service_unittest.cc
index be325c4..8f2daab 100644
--- a/service_unittest.cc
+++ b/service_unittest.cc
@@ -79,6 +79,7 @@
   {
     ::DBus::Error dbus_error;
     bool expected = true;
+    service_->set_favorite(true);
     service_->mutable_store()->SetBoolProperty(flimflam::kAutoConnectProperty,
                                                expected,
                                                &error);
@@ -144,6 +145,23 @@
                                              &error));
     EXPECT_EQ(invalid_args(), error.name());
   }
+  {
+    ::DBus::Error error;
+    service_->set_favorite(true);
+    EXPECT_TRUE(DBusAdaptor::DispatchOnType(service_->mutable_store(),
+                                            flimflam::kAutoConnectProperty,
+                                            PropertyStoreTest::kBoolV,
+                                            &error));
+  }
+  {
+    ::DBus::Error error;
+    service_->set_favorite(false);
+    EXPECT_FALSE(DBusAdaptor::DispatchOnType(service_->mutable_store(),
+                                             flimflam::kAutoConnectProperty,
+                                             PropertyStoreTest::kBoolV,
+                                             &error));
+    EXPECT_EQ(invalid_args(), error.name());
+  }
 }
 
 TEST_F(ServiceTest, Load) {