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

Side by Side Diff: chrome/browser/net/url_request_mock_util.cc

Issue 8437002: Move BrowserThread to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A few updates. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/url_request_mock_util.h" 5 #include "chrome/browser/net/url_request_mock_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
11 #include "chrome/browser/net/url_request_mock_link_doctor_job.h" 11 #include "chrome/browser/net/url_request_mock_link_doctor_job.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "content/browser/net/url_request_failed_dns_job.h" 13 #include "content/browser/net/url_request_failed_dns_job.h"
14 #include "content/browser/net/url_request_mock_http_job.h" 14 #include "content/browser/net/url_request_mock_http_job.h"
15 #include "content/browser/net/url_request_slow_download_job.h" 15 #include "content/browser/net/url_request_slow_download_job.h"
16 #include "content/browser/net/url_request_slow_http_job.h" 16 #include "content/browser/net/url_request_slow_http_job.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "net/url_request/url_request_filter.h" 18 #include "net/url_request/url_request_filter.h"
19 19
20 using content::BrowserThread;
21
20 namespace chrome_browser_net { 22 namespace chrome_browser_net {
21 23
22 void SetUrlRequestMocksEnabled(bool enabled) { 24 void SetUrlRequestMocksEnabled(bool enabled) {
23 // Since this involves changing the net::URLRequest ProtocolFactory, we need 25 // Since this involves changing the net::URLRequest ProtocolFactory, we need
24 // to run on the IO thread. 26 // to run on the IO thread.
25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
26 28
27 if (enabled) { 29 if (enabled) {
28 // We have to look around for our helper files, but we only use 30 // We have to look around for our helper files, but we only use
29 // this from tests, so allow these IO operations to happen 31 // this from tests, so allow these IO operations to happen
(...skipping 10 matching lines...) Expand all
40 PathService::Get(chrome::DIR_TEST_DATA, &root_http); 42 PathService::Get(chrome::DIR_TEST_DATA, &root_http);
41 URLRequestMockHTTPJob::AddUrlHandler(root_http); 43 URLRequestMockHTTPJob::AddUrlHandler(root_http);
42 URLRequestSlowHTTPJob::AddUrlHandler(root_http); 44 URLRequestSlowHTTPJob::AddUrlHandler(root_http);
43 } else { 45 } else {
44 // Revert to the default handlers. 46 // Revert to the default handlers.
45 net::URLRequestFilter::GetInstance()->ClearHandlers(); 47 net::URLRequestFilter::GetInstance()->ClearHandlers();
46 } 48 }
47 } 49 }
48 50
49 } // namespace chrome_browser_net 51 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698