shill: don't auto-connect to a disconnected service

This addresses part of the problem with the 003AsciiKeyWEP40
failure. That test establishes a connection, disconnects,
reconfigures the (WEP) password on an AP, and then tries
to reconnect.

Before this patch, the test failed as follows:
1. shill immediately tries to reconnect after the disconnect.
   This reconnect uses the old password (because the test
   hasn't had a chance to supply a new password).
2. The test code provides the correct password, and then
   initiates an explicit connect. However, the explicit
   connect is ignored, because a connection is already in
   progress (to the same service).
3. The automatic reconnect fails, because it is using the
   wrong password.

BUG=chromium-os:25153,chromium-os:25157
TEST=unit tests, WiFiRoaming, WiFiSecMat.*WEP*, WiFiManager

Testing notes:
- WiFiRoaming had some failures, but no regressions
- WiFiSecMat.*WEP* passed except 003CheckWEP_8021x
  (previously, that failed in addition to 000StaticKeyWEP40,
  001StaticKeyWEP104, 005SharedKeyWEP40, and 006SharedKeyWEP104.)
- WiFiManager passed
  (previously, 003AsciiKeyWEP40 and 004AsciiKeyWEP104 failed.)

Change-Id: I2dd6312006865c914d4193ce3f7d7c5443b84deb
Reviewed-on: https://gerrit.chromium.org/gerrit/14408
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/wifi_service.cc b/wifi_service.cc
index 263775c..f0ee9e5 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -135,8 +135,9 @@
       task_factory_.NewRunnableMethod(&WiFiService::ConnectTask));
 }
 
-void WiFiService::Disconnect(Error */*error*/) {
+void WiFiService::Disconnect(Error *error) {
   LOG(INFO) << __func__;
+  Service::Disconnect(error);
   // Defer handling, since dbus-c++ does not permit us to send an
   // outbound request while processing an inbound one.
   dispatcher()->PostTask(
@@ -148,14 +149,14 @@
 }
 
 bool WiFiService::IsAutoConnectable() const {
-  return connectable()
+  return Service::IsAutoConnectable() &&
       // Only auto-connect to Services which have visible Endpoints.
       // (Needed because hidden Services may remain registered with
       // Manager even without visible Endpoints.)
-      && HasEndpoints()
+      HasEndpoints() &&
       // Do not preempt an existing connection (whether pending, or
       // connected, and whether to this service, or another).
-      && wifi_->IsIdle();
+      wifi_->IsIdle();
 }
 
 bool WiFiService::IsConnecting() const {