#include "content/browser/direct_sockets/direct_sockets_test_utils.h"
#include <string_view>
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/test_future.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/web_contents_tester.h"
#include "net/dns/host_resolver.h"
#include "services/network/public/mojom/clear_data_filter.mojom.h"
#include "services/network/public/mojom/udp_socket.mojom.h"
#include "third_party/blink/public/common/permissions_policy/origin_with_possible_wildcards.h"
#include "url/origin.h"
namespace content::test {
MockUDPSocket::MockUDPSocket(
mojo::PendingRemote<network::mojom::UDPSocketListener> listener) { … }
MockUDPSocket::~MockUDPSocket() { … }
void MockUDPSocket::Connect(const net::IPEndPoint& remote_addr,
network::mojom::UDPSocketOptionsPtr socket_options,
ConnectCallback callback) { … }
void MockUDPSocket::Send(
base::span<const uint8_t> data,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
SendCallback callback) { … }
void MockUDPSocket::MockSend(int32_t result,
const std::optional<base::span<uint8_t>>& data) { … }
MockRestrictedUDPSocket::MockRestrictedUDPSocket(
std::unique_ptr<network::TestUDPSocket> udp_socket,
mojo::PendingReceiver<network::mojom::RestrictedUDPSocket> receiver)
: … { … }
MockRestrictedUDPSocket::~MockRestrictedUDPSocket() = default;
MockNetworkContext::MockNetworkContext()
: … { … }
MockNetworkContext::MockNetworkContext(std::string_view host_mapping_rules)
: … { … }
MockNetworkContext::~MockNetworkContext() = default;
void MockNetworkContext::CreateRestrictedUDPSocket(
const net::IPEndPoint& addr,
network::mojom::RestrictedUDPSocketMode mode,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
network::mojom::RestrictedUDPSocketParamsPtr params,
mojo::PendingReceiver<network::mojom::RestrictedUDPSocket> receiver,
mojo::PendingRemote<network::mojom::UDPSocketListener> listener,
CreateRestrictedUDPSocketCallback callback) { … }
std::unique_ptr<MockUDPSocket> MockNetworkContext::CreateMockUDPSocket(
mojo::PendingRemote<network::mojom::UDPSocketListener> listener) { … }
AsyncJsRunner::AsyncJsRunner(content::WebContents* web_contents)
: … { … }
AsyncJsRunner::~AsyncJsRunner() = default;
std::unique_ptr<base::test::TestFuture<std::string>> AsyncJsRunner::RunScript(
const std::string& async_script) { … }
void AsyncJsRunner::DomOperationResponse(RenderFrameHost* render_frame_host,
const std::string& json_string) { … }
std::string AsyncJsRunner::MakeScriptSendResultToDomQueue(
const std::string& script) const { … }
IsolatedWebAppContentBrowserClient::IsolatedWebAppContentBrowserClient(
const url::Origin& isolated_app_origin)
: … { … }
bool IsolatedWebAppContentBrowserClient::ShouldUrlUseApplicationIsolationLevel(
BrowserContext* browser_context,
const GURL& url) { … }
std::optional<blink::ParsedPermissionsPolicy>
IsolatedWebAppContentBrowserClient::GetPermissionsPolicyForIsolatedWebApp(
WebContents* web_contents,
const url::Origin& app_origin) { … }
std::string WrapAsync(const std::string& script) { … }
}