Commit 7c4ff65f authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Migrate DownloadExtensionTest to the EmbeddedTestServer.

This one of only two tests using BrowserTestBase::spawned_test_server().
We want to reduce the use of the test server for a variety of reasons,
and removing access from BrowserTestBase is a good way to decrease
visibility of the spawned test server.

Also remove the download-known-size handler from the SpawnedTestServer's
Python code, as this was the only remaining test using that method.

Bug: 492672
Change-Id: Ib4836b9db3beb6a3f1f8598dea63fb262bf24dbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2498644
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821260}
parent d1d3d5a0
......@@ -56,6 +56,7 @@
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/download_test_observer.h"
#include "content/public/test/slow_download_http_response.h"
#include "content/public/test/test_download_http_response.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
......@@ -2602,10 +2603,11 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
DownloadExtensionTest_Download_Cancel) {
LoadExtension("downloads_split");
embedded_test_server()->RegisterRequestHandler(base::BindRepeating(
&content::SlowDownloadHttpResponse::HandleSlowDownloadRequest));
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(spawned_test_server()->Start());
std::string download_url =
spawned_test_server()->GetURL("download-known-size").spec();
embedded_test_server()->GetURL("/download-known-size").spec();
GoOnTheRecord();
std::unique_ptr<base::Value> result(RunFunctionAndReturnResult(
......
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