1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70

ash / components / arc / test / fake_net_instance.h [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_COMPONENTS_ARC_TEST_FAKE_NET_INSTANCE_H_
#define ASH_COMPONENTS_ARC_TEST_FAKE_NET_INSTANCE_H_

#include "ash/components/arc/mojom/net.mojom.h"

namespace arc {

class FakeNetInstance : public mojom::NetInstance {
 public:
  FakeNetInstance();
  ~FakeNetInstance() override;

  FakeNetInstance(const FakeNetInstance&) = delete;
  FakeNetInstance& operator=(const FakeNetInstance&) = delete;

  void Init(::mojo::PendingRemote<mojom::NetHost> host_remote,
            InitCallback callback) override;

  void ScanCompleted() override;

  void WifiEnabledStateChanged(bool is_enabled) override;

  void DisconnectAndroidVpn() override;

  void ConfigureAndroidVpn() override;

  // TODO(b/308365031): Rename mojo ActiveNetworksChanged to HostNetworksChanged
  void ActiveNetworksChanged(
      std::vector<mojom::NetworkConfigurationPtr> network) override;

  void DnsResolutionTest(const std::string& transport_name,
                         const std::string& host_name,
                         DnsResolutionTestCallback callback) override;

  void HttpTest(const std::string& transport_name,
                const ::GURL& url,
                HttpTestCallback callback) override;

  void PingTest(const std::string& transport_name,
                const std::string& ip_address,
                PingTestCallback callback) override;

  void SetUpFlag(mojom::Flag flag, bool value) override;

  void set_http_test_result(mojom::ArcHttpTestResult http_test_result) {
    http_test_result_ = http_test_result;
  }

  void set_dns_resolution_test_result(
      mojom::ArcDnsResolutionTestResult dns_resolution_test_result) {
    dns_resolution_test_result_ = dns_resolution_test_result;
  }

  void set_ping_test_result(mojom::ArcPingTestResult ping_test_result) {
    ping_test_result_ = ping_test_result;
  }

 private:
  mojom::ArcHttpTestResult http_test_result_;
  mojom::ArcDnsResolutionTestResult dns_resolution_test_result_;
  mojom::ArcPingTestResult ping_test_result_;
};

}  // namespace arc

#endif  // ASH_COMPONENTS_ARC_TEST_FAKE_NET_INSTANCE_H_