Eric Orth | 9871aafa | 2018-10-02 19:59:18 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors. All rights reserved. |
| 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(); |
| 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(); |
| 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&)); |
Eric Orth | e857ebb | 2019-03-13 23:02:07 | [diff] [blame] | 41 | MOCK_METHOD1(StartListening, int(MDnsSocketFactory*)); |
Eric Orth | 9871aafa | 2018-10-02 19:59:18 | [diff] [blame] | 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_ |