shill: factor out ActiveLinkMonitor from LinkMonitor
ActiveLinkMonitor monitors the link status by sending ARP requests
and probing for ARP replies. Once the active link monitor is started,
the link will be declared as failure if it failed to receive ARP reply
for 5 consecutive broadcast ARP requests or unicast ARP requests in the
case when gateway unicast ARP support is established. A callback will be
invoked and ActiveLinkMonitor will automatically stopped when the link
status is deteremined.
BUG=chromium:422159
TEST=USE="asan clang" FEATURES=test emerge-$BOARD shill
Change-Id: I8a662b5f1c0b4ee4450f2327f5cdd03feb231b8b
Reviewed-on: https://chromium-review.googlesource.com/242278
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Trybot-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
diff --git a/mock_active_link_monitor.h b/mock_active_link_monitor.h
new file mode 100644
index 0000000..96e8b02
--- /dev/null
+++ b/mock_active_link_monitor.h
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_MOCK_ACTIVE_LINK_MONITOR_H_
+#define SHILL_MOCK_ACTIVE_LINK_MONITOR_H_
+
+#include "shill/active_link_monitor.h"
+
+#include <base/macros.h>
+#include <gmock/gmock.h>
+
+namespace shill {
+
+class MockActiveLinkMonitor : public ActiveLinkMonitor {
+ public:
+ MockActiveLinkMonitor();
+ ~MockActiveLinkMonitor() override;
+
+ MOCK_METHOD1(Start, bool(int));
+ MOCK_METHOD0(Stop, void());
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockActiveLinkMonitor);
+};
+
+} // namespace shill
+
+#endif // SHILL_MOCK_ACTIVE_LINK_MONITOR_H_