shill: Create an asynchronous resolver object

Resolve DNS requests using the c-ares library but
using the shill event loop to handle events.

BUG=chromium-os:21664
TEST=New unit test

Change-Id: I99776b6cc74977d31198c67357c42a75f4047942
Reviewed-on: https://gerrit.chromium.org/gerrit/10328
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/mock_ares.h b/mock_ares.h
new file mode 100644
index 0000000..0a89de2
--- /dev/null
+++ b/mock_ares.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 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_ARES_H_
+#define SHILL_MOCK_ARES_H_
+
+#include <base/basictypes.h>
+#include <gmock/gmock.h>
+
+#include "shill/shill_ares.h"
+
+namespace shill {
+
+class MockAres : public Ares {
+ public:
+  MockAres();
+  virtual ~MockAres();
+
+  MOCK_METHOD1(Destroy, void(ares_channel channel));
+  MOCK_METHOD5(GetHostByName, void(ares_channel channel,
+                                   const char *hostname,
+                                   int family,
+                                   ares_host_callback callback,
+                                   void *arg));
+  MOCK_METHOD3(GetSock, int(ares_channel channel,
+                            ares_socket_t *socks,
+                            int numsocks));
+  MOCK_METHOD3(InitOptions, int(ares_channel *channelptr,
+                                struct ares_options *options,
+                                int optmask));
+  MOCK_METHOD3(ProcessFd, void(ares_channel channel,
+                               ares_socket_t read_fd,
+                               ares_socket_t write_fd));
+  MOCK_METHOD2(SetLocalDev, void(ares_channel channel,
+                                 const char *local_dev_name));
+  MOCK_METHOD3(Timeout, struct timeval *(ares_channel channel,
+                                         struct timeval *maxtv,
+                                         struct timeval *tv));
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MockAres);
+};
+
+}  // namespace shill
+
+#endif  // SHILL_MOCK_ARES_H_