shill: Enable auto-connect for WiFi services

This performs a few of the last tidbits to get auto-connect
working for WiFi networks.  The tweaks include:

  * Adding calls to SortServices() in Push/PopProfile
  * On successful connection, move service to the profile on
    the top of the stack if this service was previously in the
    ephemeral profile.
  * Add a method to Services to return whether they are eligible
    for auto-connect.  Implement this for the WiFi services by
    using a new method to test if the WiFi device is busy.

BUG=chromium-os:24261,chromium-os:17255
TEST=Unit Tests (for regression)
Manual: Connect to WPA-PSK network successfully; restart shill and
observe an auto-connect after scan.

Change-Id: Ia4e1fd94795a4ce64d66ec6db940ee16ff694431
Reviewed-on: https://gerrit.chromium.org/gerrit/12963
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/mock_profile.h b/mock_profile.h
index f99006d..60844ee 100644
--- a/mock_profile.h
+++ b/mock_profile.h
@@ -21,9 +21,11 @@
               const std::string &identifier);
   virtual ~MockProfile();
 
-  MOCK_METHOD1(GetStoragePath, bool(FilePath *filepath));
+  MOCK_METHOD1(AdoptService, bool(const ServiceRefPtr &service));
+  MOCK_METHOD1(AbandonService, bool(const ServiceRefPtr &service));
   MOCK_METHOD1(ConfigureService,  bool(const ServiceRefPtr &service));
   MOCK_METHOD1(ConfigureDevice, bool(const DeviceRefPtr &device));
+  MOCK_METHOD1(GetStoragePath, bool(FilePath *filepath));
   MOCK_METHOD0(Save, bool());
 
  private: