#include "third_party/blink/renderer/platform/testing/url_loader_mock_factory_impl.h"
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "services/network/public/cpp/resource_request.h"
#include "third_party/blink/public/platform/file_path_conversion.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/platform/web_url_response.h"
#include "third_party/blink/public/web/web_navigation_params.h"
#include "third_party/blink/renderer/platform/exported/wrapped_resource_response.h"
#include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h"
#include "third_party/blink/renderer/platform/loader/static_data_navigation_body_loader.h"
#include "third_party/blink/renderer/platform/network/network_utils.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_loader_mock.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
namespace blink {
URLLoaderMockFactory* URLLoaderMockFactory::GetSingletonInstance() { … }
URLLoaderMockFactoryImpl::URLLoaderMockFactoryImpl(
TestingPlatformSupport* platform)
: … { … }
URLLoaderMockFactoryImpl::~URLLoaderMockFactoryImpl() = default;
std::unique_ptr<URLLoader> URLLoaderMockFactoryImpl::CreateURLLoader() { … }
void URLLoaderMockFactoryImpl::RegisterURL(const WebURL& url,
const WebURLResponse& response,
const WebString& file_path) { … }
void URLLoaderMockFactoryImpl::RegisterErrorURL(const WebURL& url,
const WebURLResponse& response,
const WebURLError& error) { … }
void URLLoaderMockFactoryImpl::UnregisterURL(const blink::WebURL& url) { … }
void URLLoaderMockFactoryImpl::RegisterURLProtocol(
const WebString& protocol,
const WebURLResponse& response,
const WebString& file_path) { … }
void URLLoaderMockFactoryImpl::UnregisterURLProtocol(
const WebString& protocol) { … }
void URLLoaderMockFactoryImpl::UnregisterAllURLsAndClearMemoryCache() { … }
void URLLoaderMockFactoryImpl::ServeAsynchronousRequests() { … }
void URLLoaderMockFactoryImpl::FillNavigationParamsResponse(
WebNavigationParams* params) { … }
bool URLLoaderMockFactoryImpl::IsMockedURL(const blink::WebURL& url) { … }
void URLLoaderMockFactoryImpl::CancelLoad(URLLoaderMock* loader) { … }
void URLLoaderMockFactoryImpl::LoadSynchronously(
std::unique_ptr<network::ResourceRequest> request,
WebURLResponse* response,
std::optional<WebURLError>* error,
scoped_refptr<SharedBuffer>& data,
int64_t* encoded_data_length) { … }
void URLLoaderMockFactoryImpl::LoadAsynchronouly(
std::unique_ptr<network::ResourceRequest> request,
URLLoaderMock* loader) { … }
void URLLoaderMockFactoryImpl::RunUntilIdle() { … }
void URLLoaderMockFactoryImpl::LoadRequest(const WebURL& url,
WebURLResponse* response,
std::optional<WebURLError>* error,
scoped_refptr<SharedBuffer>& data) { … }
bool URLLoaderMockFactoryImpl::LookupURL(const WebURL& url,
std::optional<WebURLError>* error,
ResponseInfo* response_info) { … }
bool URLLoaderMockFactoryImpl::ReadFile(const base::FilePath& file_path,
scoped_refptr<SharedBuffer>& data) { … }
}