Do not use singleton for mock objects

Android complains about memory leakage when using singleton
for mock objects, and it is not really necessary to use
singleton for mock objects either.  So remove the singleton
from those objects.

While there, update the binary path for "sleep" on Android,
which is used for starting a dummy process in the test.

Bug: 25186794
TEST=Run apmanager_test on Brillo board
TEST=Run unittests for Chrome OS

Change-Id: Ifb5a5c6876aa67a94411d823109c14a209a46d86
diff --git a/hostapd_monitor_unittest.cc b/hostapd_monitor_unittest.cc
index dd6b82f..a5ac373 100644
--- a/hostapd_monitor_unittest.cc
+++ b/hostapd_monitor_unittest.cc
@@ -26,6 +26,7 @@
 using base::Bind;
 using base::Unretained;
 using ::testing::_;
+using ::testing::Mock;
 
 namespace {
   const char kStationMac[] = "00:11:22:33:44:55";
@@ -61,11 +62,10 @@
 class HostapdMonitorTest : public testing::Test {
  public:
   HostapdMonitorTest()
-      : hostapd_monitor_(observer_.event_callback(), "", ""),
-        event_dispatcher_(MockEventDispatcher::GetInstance()) {}
+      : hostapd_monitor_(observer_.event_callback(), "", "") {}
 
   virtual void SetUp() {
-    hostapd_monitor_.event_dispatcher_ = event_dispatcher_;
+    hostapd_monitor_.event_dispatcher_ = &event_dispatcher_;
   }
 
   void Start() {
@@ -79,16 +79,18 @@
  protected:
   HostapdEventCallbackObserver observer_;
   HostapdMonitor hostapd_monitor_;
-  MockEventDispatcher* event_dispatcher_;
+  MockEventDispatcher event_dispatcher_;
 };
 
 TEST_F(HostapdMonitorTest, Start) {
-  EXPECT_CALL(*event_dispatcher_, PostTask(_)).Times(1);
+  EXPECT_CALL(event_dispatcher_, PostTask(_)).Times(1);
   Start();
+  Mock::VerifyAndClearExpectations(&event_dispatcher_);
 
   // Monitor already started, nothing to be done.
-  EXPECT_CALL(*event_dispatcher_, PostTask(_)).Times(0);
+  EXPECT_CALL(event_dispatcher_, PostTask(_)).Times(0);
   Start();
+  Mock::VerifyAndClearExpectations(&event_dispatcher_);
 }
 
 TEST_F(HostapdMonitorTest, StationConnected) {