1 // Copyright 2015 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef FIREWALLD_MOCK_IPTABLES_H_ 16 #define FIREWALLD_MOCK_IPTABLES_H_ 17 18 #include <string> 19 20 #include <base/macros.h> 21 #include <gmock/gmock.h> 22 23 #include "iptables.h" 24 25 namespace firewalld { 26 27 class MockIpTables : public IpTables { 28 public: 29 MockIpTables() = default; 30 ~MockIpTables() override; 31 32 MOCK_METHOD4( 33 AddAcceptRule, 34 bool(const std::string&, ProtocolEnum, uint16_t, const std::string&)); 35 36 MOCK_METHOD4( 37 DeleteAcceptRule, 38 bool(const std::string&, ProtocolEnum, uint16_t, const std::string&)); 39 40 MOCK_METHOD2(ApplyMasquerade, bool(const std::string&, bool)); 41 MOCK_METHOD2(ApplyMarkForUserTraffic, bool(const std::string&, bool)); 42 MOCK_METHOD1(ApplyRuleForUserTraffic, bool(bool)); 43 44 private: 45 DISALLOW_COPY_AND_ASSIGN(MockIpTables); 46 }; 47 48 } // namespace firewalld 49 50 #endif // FIREWALLD_MOCK_IPTABLES_H_ 51