• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2012 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_ROUTING_TABLE_H_
18 #define SHILL_MOCK_ROUTING_TABLE_H_
19 
20 #include <base/macros.h>
21 #include <gmock/gmock.h>
22 
23 #include "shill/routing_table.h"
24 
25 namespace shill {
26 
27 class MockRoutingTable : public RoutingTable {
28  public:
29   MockRoutingTable();
30   ~MockRoutingTable() override;
31 
32   MOCK_METHOD0(Start, void());
33   MOCK_METHOD0(Stop, void());
34   MOCK_METHOD2(AddRoute, bool(int interface_index,
35                               const RoutingTableEntry& entry));
36   MOCK_METHOD3(GetDefaultRoute, bool(int interface_index,
37                                      IPAddress::Family family,
38                                      RoutingTableEntry* entry));
39   MOCK_METHOD4(SetDefaultRoute, bool(int interface_index,
40                                      const IPAddress& gateway_address,
41                                      uint32_t metric,
42                                      uint8_t table));
43   MOCK_METHOD4(ConfigureRoutes, bool(int interface_index,
44                                      const IPConfigRefPtr& ipconfig,
45                                      uint32_t metric,
46                                      uint8_t table));
47   MOCK_METHOD4(CreateBlackholeRoute, bool(int interface_index,
48                                           IPAddress::Family family,
49                                           uint32_t metric,
50                                           uint8_t table));
51   MOCK_METHOD4(CreateLinkRoute, bool(int interface_index,
52                                      const IPAddress& local_address,
53                                      const IPAddress& remote_address,
54                                      uint8_t table));
55   MOCK_METHOD1(FlushRoutes, void(int interface_index));
56   MOCK_METHOD1(FlushRoutesWithTag, void(int tag));
57   MOCK_METHOD0(FlushCache, bool());
58   MOCK_METHOD1(ResetTable, void(int interface_index));
59   MOCK_METHOD2(SetDefaultMetric, void(int interface_index, uint32_t metric));
60   MOCK_METHOD5(RequestRouteToHost, bool(const IPAddress& addresss,
61                                         int interface_index,
62                                         int tag,
63                                         const Query::Callback& callback,
64                                         uint8_t table));
65 
66  private:
67   DISALLOW_COPY_AND_ASSIGN(MockRoutingTable);
68 };
69 
70 }  // namespace shill
71 
72 #endif  // SHILL_MOCK_ROUTING_TABLE_H_
73