Commit de2620b0 authored by Peter Beverloo's avatar Peter Beverloo Committed by Commit Bot

Force-enable the DownloadService when running layout tests

We have a strict dependency, so the base::Feature entry should be
disabled. In addition, set the network start-up delay to zero, as there
is no need to throttle network activity in testing scenarios.

Bug: 866116
Change-Id: I5d2d22f20601824d09c7fd22233406dca7774268
Reviewed-on: https://chromium-review.googlesource.com/1153048
Commit-Queue: Peter Beverloo <peter@chromium.org>
Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579019}
parent 37b2a549
...@@ -6,11 +6,13 @@ ...@@ -6,11 +6,13 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/test/scoped_feature_list.h"
#include "components/download/content/factory/download_service_factory.h" #include "components/download/content/factory/download_service_factory.h"
#include "components/download/public/background_service/clients.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_metadata.h"
#include "components/download/public/background_service/download_params.h" #include "components/download/public/background_service/download_params.h"
#include "components/download/public/background_service/download_service.h" #include "components/download/public/background_service/download_service.h"
#include "components/download/public/background_service/features.h"
#include "content/public/browser/background_fetch_description.h" #include "content/public/browser/background_fetch_description.h"
#include "content/public/browser/background_fetch_response.h" #include "content/public/browser/background_fetch_response.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
...@@ -195,10 +197,19 @@ void LayoutTestBackgroundFetchDelegate::DownloadUrl( ...@@ -195,10 +197,19 @@ void LayoutTestBackgroundFetchDelegate::DownloadUrl(
clients->emplace(download::DownloadClient::BACKGROUND_FETCH, clients->emplace(download::DownloadClient::BACKGROUND_FETCH,
std::move(background_fetch_client)); std::move(background_fetch_client));
download_service_ = base::WrapUnique(download::BuildInMemoryDownloadService( // Use a ScopedFeatureList to enable and configure the download service as
browser_context_, std::move(clients), base::FilePath(), // if done by Finch. We have a strict dependency on it.
BrowserContext::GetBlobStorageContext(browser_context_), {
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); base::test::ScopedFeatureList download_service_configuration;
download_service_configuration.InitAndEnableFeatureWithParameters(
download::kDownloadServiceFeature, {{"start_up_delay_ms", "0"}});
download_service_ =
base::WrapUnique(download::BuildInMemoryDownloadService(
browser_context_, std::move(clients), base::FilePath(),
BrowserContext::GetBlobStorageContext(browser_context_),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
}
} }
background_fetch_client_->RegisterDownload(download_guid, job_unique_id); background_fetch_client_->RegisterDownload(download_guid, job_unique_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment