summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorxunjieli <xunjieli@chromium.org>2014-09-10 16:23:31 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-10 23:25:48 +0000
commit0332c191aa02efc6c24d0c87a1d41b7c12d3b8a8 (patch)
tree0b5ee639c7015db3dc82b42ffc5f5a32f81fbbc0 /chrome
parentdb7726aee7993008dff742790337f950fb371ebf (diff)
downloadchromium_src-0332c191aa02efc6c24d0c87a1d41b7c12d3b8a8.zip
chromium_src-0332c191aa02efc6c24d0c87a1d41b7c12d3b8a8.tar.gz
chromium_src-0332c191aa02efc6c24d0c87a1d41b7c12d3b8a8.tar.bz2
Move url_request_mock_http_job to net/test/url_request/
This CL is a part of the effort to move mock URLRequestJob files from content/test/net to net/test/url_request/. The reason for this refactoring is that Cronet will need to use these classes for testing, so it will be nice if they can be in net/test, as the dependency can work out nicely. BUG= Review URL: https://codereview.chromium.org/541743002 Cr-Commit-Position: refs/heads/master@{#294255}
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_encoding_browsertest.cc8
-rw-r--r--chrome/browser/browsing_data/browsing_data_remover_browsertest.cc7
-rw-r--r--chrome/browser/captive_portal/captive_portal_browsertest.cc24
-rw-r--r--chrome/browser/content_settings/content_settings_browsertest.cc4
-rw-r--r--chrome/browser/download/download_browsertest.cc6
-rw-r--r--chrome/browser/download/save_page_browsertest.cc9
-rw-r--r--chrome/browser/errorpage_browsertest.cc23
-rw-r--r--chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc4
-rw-r--r--chrome/browser/lifetime/browser_close_manager_browsertest.cc4
-rw-r--r--chrome/browser/net/dns_probe_browsertest.cc11
-rw-r--r--chrome/browser/net/url_request_mock_util.cc5
-rw-r--r--chrome/browser/plugins/npapi_infobar_browsertest.cc13
-rw-r--r--chrome/browser/policy/cloud/test_request_interceptor.cc10
-rw-r--r--chrome/browser/policy/policy_browsertest.cc25
-rw-r--r--chrome/browser/prerender/prerender_browsertest.cc24
-rw-r--r--chrome/browser/prerender/prerender_tracker_unittest.cc8
-rw-r--r--chrome/browser/ui/panels/panel_browsertest.cc2
-rw-r--r--chrome/browser/unload_browsertest.cc6
18 files changed, 122 insertions, 71 deletions
diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc
index 2c1e6d2..2df4850 100644
--- a/chrome/browser/browser_encoding_browsertest.cc
+++ b/chrome/browser/browser_encoding_browsertest.cc
@@ -23,7 +23,7 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_navigation_observer.h"
-#include "content/test/net/url_request_mock_http_job.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
namespace {
@@ -164,7 +164,7 @@ IN_PROC_BROWSER_TEST_P(BrowserEncodingTest, TestEncodingAliasMapping) {
test_file_path = test_file_path.AppendASCII(
GetParam().file_name);
- GURL url = content::URLRequestMockHTTPJob::GetMockUrl(test_file_path);
+ GURL url = net::URLRequestMockHTTPJob::GetMockUrl(test_file_path);
ui_test_utils::NavigateToURL(browser(), url);
EXPECT_EQ(GetParam().encoding_name,
browser()->tab_strip_model()->GetActiveWebContents()->
@@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, TestOverrideEncoding) {
base::FilePath test_dir_path =
base::FilePath(kTestDir).AppendASCII(kOverrideTestDir);
test_dir_path = test_dir_path.AppendASCII(kTestFileName);
- GURL url = content::URLRequestMockHTTPJob::GetMockUrl(test_dir_path);
+ GURL url = net::URLRequestMockHTTPJob::GetMockUrl(test_dir_path);
ui_test_utils::NavigateToURL(browser(), url);
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
@@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, MAYBE_TestEncodingAutoDetect) {
base::FilePath test_file_path(test_dir_path);
test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name);
- GURL url = content::URLRequestMockHTTPJob::GetMockUrl(test_file_path);
+ GURL url = net::URLRequestMockHTTPJob::GetMockUrl(test_file_path);
ui_test_utils::NavigateToURL(browser(), url);
// Get the encoding used for the page, it must be the default charset we
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
index 5d1252f..57d7f75 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -22,14 +22,15 @@
#include "content/public/common/content_paths.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/download_test_observer.h"
-#include "content/test/net/url_request_mock_http_job.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::BrowserThread;
namespace {
void SetUrlRequestMock(const base::FilePath& path) {
- content::URLRequestMockHTTPJob::AddUrlHandler(path);
+ net::URLRequestMockHTTPJob::AddUrlHandler(path,
+ BrowserThread::GetBlockingPool());
}
}
@@ -116,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, DownloadProhibited) {
// Verify can modify database after deleting it.
IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) {
- GURL url(content::URLRequestMockHTTPJob::GetMockUrl(
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(
base::FilePath().AppendASCII("simple_database.html")));
ui_test_utils::NavigateToURL(browser(), url);
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc
index 11deb82..473c229 100644
--- a/chrome/browser/captive_portal/captive_portal_browsertest.cc
+++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -42,9 +42,9 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "content/test/net/url_request_failed_job.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "net/base/net_errors.h"
#include "net/http/transport_security_state.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
@@ -56,8 +56,8 @@
using captive_portal::CaptivePortalResult;
using content::BrowserThread;
using content::URLRequestFailedJob;
-using content::URLRequestMockHTTPJob;
using content::WebContents;
+using net::URLRequestMockHTTPJob;
namespace {
@@ -427,7 +427,9 @@ net::URLRequestJob* URLRequestMockCaptivePortalJobFactory::Factory(
return new URLRequestMockHTTPJob(
request,
network_delegate,
- root_http.Append(FILE_PATH_LITERAL("title2.html")));
+ root_http.Append(FILE_PATH_LITERAL("title2.html")),
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
} else if (request->url() == GURL(kMockHttpsQuickTimeoutUrl)) {
if (behind_captive_portal_)
return new URLRequestFailedJob(
@@ -437,7 +439,9 @@ net::URLRequestJob* URLRequestMockCaptivePortalJobFactory::Factory(
return new URLRequestMockHTTPJob(
request,
network_delegate,
- root_http.Append(FILE_PATH_LITERAL("title2.html")));
+ root_http.Append(FILE_PATH_LITERAL("title2.html")),
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
} else {
// The URL should be the captive portal test URL.
EXPECT_TRUE(GURL(kMockCaptivePortalTestUrl) == request->url() ||
@@ -450,19 +454,25 @@ net::URLRequestJob* URLRequestMockCaptivePortalJobFactory::Factory(
return new URLRequestMockHTTPJob(
request,
network_delegate,
- root_http.Append(FILE_PATH_LITERAL("captive_portal/page511.html")));
+ root_http.Append(FILE_PATH_LITERAL("captive_portal/page511.html")),
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
}
return new URLRequestMockHTTPJob(
request,
network_delegate,
- root_http.Append(FILE_PATH_LITERAL("captive_portal/login.html")));
+ root_http.Append(FILE_PATH_LITERAL("captive_portal/login.html")),
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
}
// After logging in to the portal, the test URLs return a 204 response.
return new URLRequestMockHTTPJob(
request,
network_delegate,
- root_http.Append(FILE_PATH_LITERAL("captive_portal/page204.html")));
+ root_http.Append(FILE_PATH_LITERAL("captive_portal/page204.html")),
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
}
}
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc
index 91e0c66..3ec5e39 100644
--- a/chrome/browser/content_settings/content_settings_browsertest.cc
+++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -32,8 +32,8 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
@@ -42,7 +42,7 @@
#endif
using content::BrowserThread;
-using content::URLRequestMockHTTPJob;
+using net::URLRequestMockHTTPJob;
class ContentSettingsTest : public InProcessBrowserTest {
public:
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index c5b4001..8f986f8 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -86,12 +86,12 @@
#include "content/public/test/download_test_observer.h"
#include "content/public/test/test_file_error_injector.h"
#include "content/public/test/test_navigation_observer.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "content/test/net/url_request_slow_download_job.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/feature_switch.h"
#include "net/base/filename_util.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
@@ -100,11 +100,11 @@ using content::BrowserThread;
using content::DownloadItem;
using content::DownloadManager;
using content::DownloadUrlParameters;
-using content::URLRequestMockHTTPJob;
using content::URLRequestSlowDownloadJob;
using content::WebContents;
using extensions::Extension;
using extensions::FeatureSwitch;
+using net::URLRequestMockHTTPJob;
namespace {
@@ -3346,7 +3346,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_GZipWithNoContent) {
IN_PROC_BROWSER_TEST_F(DownloadTest, FeedbackService) {
// Make a dangerous file.
base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf"));
- GURL download_url(content::URLRequestMockHTTPJob::GetMockUrl(file));
+ GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(file));
scoped_ptr<content::DownloadTestObserverInterrupted> observer(
new content::DownloadTestObserverInterrupted(
DownloadManagerForBrowser(browser()), 1,
diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc
index ecaa125..ca000a4 100644
--- a/chrome/browser/download/save_page_browsertest.cc
+++ b/chrome/browser/download/save_page_browsertest.cc
@@ -37,16 +37,17 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/url_constants.h"
#include "content/public/test/test_utils.h"
-#include "content/test/net/url_request_mock_http_job.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::BrowserContext;
using content::BrowserThread;
using content::DownloadItem;
using content::DownloadManager;
-using content::URLRequestMockHTTPJob;
using content::WebContents;
+using net::URLRequestMockHTTPJob;
namespace {
@@ -499,8 +500,10 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnlyTabDestroy) {
#endif
IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveViewSourceHTMLOnly) {
base::FilePath file_name(FILE_PATH_LITERAL("a.htm"));
- GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl(
+ GURL mock_url = URLRequestMockHTTPJob::GetMockUrl(
base::FilePath(kTestDir).Append(file_name));
+ GURL view_source_url =
+ GURL(content::kViewSourceScheme + std::string(":") + mock_url.spec());
GURL actual_page_url = URLRequestMockHTTPJob::GetMockUrl(
base::FilePath(kTestDir).Append(file_name));
ui_test_utils::NavigateToURL(browser(), view_source_url);
diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc
index cb1a181..52d63af 100644
--- a/chrome/browser/errorpage_browsertest.cc
+++ b/chrome/browser/errorpage_browsertest.cc
@@ -38,12 +38,12 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/test/net/url_request_failed_job.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/http/failing_http_transaction_factory.h"
#include "net/http/http_cache.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_filter.h"
@@ -215,9 +215,12 @@ class LinkDoctorInterceptor : public net::URLRequestInterceptor {
base::FilePath root_http;
PathService::Get(chrome::DIR_TEST_DATA, &root_http);
- return new content::URLRequestMockHTTPJob(
- request, network_delegate,
- root_http.AppendASCII("mock-link-doctor.json"));
+ return new net::URLRequestMockHTTPJob(
+ request,
+ network_delegate,
+ root_http.AppendASCII("mock-link-doctor.json"),
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
}
void WaitForRequests(int requests_to_wait_for) {
@@ -276,8 +279,10 @@ void InstallMockInterceptors(
// Add a mock for the search engine the error page will use.
base::FilePath root_http;
PathService::Get(chrome::DIR_TEST_DATA, &root_http);
- content::URLRequestMockHTTPJob::AddHostnameToFileHandler(
- search_url.host(), root_http.AppendASCII("title3.html"));
+ net::URLRequestMockHTTPJob::AddHostnameToFileHandler(
+ search_url.host(),
+ root_http.AppendASCII("title3.html"),
+ BrowserThread::GetBlockingPool());
}
class ErrorPageTest : public InProcessBrowserTest {
@@ -300,7 +305,7 @@ class ErrorPageTest : public InProcessBrowserTest {
void NavigateToFileURL(const base::FilePath::StringType& file_path) {
ui_test_utils::NavigateToURL(
browser(),
- content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(file_path)));
+ net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(file_path)));
}
// Navigates to the given URL and waits for |num_navigations| to occur, and
@@ -700,7 +705,7 @@ IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_DoClickLink) {
// navigation corrections.
IN_PROC_BROWSER_TEST_F(ErrorPageTest, IFrameDNSError_Basic) {
NavigateToURLAndWaitForTitle(
- content::URLRequestMockHTTPJob::GetMockUrl(
+ net::URLRequestMockHTTPJob::GetMockUrl(
base::FilePath(FILE_PATH_LITERAL("iframe_dns_error.html"))),
"Blah",
1);
@@ -814,7 +819,7 @@ IN_PROC_BROWSER_TEST_F(ErrorPageTest, IFrameDNSError_JavaScript) {
// 404 page.
IN_PROC_BROWSER_TEST_F(ErrorPageTest, Page404) {
NavigateToURLAndWaitForTitle(
- content::URLRequestMockHTTPJob::GetMockUrl(
+ net::URLRequestMockHTTPJob::GetMockUrl(
base::FilePath(FILE_PATH_LITERAL("page404.html"))),
"SUCCESS",
1);
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
index 6e6c006..d7682c8 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
@@ -19,12 +19,12 @@
#include "content/public/browser/notification_service.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/test_utils.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "crypto/nss_util_internal.h"
#include "crypto/scoped_test_system_nss_key_slot.h"
#include "extensions/browser/notification_types.h"
#include "net/base/net_errors.h"
#include "net/cert/nss_cert_database.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "policy/policy_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -253,7 +253,7 @@ class EnterprisePlatformKeysTest : public ExtensionApiTest {
base::FilePath update_manifest_path =
base::FilePath(kTestExtensionDir).Append(kUpdateManifestFileName);
GURL update_manifest_url(
- content::URLRequestMockHTTPJob::GetMockUrl(update_manifest_path));
+ net::URLRequestMockHTTPJob::GetMockUrl(update_manifest_path));
scoped_ptr<base::ListValue> forcelist(new base::ListValue);
forcelist->AppendString(base::StringPrintf(
diff --git a/chrome/browser/lifetime/browser_close_manager_browsertest.cc b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
index ef424b8..fd59e2f 100644
--- a/chrome/browser/lifetime/browser_close_manager_browsertest.cc
+++ b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
@@ -39,9 +39,9 @@
#include "content/public/browser/web_contents.h"
#include "content/public/test/download_test_observer.h"
#include "content/public/test/test_navigation_observer.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/url_request/url_request_mock_http_job.h"
#if defined(OS_CHROMEOS)
#include "chromeos/chromeos_switches.h"
@@ -747,7 +747,7 @@ IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
// This .swf normally would be categorized as DANGEROUS_FILE, but
// TestDownloadManagerDelegate turns it into DANGEROUS_URL.
base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf"));
- GURL download_url(content::URLRequestMockHTTPJob::GetMockUrl(file));
+ GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(file));
content::DownloadTestObserverInterrupted observer(
content::BrowserContext::GetDownloadManager(browser()->profile()),
1,
diff --git a/chrome/browser/net/dns_probe_browsertest.cc b/chrome/browser/net/dns_probe_browsertest.cc
index 5658745..f1e9e02 100644
--- a/chrome/browser/net/dns_probe_browsertest.cc
+++ b/chrome/browser/net/dns_probe_browsertest.cc
@@ -31,9 +31,9 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/test/net/url_request_failed_job.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "net/base/net_errors.h"
#include "net/dns/dns_test_util.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request_filter.h"
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job.h"
@@ -48,7 +48,7 @@ using base::Unretained;
using chrome_common_net::DnsProbeStatus;
using content::BrowserThread;
using content::URLRequestFailedJob;
-using content::URLRequestMockHTTPJob;
+using net::URLRequestMockHTTPJob;
using content::WebContents;
using google_util::LinkDoctorBaseURL;
using net::MockDnsClientRule;
@@ -181,7 +181,12 @@ class DelayableURLRequestMockHTTPJob : public URLRequestMockHTTPJob,
const base::FilePath& file_path,
bool should_delay,
const DestructionCallback& destruction_callback)
- : URLRequestMockHTTPJob(request, network_delegate, file_path),
+ : URLRequestMockHTTPJob(
+ request,
+ network_delegate,
+ file_path,
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)),
should_delay_(should_delay),
start_delayed_(false),
destruction_callback_(destruction_callback) {}
diff --git a/chrome/browser/net/url_request_mock_util.cc b/chrome/browser/net/url_request_mock_util.cc
index 6255c60..bbe90df 100644
--- a/chrome/browser/net/url_request_mock_util.cc
+++ b/chrome/browser/net/url_request_mock_util.cc
@@ -11,8 +11,8 @@
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_thread.h"
#include "content/test/net/url_request_failed_job.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "content/test/net/url_request_slow_download_job.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request_filter.h"
using content::BrowserThread;
@@ -37,7 +37,8 @@ void SetUrlRequestMocksEnabled(bool enabled) {
base::FilePath root_http;
PathService::Get(chrome::DIR_TEST_DATA, &root_http);
- content::URLRequestMockHTTPJob::AddUrlHandler(root_http);
+ net::URLRequestMockHTTPJob::AddUrlHandler(root_http,
+ BrowserThread::GetBlockingPool());
} else {
// Revert to the default handlers.
net::URLRequestFilter::GetInstance()->ClearHandlers();
diff --git a/chrome/browser/plugins/npapi_infobar_browsertest.cc b/chrome/browser/plugins/npapi_infobar_browsertest.cc
index a0dd6ab..4505c55c 100644
--- a/chrome/browser/plugins/npapi_infobar_browsertest.cc
+++ b/chrome/browser/plugins/npapi_infobar_browsertest.cc
@@ -5,6 +5,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/memory/ref_counted.h"
#include "base/metrics/field_trial.h"
#include "base/path_service.h"
#include "chrome/browser/infobars/infobar_service.h"
@@ -20,12 +21,11 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
-#include "content/test/net/url_request_mock_http_job.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "url/gurl.h"
using content::BrowserThread;
-using content::URLRequestMockHTTPJob;
-
+using net::URLRequestMockHTTPJob;
namespace {
@@ -45,8 +45,11 @@ class UnauthorizedPluginInfoBarBrowserTest : public InProcessBrowserTest {
scoped_refptr<content::MessageLoopRunner> runner =
new content::MessageLoopRunner;
BrowserThread::PostTaskAndReply(
- BrowserThread::IO, FROM_HERE,
- base::Bind(URLRequestMockHTTPJob::AddUrlHandler, root_http),
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(URLRequestMockHTTPJob::AddUrlHandler,
+ root_http,
+ make_scoped_refptr(BrowserThread::GetBlockingPool())),
runner->QuitClosure());
runner->Run();
}
diff --git a/chrome/browser/policy/cloud/test_request_interceptor.cc b/chrome/browser/policy/cloud/test_request_interceptor.cc
index 32f3b7d..5c98bd24 100644
--- a/chrome/browser/policy/cloud/test_request_interceptor.cc
+++ b/chrome/browser/policy/cloud/test_request_interceptor.cc
@@ -12,11 +12,12 @@
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
-#include "content/test/net/url_request_mock_http_job.h"
+#include "content/public/browser/browser_thread.h"
#include "net/base/net_errors.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/base/upload_data_stream.h"
#include "net/base/upload_element_reader.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_filter.h"
#include "net/url_request/url_request_interceptor.h"
@@ -52,10 +53,13 @@ net::URLRequestJob* BadRequestJobCallback(
net::URLRequestJob* FileJobCallback(const base::FilePath& file_path,
net::URLRequest* request,
net::NetworkDelegate* network_delegate) {
- return new content::URLRequestMockHTTPJob(
+ return new net::URLRequestMockHTTPJob(
request,
network_delegate,
- file_path);
+ file_path,
+ content::BrowserThread::GetBlockingPool()
+ ->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
}
// Parses the upload data in |request| into |request_msg|, and validates the
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index b56da1d..aa51831 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -123,7 +123,6 @@
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/test/net/url_request_failed_job.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/process_manager.h"
@@ -135,6 +134,7 @@
#include "net/base/net_util.h"
#include "net/base/url_util.h"
#include "net/http/http_stream_factory.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_filter.h"
#include "policy/policy_constants.h"
@@ -169,7 +169,7 @@
#endif
using content::BrowserThread;
-using content::URLRequestMockHTTPJob;
+using net::URLRequestMockHTTPJob;
using testing::Mock;
using testing::Return;
using testing::_;
@@ -224,8 +224,9 @@ void RedirectHostsToTestData(const char* const urls[], size_t size) {
for (size_t i = 0; i < size; ++i) {
const GURL url(urls[i]);
EXPECT_TRUE(url.is_valid());
- filter->AddUrlInterceptor(
- url, URLRequestMockHTTPJob::CreateInterceptor(base_path));
+ filter->AddUrlInterceptor(url,
+ URLRequestMockHTTPJob::CreateInterceptor(
+ base_path, BrowserThread::GetBlockingPool()));
}
}
@@ -618,8 +619,11 @@ class PolicyTest : public InProcessBrowserTest {
base::FilePath root_http;
PathService::Get(content::DIR_TEST_DATA, &root_http);
BrowserThread::PostTaskAndReply(
- BrowserThread::IO, FROM_HERE,
- base::Bind(URLRequestMockHTTPJob::AddUrlHandler, root_http),
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(URLRequestMockHTTPJob::AddUrlHandler,
+ root_http,
+ make_scoped_refptr(BrowserThread::GetBlockingPool())),
base::MessageLoop::current()->QuitWhenIdleClosure());
content::RunMessageLoop();
}
@@ -2686,9 +2690,14 @@ class RestoreOnStartupPolicyTest
command_line->InitFromArgv(argv);
ASSERT_TRUE(std::equal(argv.begin(), argv.end(),
command_line->argv().begin()));
+ }
- // Redirect the test URLs to the test data directory.
- RedirectHostsToTestData(kRestoredURLs, arraysize(kRestoredURLs));
+ virtual void SetUpOnMainThread() OVERRIDE {
+ BrowserThread::PostTask(
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(
+ RedirectHostsToTestData, kRestoredURLs, arraysize(kRestoredURLs)));
}
void HomepageIsNotNTP() {
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index 0b0752b..4e53ad5 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -81,7 +81,6 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "extensions/common/switches.h"
#include "extensions/test/result_catcher.h"
#include "net/base/escape.h"
@@ -89,6 +88,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/ssl/client_cert_store.h"
#include "net/ssl/ssl_cert_request_info.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_filter.h"
@@ -798,7 +798,12 @@ class HangingFirstRequestInterceptor : public net::URLRequestInterceptor {
}
return new HangingURLRequestJob(request, network_delegate);
}
- return new content::URLRequestMockHTTPJob(request, network_delegate, file_);
+ return new net::URLRequestMockHTTPJob(
+ request,
+ network_delegate,
+ file_,
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
}
private:
@@ -820,13 +825,17 @@ void CreateHangingFirstRequestInterceptorOnIO(
}
// Wrapper over URLRequestMockHTTPJob that exposes extra callbacks.
-class MockHTTPJob : public content::URLRequestMockHTTPJob {
+class MockHTTPJob : public net::URLRequestMockHTTPJob {
public:
MockHTTPJob(net::URLRequest* request,
net::NetworkDelegate* delegate,
const base::FilePath& file)
- : content::URLRequestMockHTTPJob(request, delegate, file) {
- }
+ : net::URLRequestMockHTTPJob(
+ request,
+ delegate,
+ file,
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)) {}
void set_start_callback(const base::Closure& start_callback) {
start_callback_ = start_callback;
@@ -835,7 +844,7 @@ class MockHTTPJob : public content::URLRequestMockHTTPJob {
virtual void Start() OVERRIDE {
if (!start_callback_.is_null())
start_callback_.Run();
- content::URLRequestMockHTTPJob::Start();
+ net::URLRequestMockHTTPJob::Start();
}
private:
@@ -925,7 +934,8 @@ void CreateMockInterceptorOnIO(const GURL& url, const base::FilePath& file) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
net::URLRequestFilter::GetInstance()->AddUrlInterceptor(
url,
- content::URLRequestMockHTTPJob::CreateInterceptorForSingleFile(file));
+ net::URLRequestMockHTTPJob::CreateInterceptorForSingleFile(
+ file, BrowserThread::GetBlockingPool()));
}
// A ContentBrowserClient that cancels all prerenderers on OpenURL.
diff --git a/chrome/browser/prerender/prerender_tracker_unittest.cc b/chrome/browser/prerender/prerender_tracker_unittest.cc
index 2d20c45..5fc302b 100644
--- a/chrome/browser/prerender/prerender_tracker_unittest.cc
+++ b/chrome/browser/prerender/prerender_tracker_unittest.cc
@@ -19,9 +19,9 @@
#include "content/public/browser/resource_controller.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/test/test_browser_thread.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "ipc/ipc_message.h"
#include "net/base/request_priority.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/redirect_info.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_util.h"
@@ -225,7 +225,7 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectResume) {
net::TestURLRequestContext url_request_context;
DeferredRedirectDelegate delegate;
scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
- content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
+ net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
net::DEFAULT_PRIORITY,
&delegate,
NULL));
@@ -268,7 +268,7 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectMainFrame) {
net::TestURLRequestContext url_request_context;
DeferredRedirectDelegate delegate;
scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
- content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
+ net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
net::DEFAULT_PRIORITY,
&delegate,
NULL));
@@ -310,7 +310,7 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectSyncXHR) {
net::TestURLRequestContext url_request_context;
DeferredRedirectDelegate delegate;
scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
- content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
+ net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
net::DEFAULT_PRIORITY,
&delegate,
NULL));
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc
index f682312a..2d0d0a6 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -36,9 +36,9 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
-#include "content/test/net/url_request_mock_http_job.h"
#include "extensions/common/constants.h"
#include "net/base/net_util.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/hit_test.h"
#include "ui/events/event_utils.h"
diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc
index 5f8526d0..9b4add4 100644
--- a/chrome/browser/unload_browsertest.cc
+++ b/chrome/browser/unload_browsertest.cc
@@ -24,7 +24,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
-#include "content/test/net/url_request_mock_http_job.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
#include "net/url_request/url_request_test_util.h"
#if defined(OS_WIN)
@@ -146,7 +146,7 @@ class UnloadTest : public InProcessBrowserTest {
}
void NavigateToNolistenersFileTwice() {
- GURL url(content::URLRequestMockHTTPJob::GetMockUrl(
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(
base::FilePath(FILE_PATH_LITERAL("title2.html"))));
ui_test_utils::NavigateToURL(browser(), url);
CheckTitle("Title Of Awesomeness");
@@ -158,7 +158,7 @@ class UnloadTest : public InProcessBrowserTest {
// load is purposely async to test the case where the user loads another
// page without waiting for the first load to complete.
void NavigateToNolistenersFileTwiceAsync() {
- GURL url(content::URLRequestMockHTTPJob::GetMockUrl(
+ GURL url(net::URLRequestMockHTTPJob::GetMockUrl(
base::FilePath(FILE_PATH_LITERAL("title2.html"))));
ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0);
ui_test_utils::NavigateToURL(browser(), url);