// 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. #ifndef COMPONENTS_SUPERVISED_USER_TEST_SUPPORT_KIDS_MANAGEMENT_API_SERVER_MOCK_H_ #define COMPONENTS_SUPERVISED_USER_TEST_SUPPORT_KIDS_MANAGEMENT_API_SERVER_MOCK_H_ #include <memory> #include <optional> #include <string_view> #include "base/callback_list.h" #include "base/functional/callback_forward.h" #include "base/test/scoped_feature_list.h" #include "components/supervised_user/core/browser/fetcher_config.h" #include "components/supervised_user/core/browser/proto/kidsmanagement_messages.pb.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "testing/gmock/include/gmock/gmock.h" namespace supervised_user { // Configures the scoped feature list so that the related feature is initialized // with right parameters to divert kids management api traffic to an http // endpoint. See supervised_user::FetcherConfig::service_endpoint for details. void SetHttpEndpointsForKidsManagementApis( base::test::ScopedFeatureList& feature_list, std::string_view hostname); // Component of `KidsManagementApiServerMock`. Implements ClassifyUrl as both // mock and fake, allowing to account the calls but also providing a default // response (allow or restrict) for every request. Newly created instance has // purportedly unconfigured default response and will crash on first use - this // is to limit unintended / unnoticed uses of the mock during test. class KidsManagementClassifyUrlMock { … }; // Simplified implementation of the real Kids Management API server, purposed to // serve as request handlers for the net::test_server::EmbeddedTestServer. class KidsManagementApiServerMock { … }; } // namespace supervised_user #endif // COMPONENTS_SUPERVISED_USER_TEST_SUPPORT_KIDS_MANAGEMENT_API_SERVER_MOCK_H_