#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[] = …;
void AddEventListener(
const ExtensionId& extension_id,
const std::string& service_type,
content::RenderProcessHost* process,
extensions::EventListenerMap::ListenerList* listener_list) { … }
class NullDelegate : public EventListenerMap::Delegate { … };
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) { … }
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) { … }
}
class MDnsAPITest : public extensions::ExtensionServiceTestBase { … };
class MDnsAPIMaxServicesTest : public MDnsAPITest { … };
class MDnsAPIDiscoveryTest : public MDnsAPITest { … };
TEST_F(MDnsAPIDiscoveryTest, ServiceListenersAddedAndRemoved) { … }
TEST_F(MDnsAPIMaxServicesTest, OnServiceListDoesNotExceedLimit) { … }
}