shill: Initiate scan on resume, if appropriate

When a power resume event occurs, start a scan if the WiFi device is idle.

BUG=chromium-os:24885
TEST=Added new unit tests to WiFiMainTest.  Ran all shill unit tests.
autotest WiFiRoaming.009ConnectOnResume should pass but currently doesn't
because shill crashes on suspend-resume.

Change-Id: I2730b0f27c0d85e72c0add57a3e9a5a2c995a04f
Reviewed-on: https://gerrit.chromium.org/gerrit/16107
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Gary Morain <gmorain@chromium.org>
Tested-by: Gary Morain <gmorain@chromium.org>
diff --git a/wifi.h b/wifi.h
index a98c306..1d0275d 100644
--- a/wifi.h
+++ b/wifi.h
@@ -14,6 +14,7 @@
 
 #include "shill/device.h"
 #include "shill/event_dispatcher.h"
+#include "shill/power_manager.h"
 #include "shill/refptr_types.h"
 
 namespace shill {
@@ -147,6 +148,10 @@
       uint16(WiFi::*get)(Error *error),
       void(WiFi::*set)(const uint16 &value, Error *error));
 
+  // If this WiFi device is idle and |new_state| indicates a resume event, a
+  // scan is initiated.
+  void HandlePowerStateChange(PowerManager::SuspendState new_state);
+
   // Store cached copies of singletons for speed/ease of testing.
   ProxyFactory *proxy_factory_;