1 // Copyright 2018 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_DNS_MOCK_MDNS_CLIENT_H_ 6 #define NET_DNS_MOCK_MDNS_CLIENT_H_ 7 8 #include <memory> 9 #include <string> 10 11 #include "net/dns/mdns_client.h" 12 #include "testing/gmock/include/gmock/gmock.h" 13 14 namespace net { 15 16 class MockMDnsTransaction : public MDnsTransaction { 17 public: 18 MockMDnsTransaction(); 19 ~MockMDnsTransaction() override; 20 21 MOCK_METHOD0(Start, bool()); 22 MOCK_CONST_METHOD0(GetName, const std::string&()); 23 MOCK_CONST_METHOD0(GetType, uint16_t()); 24 }; 25 26 class MockMDnsClient : public MDnsClient { 27 public: 28 MockMDnsClient(); 29 ~MockMDnsClient() override; 30 31 MOCK_METHOD3(CreateListener, 32 std::unique_ptr<MDnsListener>(uint16_t, 33 const std::string&, 34 MDnsListener::Delegate*)); 35 MOCK_METHOD4( 36 CreateTransaction, 37 std::unique_ptr<MDnsTransaction>(uint16_t, 38 const std::string&, 39 int, 40 const MDnsTransaction::ResultCallback&)); 41 MOCK_METHOD1(StartListening, int(MDnsSocketFactory*)); 42 MOCK_METHOD0(StopListening, void()); 43 MOCK_CONST_METHOD0(IsListening, bool()); 44 }; 45 46 } // namespace net 47 48 #endif // NET_DNS_MOCK_MDNS_CLIENT_H_ 49