chromium/net/dns/loopback_only_unittest.cc

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

#include "net/dns/loopback_only.h"

#include <optional>
#include <unordered_set>

#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_restrictions.h"
#include "net/base/mock_network_change_notifier.h"
#include "net/base/network_change_notifier.h"
#include "net/base/test_completion_callback.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_LINUX)
#include <linux/if.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>

#include "net/base/address_map_linux.h"
#endif  // BUILDFLAG(IS_LINUX)

namespace net {

#if BUILDFLAG(IS_LINUX)

namespace {

constexpr uint8_t kIpv4LoopbackBytes[] =;
constexpr uint8_t kIpv4PrivateAddressBytes[] =;
constexpr uint8_t kIpv6LoopbackBytes[] =;
constexpr uint8_t kIpv6AddressBytes[] =;

constexpr uint8_t kIpv4LinkLocalBytes[] =;
constexpr uint8_t kIpv4InIpv6LinkLocalBytes[] =;
constexpr uint8_t kIpv6LinkLocalBytes[] =;

class StubAddressMapOwnerLinux : public AddressMapOwnerLinux {};

bool GetResultOfRunHaveOnlyLoopbackAddressesJob() {}

}  // namespace

class LoopbackOnlyTest : public ::testing::Test {};

TEST_F(LoopbackOnlyTest, HasOnlyLoopbackIpv4) {}

TEST_F(LoopbackOnlyTest, HasActiveIPv4Connection) {}

TEST_F(LoopbackOnlyTest, HasInactiveIPv4Connection) {}

TEST_F(LoopbackOnlyTest, HasOnlyLoopbackIpv6) {}

TEST_F(LoopbackOnlyTest, HasActiveIPv6Connection) {}

TEST_F(LoopbackOnlyTest, HasInactiveIPv6Connection) {}

TEST_F(LoopbackOnlyTest, IPv6LinkLocal) {}

TEST_F(LoopbackOnlyTest, ExtraOnlineLinks) {}

// TODO(crbug.com/40270154): Test HaveOnlyLoopbackAddressesUsingGetifaddrs().

#endif  // BUILDFLAG(IS_LINUX)

}  // namespace net