diff options
Diffstat (limited to 'chrome/browser/net')
-rw-r--r-- | chrome/browser/net/url_request_mock_http_job.cc | 5 | ||||
-rw-r--r-- | chrome/browser/net/url_request_mock_util.cc | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/net/url_request_mock_http_job.cc b/chrome/browser/net/url_request_mock_http_job.cc index a35cd1e..4029605 100644 --- a/chrome/browser/net/url_request_mock_http_job.cc +++ b/chrome/browser/net/url_request_mock_http_job.cc @@ -7,6 +7,7 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "base/string_util.h" +#include "base/thread_restrictions.h" #include "base/utf_string_conversions.h" #include "chrome/common/url_constants.h" #include "net/base/net_util.h" @@ -87,6 +88,10 @@ bool URLRequestMockHTTPJob::IsRedirectResponse(GURL* location, // Private const version. void URLRequestMockHTTPJob::GetResponseInfoConst( net::HttpResponseInfo* info) const { + // We have to load our headers from disk, but we only use this class + // from tests, so allow these IO operations to happen on any thread. + base::ThreadRestrictions::ScopedAllowIO allow_io; + FilePath header_file = FilePath(file_path_.value() + kMockHeaderFileSuffix); std::string raw_headers; if (!file_util::ReadFileToString(header_file, &raw_headers)) diff --git a/chrome/browser/net/url_request_mock_util.cc b/chrome/browser/net/url_request_mock_util.cc index e6531f8..b3ac398 100644 --- a/chrome/browser/net/url_request_mock_util.cc +++ b/chrome/browser/net/url_request_mock_util.cc @@ -7,6 +7,7 @@ #include <string> #include "base/path_service.h" +#include "base/thread_restrictions.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/net/url_request_failed_dns_job.h" #include "chrome/browser/net/url_request_mock_http_job.h" @@ -24,6 +25,11 @@ void SetUrlRequestMocksEnabled(bool enabled) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (enabled) { + // We have to look around for our helper files, but we only use + // this from tests, so allow these IO operations to happen + // anywhere. + base::ThreadRestrictions::ScopedAllowIO allow_io; + URLRequestFilter::GetInstance()->ClearHandlers(); URLRequestFailedDnsJob::AddUrlHandler(); |