Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1242)

Unified Diff: content/browser/download/download_browsertest.cc

Issue 541743002: Move url_request_mock_http_job to net/test/url_request/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_browsertest.cc
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc
index a768c44bbde1a60e9377657d0debb9ebb30dbc7f..ba6571a9ee9bd4d44b611547ecbf1249d93357b8 100644
--- a/content/browser/download/download_browsertest.cc
+++ b/content/browser/download/download_browsertest.cc
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/memory/ref_counted.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
@@ -34,12 +35,12 @@
#include "content/shell/browser/shell_browser_context.h"
#include "content/shell/browser/shell_download_manager_delegate.h"
#include "content/shell/browser/shell_network_delegate.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "content/test/net/url_request_slow_download_job.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"
#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -586,7 +587,11 @@ class DownloadContentTest : public ContentBrowserTest {
base::FilePath mock_base(GetTestFilePath("download", ""));
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&URLRequestMockHTTPJob::AddUrlHandler, mock_base));
+ base::Bind(
+ &net::URLRequestMockHTTPJob::AddUrlHandler,
+ mock_base,
+ make_scoped_refptr(
+ content::BrowserThread::GetBlockingPool())));
}
TestShellDownloadManagerDelegate* GetDownloadManagerDelegate() {
@@ -798,7 +803,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, MultiDownload) {
// Start the second download and wait until it's done.
base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
- GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file));
// Download the file and wait.
NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE);
@@ -853,7 +858,8 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadOctetStream) {
PluginServiceImpl::GetInstance()->RegisterInternalPlugin(plugin_info, false);
// The following is served with a Content-Type of application/octet-stream.
- GURL url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kTestFilePath)));
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(
+ base::FilePath(kTestFilePath)));
NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE);
}
#endif
@@ -870,7 +876,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) {
// Create a download
base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
- NavigateToURL(shell(), URLRequestMockHTTPJob::GetMockUrl(file));
+ NavigateToURL(shell(), net::URLRequestMockHTTPJob::GetMockUrl(file));
// Wait until the first (intermediate file) rename and execute the callback.
file_factory->WaitForSomeCallback();
@@ -919,7 +925,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtRelease) {
// Create a download
base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
- NavigateToURL(shell(), URLRequestMockHTTPJob::GetMockUrl(file));
+ NavigateToURL(shell(), net::URLRequestMockHTTPJob::GetMockUrl(file));
// Wait until the first (intermediate file) rename and execute the callback.
file_factory->WaitForSomeCallback();
@@ -1029,7 +1035,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, ShutdownAtRelease) {
// Create a download
base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
- NavigateToURL(shell(), URLRequestMockHTTPJob::GetMockUrl(file));
+ NavigateToURL(shell(), net::URLRequestMockHTTPJob::GetMockUrl(file));
// Wait until the first (intermediate file) rename and execute the callback.
file_factory->WaitForSomeCallback();
@@ -1336,7 +1342,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
- GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file));
// Setup the error injector.
scoped_refptr<TestFileErrorInjector> injector(
@@ -1387,7 +1393,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest,
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
- GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file));
// Setup the error injector.
scoped_refptr<TestFileErrorInjector> injector(
@@ -1439,7 +1445,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileFinalRenameError) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableDownloadResumption);
base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
- GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file));
// Setup the error injector.
scoped_refptr<TestFileErrorInjector> injector(
@@ -1554,7 +1560,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveDownload) {
{
// Start the second download and wait until it's done.
base::FilePath file2(FILE_PATH_LITERAL("download-test.lib"));
- GURL url2(URLRequestMockHTTPJob::GetMockUrl(file2));
+ GURL url2(net::URLRequestMockHTTPJob::GetMockUrl(file2));
scoped_ptr<DownloadTestObserver> completion_observer(
CreateWaiter(shell(), 1));
DownloadItem* download(StartDownloadAndReturnItem(url2));

Powered by Google App Engine
This is Rietveld 408576698