// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_HTTP_RESPONSE_H_ #define CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_HTTP_RESPONSE_H_ #include <optional> #include <string> #include <vector> #include "base/containers/queue.h" #include "base/functional/callback_forward.h" #include "base/sequence_checker.h" #include "base/task/single_thread_task_runner.h" #include "net/http/http_byte_range.h" #include "net/http/http_connection_info.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" namespace net { class HttpByteRange; } // namespace net namespace content { // Class for configuring and returning http responses for download requests. // Each instance can handle one http request. // Lives on embedded test server's IO thread. class TestDownloadHttpResponse { … }; // Class for creating and monitoring the completed response from the server. // Lives on UI thread. // // Example usage with TestDownloadHttpResponse: // // test_response_handler->RegisterToTestServer(embedded_test_server()); // EXPECT_TRUE(embedded_test_server()->Start()); // GURL url = embedded_test_server()->GetURL("/random-url"); // // content::TestDownloadHttpResponse::Parameters parameters; // // Tweak the |parameters| here. // content::TestDownloadHttpResponse::StartServing(parameters, url); class TestDownloadResponseHandler { … }; } // namespace content #endif // CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_HTTP_RESPONSE_H_