• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2011 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef SHILL_MOCK_ARES_H_
18 #define SHILL_MOCK_ARES_H_
19 
20 #include <base/macros.h>
21 #include <gmock/gmock.h>
22 
23 #include "shill/shill_ares.h"
24 
25 namespace shill {
26 
27 class MockAres : public Ares {
28  public:
29   MockAres();
30   ~MockAres() override;
31 
32   MOCK_METHOD1(Destroy, void(ares_channel channel));
33   MOCK_METHOD5(GetHostByName, void(ares_channel channel,
34                                    const char* hostname,
35                                    int family,
36                                    ares_host_callback callback,
37                                    void* arg));
38   MOCK_METHOD3(GetSock, int(ares_channel channel,
39                             ares_socket_t* socks,
40                             int numsocks));
41   MOCK_METHOD3(InitOptions, int(ares_channel* channelptr,
42                                 struct ares_options* options,
43                                 int optmask));
44   MOCK_METHOD3(ProcessFd, void(ares_channel channel,
45                                ares_socket_t read_fd,
46                                ares_socket_t write_fd));
47   MOCK_METHOD2(SetLocalDev, void(ares_channel channel,
48                                  const char* local_dev_name));
49   MOCK_METHOD3(Timeout, struct timeval* (ares_channel channel,
50                                          struct timeval* maxtv,
51                                          struct timeval* tv));
52   MOCK_METHOD2(SetServersCsv, int(ares_channel channel,
53                                   const char* servers));
54 
55  private:
56   DISALLOW_COPY_AND_ASSIGN(MockAres);
57 };
58 
59 }  // namespace shill
60 
61 #endif  // SHILL_MOCK_ARES_H_
62