Harald Alvestrand | 0ccfbd2 | 2021-04-08 07:25:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef API_TEST_MOCK_ASYNC_DNS_RESOLVER_H_ |
| 12 | #define API_TEST_MOCK_ASYNC_DNS_RESOLVER_H_ |
| 13 | |
| 14 | #include <functional> |
| 15 | #include <memory> |
| 16 | |
| 17 | #include "api/async_dns_resolver.h" |
| 18 | #include "test/gmock.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | class MockAsyncDnsResolverResult : public AsyncDnsResolverResult { |
| 23 | public: |
| 24 | MOCK_METHOD(bool, |
| 25 | GetResolvedAddress, |
| 26 | (int, rtc::SocketAddress*), |
Ali Tofigh | c98687a | 2022-01-25 14:06:33 +0100 | [diff] [blame] | 27 | (const, override)); |
| 28 | MOCK_METHOD(int, GetError, (), (const, override)); |
Harald Alvestrand | 0ccfbd2 | 2021-04-08 07:25:04 +0000 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | class MockAsyncDnsResolver : public AsyncDnsResolverInterface { |
| 32 | public: |
| 33 | MOCK_METHOD(void, |
| 34 | Start, |
| 35 | (const rtc::SocketAddress&, std::function<void()>), |
| 36 | (override)); |
Sameer Vijaykar | b787e26 | 2022-08-11 11:52:57 +0200 | [diff] [blame] | 37 | MOCK_METHOD(void, |
| 38 | Start, |
| 39 | (const rtc::SocketAddress&, int family, std::function<void()>), |
| 40 | (override)); |
Ali Tofigh | c98687a | 2022-01-25 14:06:33 +0100 | [diff] [blame] | 41 | MOCK_METHOD(AsyncDnsResolverResult&, result, (), (const, override)); |
Harald Alvestrand | 0ccfbd2 | 2021-04-08 07:25:04 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | class MockAsyncDnsResolverFactory : public AsyncDnsResolverFactoryInterface { |
| 45 | public: |
| 46 | MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>, |
| 47 | CreateAndResolve, |
| 48 | (const rtc::SocketAddress&, std::function<void()>), |
| 49 | (override)); |
| 50 | MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>, |
Sameer Vijaykar | b787e26 | 2022-08-11 11:52:57 +0200 | [diff] [blame] | 51 | CreateAndResolve, |
| 52 | (const rtc::SocketAddress&, int, std::function<void()>), |
| 53 | (override)); |
| 54 | MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>, |
Harald Alvestrand | 0ccfbd2 | 2021-04-08 07:25:04 +0000 | [diff] [blame] | 55 | Create, |
| 56 | (), |
| 57 | (override)); |
| 58 | }; |
| 59 | |
| 60 | } // namespace webrtc |
| 61 | |
| 62 | #endif // API_TEST_MOCK_ASYNC_DNS_RESOLVER_H_ |