blob: 81132c96a5b2794a7de057ede7bbbd900e7edbbe [file] [log] [blame]
Harald Alvestrand0ccfbd22021-04-08 07:25:04 +00001/*
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
20namespace webrtc {
21
22class MockAsyncDnsResolverResult : public AsyncDnsResolverResult {
23 public:
24 MOCK_METHOD(bool,
25 GetResolvedAddress,
26 (int, rtc::SocketAddress*),
Ali Tofighc98687a2022-01-25 14:06:33 +010027 (const, override));
28 MOCK_METHOD(int, GetError, (), (const, override));
Harald Alvestrand0ccfbd22021-04-08 07:25:04 +000029};
30
31class MockAsyncDnsResolver : public AsyncDnsResolverInterface {
32 public:
33 MOCK_METHOD(void,
34 Start,
35 (const rtc::SocketAddress&, std::function<void()>),
36 (override));
Sameer Vijaykarb787e262022-08-11 11:52:57 +020037 MOCK_METHOD(void,
38 Start,
39 (const rtc::SocketAddress&, int family, std::function<void()>),
40 (override));
Ali Tofighc98687a2022-01-25 14:06:33 +010041 MOCK_METHOD(AsyncDnsResolverResult&, result, (), (const, override));
Harald Alvestrand0ccfbd22021-04-08 07:25:04 +000042};
43
44class 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 Vijaykarb787e262022-08-11 11:52:57 +020051 CreateAndResolve,
52 (const rtc::SocketAddress&, int, std::function<void()>),
53 (override));
54 MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>,
Harald Alvestrand0ccfbd22021-04-08 07:25:04 +000055 Create,
56 (),
57 (override));
58};
59
60} // namespace webrtc
61
62#endif // API_TEST_MOCK_ASYNC_DNS_RESOLVER_H_