#include "content/web_test/browser/web_test_background_fetch_delegate.h"
#include <memory>
#include <utility>
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "components/download/content/factory/download_service_factory_helper.h"
#include "components/download/public/background_service/background_download_service.h"
#include "components/download/public/background_service/blob_context_getter_factory.h"
#include "components/download/public/background_service/clients.h"
#include "components/download/public/background_service/download_metadata.h"
#include "components/download/public/background_service/download_params.h"
#include "components/download/public/background_service/features.h"
#include "components/keyed_service/core/simple_factory_key.h"
#include "components/keyed_service/core/simple_key_map.h"
#include "content/public/browser/background_fetch_description.h"
#include "content/public/browser/background_fetch_response.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/storage_partition.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "third_party/blink/public/mojom/blob/blob.mojom.h"
#include "ui/gfx/geometry/size.h"
namespace content {
class TestBlobContextGetterFactory : public download::BlobContextGetterFactory { … };
class WebTestBackgroundFetchDelegate::WebTestBackgroundFetchDownloadClient
: public download::Client { … };
WebTestBackgroundFetchDelegate::WebTestBackgroundFetchDelegate(
BrowserContext* browser_context)
: … { … }
WebTestBackgroundFetchDelegate::~WebTestBackgroundFetchDelegate() = default;
void WebTestBackgroundFetchDelegate::GetIconDisplaySize(
GetIconDisplaySizeCallback callback) { … }
void WebTestBackgroundFetchDelegate::CreateDownloadJob(
base::WeakPtr<Client> client,
std::unique_ptr<BackgroundFetchDescription> fetch_description) { … }
void WebTestBackgroundFetchDelegate::DownloadUrl(
const std::string& job_unique_id,
const std::string& download_guid,
const std::string& method,
const GURL& url,
::network::mojom::CredentialsMode credentials_mode,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
const net::HttpRequestHeaders& headers,
bool has_request_body) { … }
void WebTestBackgroundFetchDelegate::Abort(const std::string& job_unique_id) { … }
void WebTestBackgroundFetchDelegate::MarkJobComplete(
const std::string& job_unique_id) { … }
void WebTestBackgroundFetchDelegate::UpdateUI(
const std::string& job_unique_id,
const std::optional<std::string>& title,
const std::optional<SkBitmap>& icon) { … }
}