#include "content/browser/background_fetch/mock_background_fetch_delegate.h"
#include <utility>
#include <vector>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "content/public/browser/background_fetch_description.h"
#include "content/public/browser/background_fetch_response.h"
#include "content/public/browser/browser_thread.h"
#include "net/http/http_response_headers.h"
#include "services/network/public/cpp/header_util.h"
namespace content {
MockBackgroundFetchDelegate::TestResponse::TestResponse() = default;
MockBackgroundFetchDelegate::TestResponse::~TestResponse() = default;
MockBackgroundFetchDelegate::TestResponseBuilder::TestResponseBuilder(
int response_code)
: … { … }
MockBackgroundFetchDelegate::TestResponseBuilder::~TestResponseBuilder() =
default;
MockBackgroundFetchDelegate::TestResponseBuilder&
MockBackgroundFetchDelegate::TestResponseBuilder::AddResponseHeader(
const std::string& name,
const std::string& value) { … }
MockBackgroundFetchDelegate::TestResponseBuilder&
MockBackgroundFetchDelegate::TestResponseBuilder::SetResponseData(
std::string data) { … }
MockBackgroundFetchDelegate::TestResponseBuilder&
MockBackgroundFetchDelegate::TestResponseBuilder::MakeIndefinitelyPending() { … }
std::unique_ptr<MockBackgroundFetchDelegate::TestResponse>
MockBackgroundFetchDelegate::TestResponseBuilder::Build() { … }
MockBackgroundFetchDelegate::MockBackgroundFetchDelegate() { … }
MockBackgroundFetchDelegate::~MockBackgroundFetchDelegate() { … }
void MockBackgroundFetchDelegate::GetIconDisplaySize(
GetIconDisplaySizeCallback callback) { … }
void MockBackgroundFetchDelegate::CreateDownloadJob(
base::WeakPtr<Client> client,
std::unique_ptr<BackgroundFetchDescription> fetch_description) { … }
void MockBackgroundFetchDelegate::DownloadUrl(
const std::string& job_unique_id,
const std::string& 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 MockBackgroundFetchDelegate::Abort(const std::string& job_unique_id) { … }
void MockBackgroundFetchDelegate::MarkJobComplete(
const std::string& job_unique_id) { … }
void MockBackgroundFetchDelegate::UpdateUI(
const std::string& job_unique_id,
const std::optional<std::string>& title,
const std::optional<SkBitmap>& icon) { … }
void MockBackgroundFetchDelegate::RegisterResponse(
const GURL& url,
std::unique_ptr<TestResponse> response) { … }
void MockBackgroundFetchDelegate::PostAbortCheckingTask(
const std::string& job_unique_id,
base::OnceCallback<void()> callback) { … }
void MockBackgroundFetchDelegate::RunAbortCheckingTask(
const std::string& job_unique_id,
base::OnceCallback<void()> callback) { … }
}