shill: add MockIcmpSession, IcmpSessionFactory, and MockIcmpSessionFactory

Add MockIcmpSession class that allows for mocking of
IcmpSession function calls. Add an IcmpSessionFactory and
a corresponding Mock of this factory to allow IcmpSessions
that are dynamically allocated within a class implementation
to be mocked in unit tests.

A forthcoming CL will use these classes for testing.

BUG=None
TEST=Compiling shill for unit tests succeeds.

Change-Id: Ic327a19229d25146abf62f2228782b1826b186e7
Reviewed-on: https://chromium-review.googlesource.com/289954
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
diff --git a/icmp_session_factory.h b/icmp_session_factory.h
new file mode 100644
index 0000000..4a5f54a
--- /dev/null
+++ b/icmp_session_factory.h
@@ -0,0 +1,34 @@
+// 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_ICMP_SESSION_FACTORY_H_
+#define SHILL_ICMP_SESSION_FACTORY_H_
+
+#include <base/lazy_instance.h>
+
+#include "shill/icmp_session.h"
+
+namespace shill {
+
+class IcmpSessionFactory {
+ public:
+  virtual ~IcmpSessionFactory();
+
+  // This is a singleton. Use IcmpSessionFactory::GetInstance()->Foo().
+  static IcmpSessionFactory* GetInstance();
+
+  virtual IcmpSession* CreateIcmpSession(EventDispatcher* dispatcher);
+
+ protected:
+  IcmpSessionFactory();
+
+ private:
+  friend struct base::DefaultLazyInstanceTraits<IcmpSessionFactory>;
+
+  DISALLOW_COPY_AND_ASSIGN(IcmpSessionFactory);
+};
+
+}  // namespace shill
+
+#endif  // SHILL_ICMP_SESSION_FACTORY_H_