chromium/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc

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

#include "chrome/browser/extensions/api/mdns/mdns_api.h"

#include <stddef.h>

#include <memory>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/media/router/test/mock_dns_sd_registry.h"
#include "chrome/common/extensions/api/mdns.h"
#include "components/version_info/channel.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/mock_render_process_host.h"
#include "extensions/browser/event_listener_map.h"
#include "extensions/browser/event_router_factory.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h"

MockDnsSdRegistry;
_;
Return;
ReturnRef;

namespace extensions {
namespace {

const char kExtId[] =;
const char kService1[] =;
const char kService2[] =;

// Registers a new EventListener for |service_types| in |listener_list|.
void AddEventListener(
    const ExtensionId& extension_id,
    const std::string& service_type,
    content::RenderProcessHost* process,
    extensions::EventListenerMap::ListenerList* listener_list) {}

class NullDelegate : public EventListenerMap::Delegate {};

// Testing subclass of MDnsAPI which replaces calls to core browser components
// that we don't want to have to instantiate or mock for these tests.
class MockedMDnsAPI : public MDnsAPI {};

std::unique_ptr<KeyedService> MockedMDnsAPITestingFactoryFunction(
    content::BrowserContext* context) {}

std::unique_ptr<KeyedService> MDnsAPITestingFactoryFunction(
    content::BrowserContext* context) {}

std::unique_ptr<KeyedService> BuildEventRouter(
    content::BrowserContext* context) {}

// For ExtensionService interface when it requires a path that is not used.
base::FilePath bogus_file_pathname(const std::string& name) {}

class MockEventRouter : public EventRouter {};

std::unique_ptr<KeyedService> MockEventRouterFactoryFunction(
    content::BrowserContext* context) {}

class EventServiceListSizeMatcher
    : public testing::MatcherInterface<const Event&> {};

inline testing::Matcher<const Event&> EventServiceListSize(
    size_t expected_size) {}

}  // namespace

class MDnsAPITest : public extensions::ExtensionServiceTestBase {};

class MDnsAPIMaxServicesTest : public MDnsAPITest {};

class MDnsAPIDiscoveryTest : public MDnsAPITest {};

TEST_F(MDnsAPIDiscoveryTest, ServiceListenersAddedAndRemoved) {}

TEST_F(MDnsAPIMaxServicesTest, OnServiceListDoesNotExceedLimit) {}

}  // namespace extensions