tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mock_async_dns_resolver.h (2023B)


      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 <memory>
     15 
     16 #include "absl/functional/any_invocable.h"
     17 #include "api/async_dns_resolver.h"
     18 #include "rtc_base/socket_address.h"
     19 #include "test/gmock.h"
     20 
     21 namespace webrtc {
     22 
     23 class MockAsyncDnsResolverResult : public AsyncDnsResolverResult {
     24 public:
     25  MOCK_METHOD(bool,
     26              GetResolvedAddress,
     27              (int, SocketAddress*),
     28              (const, override));
     29  MOCK_METHOD(int, GetError, (), (const, override));
     30 };
     31 
     32 class MockAsyncDnsResolver : public AsyncDnsResolverInterface {
     33 public:
     34  MOCK_METHOD(void,
     35              Start,
     36              (const SocketAddress&, absl::AnyInvocable<void()>),
     37              (override));
     38  MOCK_METHOD(void,
     39              Start,
     40              (const SocketAddress&, int family, absl::AnyInvocable<void()>),
     41              (override));
     42  MOCK_METHOD(AsyncDnsResolverResult&, result, (), (const, override));
     43 };
     44 
     45 class MockAsyncDnsResolverFactory : public AsyncDnsResolverFactoryInterface {
     46 public:
     47  MOCK_METHOD(std::unique_ptr<AsyncDnsResolverInterface>,
     48              CreateAndResolve,
     49              (const SocketAddress&, absl::AnyInvocable<void()>),
     50              (override));
     51  MOCK_METHOD(std::unique_ptr<AsyncDnsResolverInterface>,
     52              CreateAndResolve,
     53              (const SocketAddress&, int, absl::AnyInvocable<void()>),
     54              (override));
     55  MOCK_METHOD(std::unique_ptr<AsyncDnsResolverInterface>,
     56              Create,
     57              (),
     58              (override));
     59 };
     60 
     61 }  // namespace webrtc
     62 
     63 #endif  // API_TEST_MOCK_ASYNC_DNS_RESOLVER_H_