summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authoradamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-24 23:19:51 +0000
committeradamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-24 23:19:51 +0000
commit7461a40e0b5dd406df38e8f8661704fe18a4e48d (patch)
tree1d5553456437f7577dfe8ce6a67d5f38227310fe /net/url_request
parent94df114cd6b457f73228dc3acd02db8cbd7210de (diff)
downloadchromium_src-7461a40e0b5dd406df38e8f8661704fe18a4e48d.zip
chromium_src-7461a40e0b5dd406df38e8f8661704fe18a4e48d.tar.gz
chromium_src-7461a40e0b5dd406df38e8f8661704fe18a4e48d.tar.bz2
Remove all "net::" prefixes under net/url_request for code that's
already in the net namespace. Review URL: http://codereview.chromium.org/6730034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/https_prober.cc22
-rw-r--r--net/url_request/https_prober.h24
-rw-r--r--net/url_request/url_request.cc85
-rw-r--r--net/url_request/url_request.h64
-rw-r--r--net/url_request/url_request_context.h8
-rw-r--r--net/url_request/url_request_error_job.h2
-rw-r--r--net/url_request/url_request_filter.cc27
-rw-r--r--net/url_request/url_request_filter.h20
-rw-r--r--net/url_request/url_request_http_job.cc2
-rw-r--r--net/url_request/url_request_http_job.h4
-rw-r--r--net/url_request/url_request_job.cc36
-rw-r--r--net/url_request/url_request_job_manager.cc52
-rw-r--r--net/url_request/url_request_job_manager.h28
-rw-r--r--net/url_request/url_request_job_tracker.h6
-rw-r--r--net/url_request/url_request_throttler_entry_interface.h4
-rw-r--r--net/url_request/url_request_throttler_header_adapter.cc4
-rw-r--r--net/url_request/url_request_throttler_header_adapter.h6
-rw-r--r--net/url_request/url_request_throttler_unittest.cc30
-rw-r--r--net/url_request/url_request_unittest.cc316
-rw-r--r--net/url_request/view_cache_helper.cc18
-rw-r--r--net/url_request/view_cache_helper.h10
-rw-r--r--net/url_request/view_cache_helper_unittest.cc48
22 files changed, 413 insertions, 403 deletions
diff --git a/net/url_request/https_prober.cc b/net/url_request/https_prober.cc
index 89d1d20..ecf33985 100644
--- a/net/url_request/https_prober.cc
+++ b/net/url_request/https_prober.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,24 +34,24 @@ bool HTTPSProber::ProbeHost(const std::string& host, URLRequestContext* ctx,
GURL url("https://" + host);
DCHECK_EQ(url.host(), host);
- net::URLRequest* req = new net::URLRequest(url, this);
+ URLRequest* req = new URLRequest(url, this);
req->set_context(ctx);
req->Start();
return true;
}
-void HTTPSProber::OnAuthRequired(net::URLRequest* request,
- net::AuthChallengeInfo* auth_info) {
+void HTTPSProber::OnAuthRequired(URLRequest* request,
+ AuthChallengeInfo* auth_info) {
Success(request);
}
-void HTTPSProber::OnSSLCertificateError(net::URLRequest* request,
+void HTTPSProber::OnSSLCertificateError(URLRequest* request,
int cert_error,
- net::X509Certificate* cert) {
+ X509Certificate* cert) {
request->ContinueDespiteLastError();
}
-void HTTPSProber::OnResponseStarted(net::URLRequest* request) {
+void HTTPSProber::OnResponseStarted(URLRequest* request) {
if (request->status().status() == URLRequestStatus::SUCCESS) {
Success(request);
} else {
@@ -59,7 +59,7 @@ void HTTPSProber::OnResponseStarted(net::URLRequest* request) {
}
}
-void HTTPSProber::OnReadCompleted(net::URLRequest* request, int bytes_read) {
+void HTTPSProber::OnReadCompleted(URLRequest* request, int bytes_read) {
NOTREACHED();
}
@@ -69,15 +69,15 @@ HTTPSProber::HTTPSProber() {
HTTPSProber::~HTTPSProber() {
}
-void HTTPSProber::Success(net::URLRequest* request) {
+void HTTPSProber::Success(URLRequest* request) {
DoCallback(request, true);
}
-void HTTPSProber::Failure(net::URLRequest* request) {
+void HTTPSProber::Failure(URLRequest* request) {
DoCallback(request, false);
}
-void HTTPSProber::DoCallback(net::URLRequest* request, bool result) {
+void HTTPSProber::DoCallback(URLRequest* request, bool result) {
std::map<std::string, HTTPSProberDelegate*>::iterator i =
inflight_probes_.find(request->original_url().host());
DCHECK(i != inflight_probes_.end());
diff --git a/net/url_request/https_prober.h b/net/url_request/https_prober.h
index 0e2d725..b461fa8 100644
--- a/net/url_request/https_prober.h
+++ b/net/url_request/https_prober.h
@@ -21,7 +21,7 @@ class URLRequestContext;
// This should be scoped inside HTTPSProber, but VC cannot compile
// HTTPProber::Delegate when HTTPSProber also inherits from
-// net::URLRequest::Delegate.
+// URLRequest::Delegate.
class HTTPSProberDelegate {
public:
virtual void ProbeComplete(bool result) = 0;
@@ -32,7 +32,7 @@ class HTTPSProberDelegate {
// HTTPSProber is a singleton object that manages HTTPS probes. A HTTPS probe
// determines if we can connect to a given host over HTTPS. It's used when
// transparently upgrading from HTTP to HTTPS (for example, for SPDY).
-class HTTPSProber : public net::URLRequest::Delegate {
+class HTTPSProber : public URLRequest::Delegate {
public:
// Returns the singleton instance.
static HTTPSProber* GetInstance();
@@ -53,14 +53,14 @@ class HTTPSProber : public net::URLRequest::Delegate {
bool ProbeHost(const std::string& host, URLRequestContext* ctx,
HTTPSProberDelegate* delegate);
- // Implementation of net::URLRequest::Delegate
- virtual void OnAuthRequired(net::URLRequest* request,
- net::AuthChallengeInfo* auth_info);
- virtual void OnSSLCertificateError(net::URLRequest* request,
+ // Implementation of URLRequest::Delegate
+ virtual void OnAuthRequired(URLRequest* request,
+ AuthChallengeInfo* auth_info);
+ virtual void OnSSLCertificateError(URLRequest* request,
int cert_error,
- net::X509Certificate* cert);
- virtual void OnResponseStarted(net::URLRequest* request);
- virtual void OnReadCompleted(net::URLRequest* request, int bytes_read);
+ X509Certificate* cert);
+ virtual void OnResponseStarted(URLRequest* request);
+ virtual void OnReadCompleted(URLRequest* request, int bytes_read);
private:
friend struct DefaultSingletonTraits<HTTPSProber>;
@@ -68,9 +68,9 @@ class HTTPSProber : public net::URLRequest::Delegate {
HTTPSProber();
~HTTPSProber();
- void Success(net::URLRequest* request);
- void Failure(net::URLRequest* request);
- void DoCallback(net::URLRequest* request, bool result);
+ void Success(URLRequest* request);
+ void Failure(URLRequest* request);
+ void DoCallback(URLRequest* request, bool result);
std::map<std::string, HTTPSProberDelegate*> inflight_probes_;
std::set<std::string> probed_;
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 099b57b..88044b4 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -25,9 +25,10 @@
#include "net/url_request/url_request_netlog_params.h"
using base::Time;
-using net::UploadData;
using std::string;
+namespace net {
+
namespace {
// Max number of http redirects to follow. Same number as gecko.
@@ -35,11 +36,11 @@ const int kMaxRedirects = 20;
// Discard headers which have meaning in POST (Content-Length, Content-Type,
// Origin).
-void StripPostSpecificHeaders(net::HttpRequestHeaders* headers) {
+void StripPostSpecificHeaders(HttpRequestHeaders* headers) {
// These are headers that may be attached to a POST.
- headers->RemoveHeader(net::HttpRequestHeaders::kContentLength);
- headers->RemoveHeader(net::HttpRequestHeaders::kContentType);
- headers->RemoveHeader(net::HttpRequestHeaders::kOrigin);
+ headers->RemoveHeader(HttpRequestHeaders::kContentLength);
+ headers->RemoveHeader(HttpRequestHeaders::kContentType);
+ headers->RemoveHeader(HttpRequestHeaders::kOrigin);
}
// This counter keeps track of the identifiers used for URL requests so far.
@@ -56,8 +57,6 @@ uint64 GenerateURLRequestIdentifier() {
} // namespace
-namespace net {
-
///////////////////////////////////////////////////////////////////////////////
// URLRequest::Interceptor
@@ -81,19 +80,19 @@ void URLRequest::Delegate::OnReceivedRedirect(URLRequest* request,
}
void URLRequest::Delegate::OnAuthRequired(URLRequest* request,
- net::AuthChallengeInfo* auth_info) {
+ AuthChallengeInfo* auth_info) {
request->CancelAuth();
}
void URLRequest::Delegate::OnCertificateRequested(
URLRequest* request,
- net::SSLCertRequestInfo* cert_request_info) {
+ SSLCertRequestInfo* cert_request_info) {
request->ContinueWithCertificate(NULL);
}
void URLRequest::Delegate::OnSSLCertificateError(URLRequest* request,
int cert_error,
- net::X509Certificate* cert) {
+ X509Certificate* cert) {
request->Cancel();
}
@@ -103,7 +102,7 @@ void URLRequest::Delegate::OnGetCookies(URLRequest* request,
void URLRequest::Delegate::OnSetCookie(URLRequest* request,
const std::string& cookie_line,
- const net::CookieOptions& options,
+ const CookieOptions& options,
bool blocked_by_policy) {
}
@@ -114,12 +113,12 @@ URLRequest::URLRequest(const GURL& url, Delegate* delegate)
: url_(url),
original_url_(url),
method_("GET"),
- load_flags_(net::LOAD_NORMAL),
+ load_flags_(LOAD_NORMAL),
delegate_(delegate),
is_pending_(false),
redirect_limit_(kMaxRedirects),
final_upload_progress_(0),
- priority_(net::LOWEST),
+ priority_(LOWEST),
identifier_(GenerateURLRequestIdentifier()) {
SIMPLE_STATS_COUNTER("URLRequestCount");
@@ -196,12 +195,12 @@ void URLRequest::AppendChunkToUpload(const char* bytes,
upload_->AppendChunk(bytes, bytes_len, is_last_chunk);
}
-void URLRequest::set_upload(net::UploadData* upload) {
+void URLRequest::set_upload(UploadData* upload) {
upload_ = upload;
}
// Get the upload data directly.
-net::UploadData* URLRequest::get_upload() {
+UploadData* URLRequest::get_upload() {
return upload_.get();
}
@@ -223,7 +222,7 @@ void URLRequest::SetExtraRequestHeaderByName(const string& name,
}
void URLRequest::SetExtraRequestHeaders(
- const net::HttpRequestHeaders& headers) {
+ const HttpRequestHeaders& headers) {
DCHECK(!is_pending_);
extra_request_headers_ = headers;
@@ -231,8 +230,8 @@ void URLRequest::SetExtraRequestHeaders(
// for request headers are implemented.
}
-net::LoadState URLRequest::GetLoadState() const {
- return job_ ? job_->GetLoadState() : net::LOAD_STATE_IDLE;
+LoadState URLRequest::GetLoadState() const {
+ return job_ ? job_->GetLoadState() : LOAD_STATE_IDLE;
}
uint64 URLRequest::GetUploadProgress() const {
@@ -277,7 +276,7 @@ HostPortPair URLRequest::GetSocketAddress() const {
return job_->GetSocketAddress();
}
-net::HttpResponseHeaders* URLRequest::response_headers() const {
+HttpResponseHeaders* URLRequest::response_headers() const {
return response_info_.headers.get();
}
@@ -380,7 +379,7 @@ void URLRequest::StartJob(URLRequestJob* job) {
DCHECK(!job_);
net_log_.BeginEvent(
- net::NetLog::TYPE_URL_REQUEST_START_JOB,
+ NetLog::TYPE_URL_REQUEST_START_JOB,
make_scoped_refptr(new URLRequestStartEventParameters(
url_, method_, load_flags_, priority_)));
@@ -406,7 +405,7 @@ void URLRequest::BeforeRequestComplete(int error) {
net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_EXTENSION, NULL);
before_request_callback_->Release(); // balanced in Start
- if (error != net::OK) {
+ if (error != OK) {
StartJob(new URLRequestErrorJob(this, error));
} else {
StartJob(URLRequestJobManager::GetInstance()->CreateJob(this));
@@ -426,14 +425,14 @@ void URLRequest::RestartWithJob(URLRequestJob *job) {
}
void URLRequest::Cancel() {
- DoCancel(net::ERR_ABORTED, net::SSLInfo());
+ DoCancel(ERR_ABORTED, SSLInfo());
}
void URLRequest::SimulateError(int os_error) {
- DoCancel(os_error, net::SSLInfo());
+ DoCancel(os_error, SSLInfo());
}
-void URLRequest::SimulateSSLError(int os_error, const net::SSLInfo& ssl_info) {
+void URLRequest::SimulateSSLError(int os_error, const SSLInfo& ssl_info) {
// This should only be called on a started request.
if (!is_pending_ || !job_ || job_->has_response_started()) {
NOTREACHED();
@@ -442,7 +441,7 @@ void URLRequest::SimulateSSLError(int os_error, const net::SSLInfo& ssl_info) {
DoCancel(os_error, ssl_info);
}
-void URLRequest::DoCancel(int os_error, const net::SSLInfo& ssl_info) {
+void URLRequest::DoCancel(int os_error, const SSLInfo& ssl_info) {
DCHECK(os_error < 0);
// If the URL request already has an error status, then canceling is a no-op.
@@ -464,7 +463,7 @@ void URLRequest::DoCancel(int os_error, const net::SSLInfo& ssl_info) {
// about being called recursively.
}
-bool URLRequest::Read(net::IOBuffer* dest, int dest_size, int* bytes_read) {
+bool URLRequest::Read(IOBuffer* dest, int dest_size, int* bytes_read) {
DCHECK(job_);
DCHECK(bytes_read);
DCHECK(!job_->is_done());
@@ -501,10 +500,10 @@ void URLRequest::ReceivedRedirect(const GURL& location, bool* defer_redirect) {
}
void URLRequest::ResponseStarted() {
- scoped_refptr<net::NetLog::EventParameters> params;
+ scoped_refptr<NetLog::EventParameters> params;
if (!status_.is_success())
- params = new net::NetLogIntegerParameter("net_error", status_.os_error());
- net_log_.EndEvent(net::NetLog::TYPE_URL_REQUEST_START_JOB, params);
+ params = new NetLogIntegerParameter("net_error", status_.os_error());
+ net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_START_JOB, params);
URLRequestJob* job =
URLRequestJobManager::GetInstance()->MaybeInterceptResponse(this);
@@ -539,7 +538,7 @@ void URLRequest::CancelAuth() {
job_->CancelAuth();
}
-void URLRequest::ContinueWithCertificate(net::X509Certificate* client_cert) {
+void URLRequest::ContinueWithCertificate(X509Certificate* client_cert) {
DCHECK(job_);
job_->ContinueWithCertificate(client_cert);
@@ -556,11 +555,11 @@ void URLRequest::PrepareToRestart() {
// Close the current URL_REQUEST_START_JOB, since we will be starting a new
// one.
- net_log_.EndEvent(net::NetLog::TYPE_URL_REQUEST_START_JOB, NULL);
+ net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_START_JOB, NULL);
OrphanJob();
- response_info_ = net::HttpResponseInfo();
+ response_info_ = HttpResponseInfo();
response_info_.request_time = Time::Now();
status_ = URLRequestStatus();
is_pending_ = false;
@@ -575,21 +574,21 @@ void URLRequest::OrphanJob() {
int URLRequest::Redirect(const GURL& location, int http_status_code) {
if (net_log_.IsLoggingAllEvents()) {
net_log_.AddEvent(
- net::NetLog::TYPE_URL_REQUEST_REDIRECTED,
- make_scoped_refptr(new net::NetLogStringParameter(
+ NetLog::TYPE_URL_REQUEST_REDIRECTED,
+ make_scoped_refptr(new NetLogStringParameter(
"location", location.possibly_invalid_spec())));
}
if (redirect_limit_ <= 0) {
DVLOG(1) << "disallowing redirect: exceeds limit";
- return net::ERR_TOO_MANY_REDIRECTS;
+ return ERR_TOO_MANY_REDIRECTS;
}
if (!location.is_valid())
- return net::ERR_INVALID_URL;
+ return ERR_INVALID_URL;
if (!job_->IsSafeRedirect(location)) {
DVLOG(1) << "disallowing redirect: unsafe protocol";
- return net::ERR_UNSAFE_REDIRECT;
+ return ERR_UNSAFE_REDIRECT;
}
bool strip_post_specific_headers = false;
@@ -626,7 +625,7 @@ int URLRequest::Redirect(const GURL& location, int http_status_code) {
PrepareToRestart();
Start();
- return net::OK;
+ return OK;
}
URLRequestContext* URLRequest::context() const {
@@ -640,13 +639,13 @@ void URLRequest::set_context(URLRequestContext* context) {
// If the context this request belongs to has changed, update the tracker.
if (prev_context != context) {
- net_log_.EndEvent(net::NetLog::TYPE_REQUEST_ALIVE, NULL);
- net_log_ = net::BoundNetLog();
+ net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE, NULL);
+ net_log_ = BoundNetLog();
if (context) {
- net_log_ = net::BoundNetLog::Make(context->net_log(),
- net::NetLog::SOURCE_URL_REQUEST);
- net_log_.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE, NULL);
+ net_log_ = BoundNetLog::Make(context->net_log(),
+ NetLog::SOURCE_URL_REQUEST);
+ net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE, NULL);
}
}
}
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index 0a65f69..c2a6c32 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -167,7 +167,7 @@ class URLRequest : public base::NonThreadSafe {
// When it does so, the request will be reissued, restarting the sequence
// of On* callbacks.
virtual void OnAuthRequired(URLRequest* request,
- net::AuthChallengeInfo* auth_info);
+ AuthChallengeInfo* auth_info);
// Called when we receive an SSL CertificateRequest message for client
// authentication. The delegate should call
@@ -176,17 +176,17 @@ class URLRequest : public base::NonThreadSafe {
// handshake without a client certificate.
virtual void OnCertificateRequested(
URLRequest* request,
- net::SSLCertRequestInfo* cert_request_info);
+ SSLCertRequestInfo* cert_request_info);
// Called when using SSL and the server responds with a certificate with
// an error, for example, whose common name does not match the common name
// we were expecting for that host. The delegate should either do the
// safe thing and Cancel() the request or decide to proceed by calling
- // ContinueDespiteLastError(). cert_error is a net::ERR_* error code
+ // ContinueDespiteLastError(). cert_error is a ERR_* error code
// indicating what's wrong with the certificate.
virtual void OnSSLCertificateError(URLRequest* request,
int cert_error,
- net::X509Certificate* cert);
+ X509Certificate* cert);
// Called when reading cookies. |blocked_by_policy| is true if access to
// cookies was denied due to content settings. This method will never be
@@ -198,7 +198,7 @@ class URLRequest : public base::NonThreadSafe {
// when LOAD_DO_NOT_SAVE_COOKIES is specified.
virtual void OnSetCookie(URLRequest* request,
const std::string& cookie_line,
- const net::CookieOptions& options,
+ const CookieOptions& options,
bool blocked_by_policy);
// After calling Start(), the delegate will receive an OnResponseStarted
@@ -339,10 +339,10 @@ class URLRequest : public base::NonThreadSafe {
bool is_last_chunk);
// Set the upload data directly.
- void set_upload(net::UploadData* upload);
+ void set_upload(UploadData* upload);
// Get the upload data directly.
- net::UploadData* get_upload();
+ UploadData* get_upload();
// Returns true if the request has a non-empty message body to upload.
bool has_upload() const;
@@ -357,14 +357,14 @@ class URLRequest : public base::NonThreadSafe {
// Sets all extra request headers. Any extra request headers set by other
// methods are overwritten by this method. This method may only be called
// before Start() is called. It is an error to call it later.
- void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers);
+ void SetExtraRequestHeaders(const HttpRequestHeaders& headers);
- const net::HttpRequestHeaders& extra_request_headers() const {
+ const HttpRequestHeaders& extra_request_headers() const {
return extra_request_headers_;
}
// Returns the current load state for the request.
- net::LoadState GetLoadState() const;
+ LoadState GetLoadState() const;
// Returns the current upload progress in bytes.
uint64 GetUploadProgress() const;
@@ -420,10 +420,10 @@ class URLRequest : public base::NonThreadSafe {
// Get all response headers, as a HttpResponseHeaders object. See comments
// in HttpResponseHeaders class as to the format of the data.
- net::HttpResponseHeaders* response_headers() const;
+ HttpResponseHeaders* response_headers() const;
// Get the SSL connection info.
- const net::SSLInfo& ssl_info() const {
+ const SSLInfo& ssl_info() const {
return response_info_.ssl_info;
}
@@ -447,9 +447,9 @@ class URLRequest : public base::NonThreadSafe {
int GetResponseCode();
// Get the HTTP response info in its entirety.
- const net::HttpResponseInfo& response_info() const { return response_info_; }
+ const HttpResponseInfo& response_info() const { return response_info_; }
- // Access the net::LOAD_* flags modifying this request (see load_flags.h).
+ // Access the LOAD_* flags modifying this request (see load_flags.h).
int load_flags() const { return load_flags_; }
void set_load_flags(int flags) { load_flags_ = flags; }
@@ -458,7 +458,7 @@ class URLRequest : public base::NonThreadSafe {
bool is_pending() const { return is_pending_; }
// Returns the error status of the request.
- const net::URLRequestStatus& status() const { return status_; }
+ const URLRequestStatus& status() const { return status_; }
// Returns a globally unique identifier for this request.
uint64 identifier() const { return identifier_; }
@@ -482,7 +482,7 @@ class URLRequest : public base::NonThreadSafe {
// for values) and attaches |ssl_info| as the SSLInfo for that request. This
// is useful to attach a certificate and certificate error to a canceled
// request.
- void SimulateSSLError(int os_error, const net::SSLInfo& ssl_info);
+ void SimulateSSLError(int os_error, const SSLInfo& ssl_info);
// Read initiates an asynchronous read from the response, and must only
// be called after the OnResponseStarted callback is received with a
@@ -506,7 +506,7 @@ class URLRequest : public base::NonThreadSafe {
//
// If a read error occurs, Read returns false and the request->status
// will be set to an error.
- bool Read(net::IOBuffer* buf, int max_bytes, int* bytes_read);
+ bool Read(IOBuffer* buf, int max_bytes, int* bytes_read);
// If this request is being cached by the HTTP cache, stop subsequent caching.
// Note that this method has no effect on other (simultaneous or not) requests
@@ -529,7 +529,7 @@ class URLRequest : public base::NonThreadSafe {
// This method can be called after the user selects a client certificate to
// instruct this URLRequest to continue with the request with the
// certificate. Pass NULL if the user doesn't have a client certificate.
- void ContinueWithCertificate(net::X509Certificate* client_cert);
+ void ContinueWithCertificate(X509Certificate* client_cert);
// This method can be called after some error notifications to instruct this
// URLRequest to ignore the current error and continue with the request. To
@@ -540,16 +540,16 @@ class URLRequest : public base::NonThreadSafe {
URLRequestContext* context() const;
void set_context(URLRequestContext* context);
- const net::BoundNetLog& net_log() const { return net_log_; }
+ const BoundNetLog& net_log() const { return net_log_; }
// Returns the expected content size if available
int64 GetExpectedContentSize() const;
// Returns the priority level for this request.
- net::RequestPriority priority() const { return priority_; }
- void set_priority(net::RequestPriority priority) {
- DCHECK_GE(priority, net::HIGHEST);
- DCHECK_LT(priority, net::NUM_PRIORITIES);
+ RequestPriority priority() const { return priority_; }
+ void set_priority(RequestPriority priority) {
+ DCHECK_GE(priority, HIGHEST);
+ DCHECK_LT(priority, NUM_PRIORITIES);
priority_ = priority;
}
@@ -562,9 +562,9 @@ class URLRequest : public base::NonThreadSafe {
void set_is_pending(bool value) { is_pending_ = value; }
// Allow the URLRequestJob class to set our status too
- void set_status(const net::URLRequestStatus& value) { status_ = value; }
+ void set_status(const URLRequestStatus& value) { status_ = value; }
- // Allow the URLRequestJob to redirect this request. Returns net::OK if
+ // Allow the URLRequestJob to redirect this request. Returns OK if
// successful, otherwise an error code is returned.
int Redirect(const GURL& location, int http_status_code);
@@ -597,7 +597,7 @@ class URLRequest : public base::NonThreadSafe {
// Cancels the request and set the error and ssl info for this request to the
// passed values.
- void DoCancel(int os_error, const net::SSLInfo& ssl_info);
+ void DoCancel(int os_error, const SSLInfo& ssl_info);
// Resumes or blocks a request paused by the NetworkDelegate::OnBeforeRequest
// handler. If |blocked| is true, the request is blocked and an error page is
@@ -612,16 +612,16 @@ class URLRequest : public base::NonThreadSafe {
scoped_refptr<URLRequestContext> context_;
// Tracks the time spent in various load states throughout this request.
- net::BoundNetLog net_log_;
+ BoundNetLog net_log_;
scoped_refptr<URLRequestJob> job_;
- scoped_refptr<net::UploadData> upload_;
+ scoped_refptr<UploadData> upload_;
GURL url_;
GURL original_url_;
GURL first_party_for_cookies_;
std::string method_; // "GET", "POST", etc. Should be all uppercase.
std::string referrer_;
- net::HttpRequestHeaders extra_request_headers_;
+ HttpRequestHeaders extra_request_headers_;
int load_flags_; // Flags indicating the request type for the load;
// expected values are LOAD_* enums above.
@@ -630,10 +630,10 @@ class URLRequest : public base::NonThreadSafe {
// Current error status of the job. When no error has been encountered, this
// will be SUCCESS. If multiple errors have been encountered, this will be
// the first non-SUCCESS status seen.
- net::URLRequestStatus status_;
+ URLRequestStatus status_;
// The HTTP response info, lazily initialized.
- net::HttpResponseInfo response_info_;
+ HttpResponseInfo response_info_;
// Tells us whether the job is outstanding. This is true from the time
// Start() is called to the time we dispatch RequestComplete and indicates
@@ -653,7 +653,7 @@ class URLRequest : public base::NonThreadSafe {
// The priority level for this request. Objects like ClientSocketPool use
// this to determine which URLRequest to allocate sockets to first.
- net::RequestPriority priority_;
+ RequestPriority priority_;
// A globally unique identifier for this request.
const uint64 identifier_;
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 63e069a..ef4a357 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -82,7 +82,7 @@ class URLRequestContext
DnsCertProvenanceChecker* dns_cert_checker() const {
return dns_cert_checker_;
}
- void set_dns_cert_checker(net::DnsCertProvenanceChecker* dns_cert_checker) {
+ void set_dns_cert_checker(DnsCertProvenanceChecker* dns_cert_checker) {
dns_cert_checker_ = dns_cert_checker;
}
@@ -94,7 +94,7 @@ class URLRequestContext
// Get the ssl config service for this context.
SSLConfigService* ssl_config_service() const { return ssl_config_service_; }
- void set_ssl_config_service(net::SSLConfigService* service) {
+ void set_ssl_config_service(SSLConfigService* service) {
ssl_config_service_ = service;
}
@@ -119,7 +119,7 @@ class URLRequestContext
FtpTransactionFactory* ftp_transaction_factory() {
return ftp_transaction_factory_;
}
- void set_ftp_transaction_factory(net::FtpTransactionFactory* factory) {
+ void set_ftp_transaction_factory(FtpTransactionFactory* factory) {
ftp_transaction_factory_ = factory;
}
@@ -144,7 +144,7 @@ class URLRequestContext
return transport_security_state_;
}
void set_transport_security_state(
- net::TransportSecurityState* state) {
+ TransportSecurityState* state) {
transport_security_state_ = state;
}
diff --git a/net/url_request/url_request_error_job.h b/net/url_request/url_request_error_job.h
index 99bdef2..31cb384 100644
--- a/net/url_request/url_request_error_job.h
+++ b/net/url_request/url_request_error_job.h
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Invalid URLs go through this net::URLRequestJob class rather than being
+// Invalid URLs go through this URLRequestJob class rather than being
// passed to the default job handler.
#ifndef NET_URL_REQUEST_URL_REQUEST_ERROR_JOB_H_
diff --git a/net/url_request/url_request_filter.cc b/net/url_request/url_request_filter.cc
index a076d48..fe9ba3c 100644
--- a/net/url_request/url_request_filter.cc
+++ b/net/url_request/url_request_filter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,8 +15,8 @@ URLRequestFilter* URLRequestFilter::shared_instance_ = NULL;
URLRequestFilter::~URLRequestFilter() {}
// static
-net::URLRequestJob* URLRequestFilter::Factory(net::URLRequest* request,
- const std::string& scheme) {
+URLRequestJob* URLRequestFilter::Factory(URLRequest* request,
+ const std::string& scheme) {
// Returning null here just means that the built-in handler will be used.
return GetInstance()->FindRequestHandler(request, scheme);
}
@@ -29,12 +29,11 @@ URLRequestFilter* URLRequestFilter::GetInstance() {
}
void URLRequestFilter::AddHostnameHandler(const std::string& scheme,
- const std::string& hostname, net::URLRequest::ProtocolFactory* factory) {
+ const std::string& hostname, URLRequest::ProtocolFactory* factory) {
hostname_handler_map_[make_pair(scheme, hostname)] = factory;
// Register with the ProtocolFactory.
- net::URLRequest::RegisterProtocolFactory(scheme,
- &URLRequestFilter::Factory);
+ URLRequest::RegisterProtocolFactory(scheme, &URLRequestFilter::Factory);
#ifndef NDEBUG
// Check to see if we're masking URLs in the url_handler_map_.
@@ -56,7 +55,7 @@ void URLRequestFilter::RemoveHostnameHandler(const std::string& scheme,
DCHECK(iter != hostname_handler_map_.end());
hostname_handler_map_.erase(iter);
- // Note that we don't unregister from the net::URLRequest ProtocolFactory as
+ // Note that we don't unregister from the URLRequest ProtocolFactory as
// this would left no protocol factory for the scheme.
// URLRequestFilter::Factory will keep forwarding the requests to the
// URLRequestInetJob.
@@ -64,13 +63,13 @@ void URLRequestFilter::RemoveHostnameHandler(const std::string& scheme,
bool URLRequestFilter::AddUrlHandler(
const GURL& url,
- net::URLRequest::ProtocolFactory* factory) {
+ URLRequest::ProtocolFactory* factory) {
if (!url.is_valid())
return false;
url_handler_map_[url.spec()] = factory;
// Register with the ProtocolFactory.
- net::URLRequest::RegisterProtocolFactory(url.scheme(),
+ URLRequest::RegisterProtocolFactory(url.scheme(),
&URLRequestFilter::Factory);
#ifndef NDEBUG
// Check to see if this URL is masked by a hostname handler.
@@ -88,7 +87,7 @@ void URLRequestFilter::RemoveUrlHandler(const GURL& url) {
DCHECK(iter != url_handler_map_.end());
url_handler_map_.erase(iter);
- // Note that we don't unregister from the net::URLRequest ProtocolFactory as
+ // Note that we don't unregister from the URLRequest ProtocolFactory as
// this would left no protocol factory for the scheme.
// URLRequestFilter::Factory will keep forwarding the requests to the
// URLRequestInetJob.
@@ -107,7 +106,7 @@ void URLRequestFilter::ClearHandlers() {
}
for (std::set<std::string>::const_iterator scheme = schemes.begin();
scheme != schemes.end(); ++scheme) {
- net::URLRequest::RegisterProtocolFactory(*scheme, NULL);
+ URLRequest::RegisterProtocolFactory(*scheme, NULL);
}
url_handler_map_.clear();
@@ -117,10 +116,10 @@ void URLRequestFilter::ClearHandlers() {
URLRequestFilter::URLRequestFilter() : hit_count_(0) { }
-net::URLRequestJob* URLRequestFilter::FindRequestHandler(
- net::URLRequest* request,
+URLRequestJob* URLRequestFilter::FindRequestHandler(
+ URLRequest* request,
const std::string& scheme) {
- net::URLRequestJob* job = NULL;
+ URLRequestJob* job = NULL;
if (request->url().is_valid()) {
// Check the hostname map first.
const std::string& hostname = request->url().host();
diff --git a/net/url_request/url_request_filter.h b/net/url_request/url_request_filter.h
index ec80cb3..4c7b5bf 100644
--- a/net/url_request/url_request_filter.h
+++ b/net/url_request/url_request_filter.h
@@ -1,12 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// A class to help filter net::URLRequest jobs based on the URL of the request
+// A class to help filter URLRequest jobs based on the URL of the request
// rather than just the scheme. Example usage:
//
// // Use as an "http" handler.
-// net::URLRequest::RegisterProtocolFactory("http", &URLRequestFilter::Factory);
+// URLRequest::RegisterProtocolFactory("http", &URLRequestFilter::Factory);
// // Add special handling for the URL http://foo.com/
// URLRequestFilter::GetInstance()->AddUrlHandler(
// GURL("http://foo.com/"),
@@ -35,27 +35,27 @@ class URLRequestFilter {
public:
// scheme,hostname -> ProtocolFactory
typedef std::map<std::pair<std::string, std::string>,
- net::URLRequest::ProtocolFactory*> HostnameHandlerMap;
- typedef base::hash_map<std::string, net::URLRequest::ProtocolFactory*>
+ URLRequest::ProtocolFactory*> HostnameHandlerMap;
+ typedef base::hash_map<std::string, URLRequest::ProtocolFactory*>
UrlHandlerMap;
~URLRequestFilter();
- static net::URLRequest::ProtocolFactory Factory;
+ static URLRequest::ProtocolFactory Factory;
// Singleton instance for use.
static URLRequestFilter* GetInstance();
void AddHostnameHandler(const std::string& scheme,
const std::string& hostname,
- net::URLRequest::ProtocolFactory* factory);
+ URLRequest::ProtocolFactory* factory);
void RemoveHostnameHandler(const std::string& scheme,
const std::string& hostname);
// Returns true if we successfully added the URL handler. This will replace
// old handlers for the URL if one existed.
bool AddUrlHandler(const GURL& url,
- net::URLRequest::ProtocolFactory* factory);
+ URLRequest::ProtocolFactory* factory);
void RemoveUrlHandler(const GURL& url);
@@ -70,8 +70,8 @@ class URLRequestFilter {
URLRequestFilter();
// Helper method that looks up the request in the url_handler_map_.
- net::URLRequestJob* FindRequestHandler(net::URLRequest* request,
- const std::string& scheme);
+ URLRequestJob* FindRequestHandler(URLRequest* request,
+ const std::string& scheme);
// Maps hostnames to factories. Hostnames take priority over URLs.
HostnameHandlerMap hostname_handler_map_;
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index d8f0ab4..583cc0b 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -1057,7 +1057,7 @@ void URLRequestHttpJob::RecordTimer() {
to_start);
}
- const bool is_prerender = !!(request_info_.load_flags & net::LOAD_PRERENDER);
+ const bool is_prerender = !!(request_info_.load_flags & LOAD_PRERENDER);
if (is_prerender) {
UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpTimeToFirstByte_Prerender",
to_start);
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h
index d4e37f6..0d12486 100644
--- a/net/url_request/url_request_http_job.h
+++ b/net/url_request/url_request_http_job.h
@@ -25,7 +25,7 @@ class HttpResponseInfo;
class HttpTransaction;
class URLRequestContext;
-// A net::URLRequestJob subclass that is built on top of HttpTransaction. It
+// A URLRequestJob subclass that is built on top of HttpTransaction. It
// provides an implementation for both HTTP and HTTPS.
class URLRequestHttpJob : public URLRequestJob {
public:
@@ -141,7 +141,7 @@ class URLRequestHttpJob : public URLRequestJob {
explicit HttpFilterContext(URLRequestHttpJob* job);
virtual ~HttpFilterContext();
- // net::FilterContext implementation.
+ // FilterContext implementation.
virtual bool GetMimeType(std::string* mime_type) const;
virtual bool GetURL(GURL* gurl) const;
virtual base::Time GetRequestTime() const;
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index 11d33da9..4306167 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -36,11 +36,11 @@ URLRequestJob::URLRequestJob(URLRequest* request)
g_url_request_job_tracker.AddNewJob(this);
}
-void URLRequestJob::SetUpload(net::UploadData* upload) {
+void URLRequestJob::SetUpload(UploadData* upload) {
}
void URLRequestJob::SetExtraRequestHeaders(
- const net::HttpRequestHeaders& headers) {
+ const HttpRequestHeaders& headers) {
}
void URLRequestJob::Kill() {
@@ -57,7 +57,7 @@ void URLRequestJob::DetachRequest() {
// This function calls ReadData to get stream data. If a filter exists, passes
// the data to the attached filter. Then returns the output from filter back to
// the caller.
-bool URLRequestJob::Read(net::IOBuffer* buf, int buf_size, int *bytes_read) {
+bool URLRequestJob::Read(IOBuffer* buf, int buf_size, int *bytes_read) {
bool rv = false;
DCHECK_LT(buf_size, 1000000); // sanity check
@@ -92,8 +92,8 @@ void URLRequestJob::StopCaching() {
// Nothing to do here.
}
-net::LoadState URLRequestJob::GetLoadState() const {
- return net::LOAD_STATE_IDLE;
+LoadState URLRequestJob::GetLoadState() const {
+ return LOAD_STATE_IDLE;
}
uint64 URLRequestJob::GetUploadProgress() const {
@@ -104,7 +104,7 @@ bool URLRequestJob::GetCharset(std::string* charset) {
return false;
}
-void URLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) {
+void URLRequestJob::GetResponseInfo(HttpResponseInfo* info) {
}
bool URLRequestJob::GetResponseCookies(std::vector<std::string>* cookies) {
@@ -118,7 +118,7 @@ Filter* URLRequestJob::SetupFilter() const {
bool URLRequestJob::IsRedirectResponse(GURL* location,
int* http_status_code) {
// For non-HTTP jobs, headers will be null.
- net::HttpResponseHeaders* headers = request_->response_headers();
+ HttpResponseHeaders* headers = request_->response_headers();
if (!headers)
return false;
@@ -140,7 +140,7 @@ bool URLRequestJob::NeedsAuth() {
}
void URLRequestJob::GetAuthChallengeInfo(
- scoped_refptr<net::AuthChallengeInfo>* auth_info) {
+ scoped_refptr<AuthChallengeInfo>* auth_info) {
// This will only be called if NeedsAuth() returns true, in which
// case the derived class should implement this!
NOTREACHED();
@@ -160,7 +160,7 @@ void URLRequestJob::CancelAuth() {
}
void URLRequestJob::ContinueWithCertificate(
- net::X509Certificate* client_cert) {
+ X509Certificate* client_cert) {
// The derived class should implement this!
NOTREACHED();
}
@@ -218,7 +218,7 @@ void URLRequestJob::NotifyHeadersComplete() {
// Initialize to the current time, and let the subclass optionally override
// the time stamps if it has that information. The default request_time is
- // set by net::URLRequest before it calls our Start method.
+ // set by URLRequest before it calls our Start method.
request_->response_info_.response_time = base::Time::Now();
GetResponseInfo(&request_->response_info_);
@@ -263,7 +263,7 @@ void URLRequestJob::NotifyHeadersComplete() {
return;
}
} else if (NeedsAuth()) {
- scoped_refptr<net::AuthChallengeInfo> auth_info;
+ scoped_refptr<AuthChallengeInfo> auth_info;
GetAuthChallengeInfo(&auth_info);
// Need to check for a NULL auth_info because the server may have failed
// to send a challenge with the 401 response.
@@ -402,7 +402,7 @@ void URLRequestJob::CompleteNotifyDone() {
void URLRequestJob::NotifyCanceled() {
if (!done_) {
NotifyDone(URLRequestStatus(URLRequestStatus::CANCELED,
- net::ERR_ABORTED));
+ ERR_ABORTED));
}
}
@@ -412,7 +412,7 @@ void URLRequestJob::NotifyRestartRequired() {
request_->Restart();
}
-bool URLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size,
+bool URLRequestJob::ReadRawData(IOBuffer* buf, int buf_size,
int *bytes_read) {
DCHECK(bytes_read);
*bytes_read = 0;
@@ -506,7 +506,7 @@ bool URLRequestJob::ReadFilteredData(int* bytes_read) {
case Filter::FILTER_ERROR: {
filter_needs_more_output_space_ = false;
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
- net::ERR_CONTENT_DECODING_FAILED));
+ ERR_CONTENT_DECODING_FAILED));
rv = false;
break;
}
@@ -536,7 +536,7 @@ const URLRequestStatus URLRequestJob::GetStatus() {
return request_->status();
// If the request is gone, we must be cancelled.
return URLRequestStatus(URLRequestStatus::CANCELED,
- net::ERR_ABORTED);
+ ERR_ABORTED);
}
void URLRequestJob::SetStatus(const URLRequestStatus &status) {
@@ -556,14 +556,14 @@ bool URLRequestJob::ReadRawDataForFilter(int* bytes_read) {
// TODO(mbelshe): is it possible that the filter needs *MORE* data
// when there is some data already in the buffer?
if (!filter_->stream_data_len() && !is_done()) {
- net::IOBuffer* stream_buffer = filter_->stream_buffer();
+ IOBuffer* stream_buffer = filter_->stream_buffer();
int stream_buffer_size = filter_->stream_buffer_size();
rv = ReadRawDataHelper(stream_buffer, stream_buffer_size, bytes_read);
}
return rv;
}
-bool URLRequestJob::ReadRawDataHelper(net::IOBuffer* buf, int buf_size,
+bool URLRequestJob::ReadRawDataHelper(IOBuffer* buf, int buf_size,
int* bytes_read) {
DCHECK(!request_->status().is_io_pending());
DCHECK(raw_read_buffer_ == NULL);
@@ -587,7 +587,7 @@ void URLRequestJob::FollowRedirect(const GURL& location, int http_status_code) {
g_url_request_job_tracker.OnJobRedirect(this, location, http_status_code);
int rv = request_->Redirect(location, http_status_code);
- if (rv != net::OK)
+ if (rv != OK)
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
}
diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc
index 5fd7be6..8a765b0 100644
--- a/net/url_request/url_request_job_manager.cc
+++ b/net/url_request/url_request_job_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,18 +18,18 @@
#include "net/url_request/url_request_ftp_job.h"
#include "net/url_request/url_request_http_job.h"
+namespace net {
+
// The built-in set of protocol factories
namespace {
struct SchemeToFactory {
const char* scheme;
- net::URLRequest::ProtocolFactory* factory;
+ URLRequest::ProtocolFactory* factory;
};
} // namespace
-namespace net {
-
static const SchemeToFactory kBuiltinFactories[] = {
{ "http", URLRequestHttpJob::Factory },
{ "https", URLRequestHttpJob::Factory },
@@ -44,30 +44,30 @@ URLRequestJobManager* URLRequestJobManager::GetInstance() {
return Singleton<URLRequestJobManager>::get();
}
-net::URLRequestJob* URLRequestJobManager::CreateJob(
- net::URLRequest* request) const {
+URLRequestJob* URLRequestJobManager::CreateJob(
+ URLRequest* request) const {
#ifndef NDEBUG
DCHECK(IsAllowedThread());
#endif
// If we are given an invalid URL, then don't even try to inspect the scheme.
if (!request->url().is_valid())
- return new net::URLRequestErrorJob(request, net::ERR_INVALID_URL);
+ return new URLRequestErrorJob(request, ERR_INVALID_URL);
// We do this here to avoid asking interceptors about unsupported schemes.
const std::string& scheme = request->url().scheme(); // already lowercase
if (!SupportsScheme(scheme))
- return new net::URLRequestErrorJob(request, net::ERR_UNKNOWN_URL_SCHEME);
+ return new URLRequestErrorJob(request, ERR_UNKNOWN_URL_SCHEME);
// THREAD-SAFETY NOTICE:
// We do not need to acquire the lock here since we are only reading our
// data structures. They should only be modified on the current thread.
// See if the request should be intercepted.
- if (!(request->load_flags() & net::LOAD_DISABLE_INTERCEPT)) {
+ if (!(request->load_flags() & LOAD_DISABLE_INTERCEPT)) {
InterceptorList::const_iterator i;
for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- net::URLRequestJob* job = (*i)->MaybeIntercept(request);
+ URLRequestJob* job = (*i)->MaybeIntercept(request);
if (job)
return job;
}
@@ -78,7 +78,7 @@ net::URLRequestJob* URLRequestJobManager::CreateJob(
// built-in protocol factory.
FactoryMap::const_iterator i = factories_.find(scheme);
if (i != factories_.end()) {
- net::URLRequestJob* job = i->second(request, scheme);
+ URLRequestJob* job = i->second(request, scheme);
if (job)
return job;
}
@@ -86,7 +86,7 @@ net::URLRequestJob* URLRequestJobManager::CreateJob(
// See if the request should be handled by a built-in protocol factory.
for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) {
if (scheme == kBuiltinFactories[i].scheme) {
- net::URLRequestJob* job = (kBuiltinFactories[i].factory)(request, scheme);
+ URLRequestJob* job = (kBuiltinFactories[i].factory)(request, scheme);
DCHECK(job); // The built-in factories are not expected to fail!
return job;
}
@@ -96,16 +96,16 @@ net::URLRequestJob* URLRequestJobManager::CreateJob(
// wasn't interested in handling the URL. That is fairly unexpected, and we
// don't know have a specific error to report here :-(
LOG(WARNING) << "Failed to map: " << request->url().spec();
- return new net::URLRequestErrorJob(request, net::ERR_FAILED);
+ return new URLRequestErrorJob(request, ERR_FAILED);
}
-net::URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect(
- net::URLRequest* request,
+URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect(
+ URLRequest* request,
const GURL& location) const {
#ifndef NDEBUG
DCHECK(IsAllowedThread());
#endif
- if ((request->load_flags() & net::LOAD_DISABLE_INTERCEPT) ||
+ if ((request->load_flags() & LOAD_DISABLE_INTERCEPT) ||
(request->status().status() == URLRequestStatus::CANCELED) ||
!request->url().is_valid() ||
!SupportsScheme(request->url().scheme()))
@@ -113,19 +113,19 @@ net::URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect(
InterceptorList::const_iterator i;
for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- net::URLRequestJob* job = (*i)->MaybeInterceptRedirect(request, location);
+ URLRequestJob* job = (*i)->MaybeInterceptRedirect(request, location);
if (job)
return job;
}
return NULL;
}
-net::URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
- net::URLRequest* request) const {
+URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
+ URLRequest* request) const {
#ifndef NDEBUG
DCHECK(IsAllowedThread());
#endif
- if ((request->load_flags() & net::LOAD_DISABLE_INTERCEPT) ||
+ if ((request->load_flags() & LOAD_DISABLE_INTERCEPT) ||
(request->status().status() == URLRequestStatus::CANCELED) ||
!request->url().is_valid() ||
!SupportsScheme(request->url().scheme()))
@@ -133,7 +133,7 @@ net::URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
InterceptorList::const_iterator i;
for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- net::URLRequestJob* job = (*i)->MaybeInterceptResponse(request);
+ URLRequestJob* job = (*i)->MaybeInterceptResponse(request);
if (job)
return job;
}
@@ -155,16 +155,16 @@ bool URLRequestJobManager::SupportsScheme(const std::string& scheme) const {
return false;
}
-net::URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory(
+URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory(
const std::string& scheme,
- net::URLRequest::ProtocolFactory* factory) {
+ URLRequest::ProtocolFactory* factory) {
#ifndef NDEBUG
DCHECK(IsAllowedThread());
#endif
base::AutoLock locked(lock_);
- net::URLRequest::ProtocolFactory* old_factory;
+ URLRequest::ProtocolFactory* old_factory;
FactoryMap::iterator i = factories_.find(scheme);
if (i != factories_.end()) {
old_factory = i->second;
@@ -180,7 +180,7 @@ net::URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory(
}
void URLRequestJobManager::RegisterRequestInterceptor(
- net::URLRequest::Interceptor* interceptor) {
+ URLRequest::Interceptor* interceptor) {
#ifndef NDEBUG
DCHECK(IsAllowedThread());
#endif
@@ -193,7 +193,7 @@ void URLRequestJobManager::RegisterRequestInterceptor(
}
void URLRequestJobManager::UnregisterRequestInterceptor(
- net::URLRequest::Interceptor* interceptor) {
+ URLRequest::Interceptor* interceptor) {
#ifndef NDEBUG
DCHECK(IsAllowedThread());
#endif
diff --git a/net/url_request/url_request_job_manager.h b/net/url_request/url_request_job_manager.h
index ca9ada9..747f923 100644
--- a/net/url_request/url_request_job_manager.h
+++ b/net/url_request/url_request_job_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,11 +19,11 @@ template <typename T> struct DefaultSingletonTraits;
namespace net {
// This class is responsible for managing the set of protocol factories and
-// request interceptors that determine how an net::URLRequestJob gets created to
-// handle an net::URLRequest.
+// request interceptors that determine how an URLRequestJob gets created to
+// handle an URLRequest.
//
// MULTI-THREADING NOTICE:
-// net::URLRequest is designed to have all consumers on a single thread, and
+// URLRequest is designed to have all consumers on a single thread, and
// so no attempt is made to support ProtocolFactory or Interceptor instances
// being registered/unregistered or in any way poked on multiple threads.
// However, we do support checking for supported schemes FROM ANY THREAD
@@ -34,21 +34,21 @@ class URLRequestJobManager {
// Returns the singleton instance.
static URLRequestJobManager* GetInstance();
- // Instantiate an net::URLRequestJob implementation based on the registered
+ // Instantiate an URLRequestJob implementation based on the registered
// interceptors and protocol factories. This will always succeed in
// returning a job unless we are--in the extreme case--out of memory.
- net::URLRequestJob* CreateJob(net::URLRequest* request) const;
+ URLRequestJob* CreateJob(URLRequest* request) const;
// Allows interceptors to hijack the request after examining the new location
// of a redirect. Returns NULL if no interceptor intervenes.
- net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
+ URLRequestJob* MaybeInterceptRedirect(URLRequest* request,
const GURL& location) const;
// Allows interceptors to hijack the request after examining the response
// status and headers. This is also called when there is no server response
// at all to allow interception of failed requests due to network errors.
// Returns NULL if no interceptor intervenes.
- net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request) const;
+ URLRequestJob* MaybeInterceptResponse(URLRequest* request) const;
// Returns true if there is a protocol factory registered for the given
// scheme. Note: also returns true if there is a built-in handler for the
@@ -58,19 +58,19 @@ class URLRequestJobManager {
// Register a protocol factory associated with the given scheme. The factory
// parameter may be null to clear any existing association. Returns the
// previously registered protocol factory if any.
- net::URLRequest::ProtocolFactory* RegisterProtocolFactory(
- const std::string& scheme, net::URLRequest::ProtocolFactory* factory);
+ URLRequest::ProtocolFactory* RegisterProtocolFactory(
+ const std::string& scheme, URLRequest::ProtocolFactory* factory);
// Register/unregister a request interceptor.
- void RegisterRequestInterceptor(net::URLRequest::Interceptor* interceptor);
- void UnregisterRequestInterceptor(net::URLRequest::Interceptor* interceptor);
+ void RegisterRequestInterceptor(URLRequest::Interceptor* interceptor);
+ void UnregisterRequestInterceptor(URLRequest::Interceptor* interceptor);
void set_enable_file_access(bool enable) { enable_file_access_ = enable; }
bool enable_file_access() const { return enable_file_access_; }
private:
- typedef std::map<std::string, net::URLRequest::ProtocolFactory*> FactoryMap;
- typedef std::vector<net::URLRequest::Interceptor*> InterceptorList;
+ typedef std::map<std::string, URLRequest::ProtocolFactory*> FactoryMap;
+ typedef std::vector<URLRequest::Interceptor*> InterceptorList;
friend struct DefaultSingletonTraits<URLRequestJobManager>;
URLRequestJobManager();
diff --git a/net/url_request/url_request_job_tracker.h b/net/url_request/url_request_job_tracker.h
index 42a146f..d558939 100644
--- a/net/url_request/url_request_job_tracker.h
+++ b/net/url_request/url_request_job_tracker.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,7 +42,7 @@ class URLRequestJobTracker {
// Called when the given job has completed, before notifying the request
virtual void OnJobDone(URLRequestJob* job,
- const net::URLRequestStatus& status) = 0;
+ const URLRequestStatus& status) = 0;
// Called when the given job is about to follow a redirect to the given
// new URL. The redirect type is given in status_code
@@ -77,7 +77,7 @@ class URLRequestJobTracker {
void RemoveJob(URLRequestJob* job);
// Job status change notifications
- void OnJobDone(URLRequestJob* job, const net::URLRequestStatus& status);
+ void OnJobDone(URLRequestJob* job, const URLRequestStatus& status);
void OnJobRedirect(URLRequestJob* job, const GURL& location,
int status_code);
diff --git a/net/url_request/url_request_throttler_entry_interface.h b/net/url_request/url_request_throttler_entry_interface.h
index 63dd14c..a8be836 100644
--- a/net/url_request/url_request_throttler_entry_interface.h
+++ b/net/url_request/url_request_throttler_entry_interface.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,7 @@ class URLRequestThrottlerEntryInterface
// Returns true when we have encountered server errors and are doing
// exponential back-off.
- // net::URLRequestHttpJob checks this method prior to every request; it
+ // URLRequestHttpJob checks this method prior to every request; it
// cancels requests if this method returns true.
virtual bool IsDuringExponentialBackoff() const = 0;
diff --git a/net/url_request/url_request_throttler_header_adapter.cc b/net/url_request/url_request_throttler_header_adapter.cc
index 368d6fe..51bbc74 100644
--- a/net/url_request/url_request_throttler_header_adapter.cc
+++ b/net/url_request/url_request_throttler_header_adapter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,7 @@
namespace net {
URLRequestThrottlerHeaderAdapter::URLRequestThrottlerHeaderAdapter(
- net::HttpResponseHeaders* headers)
+ HttpResponseHeaders* headers)
: response_header_(headers) {
}
diff --git a/net/url_request/url_request_throttler_header_adapter.h b/net/url_request/url_request_throttler_header_adapter.h
index a360747..3b0211d 100644
--- a/net/url_request/url_request_throttler_header_adapter.h
+++ b/net/url_request/url_request_throttler_header_adapter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,7 @@ class HttpResponseHeaders;
class URLRequestThrottlerHeaderAdapter
: public URLRequestThrottlerHeaderInterface {
public:
- explicit URLRequestThrottlerHeaderAdapter(net::HttpResponseHeaders* headers);
+ explicit URLRequestThrottlerHeaderAdapter(HttpResponseHeaders* headers);
virtual ~URLRequestThrottlerHeaderAdapter();
// Implementation of URLRequestThrottlerHeaderInterface
@@ -27,7 +27,7 @@ class URLRequestThrottlerHeaderAdapter
virtual int GetResponseCode() const;
private:
- const scoped_refptr<net::HttpResponseHeaders> response_header_;
+ const scoped_refptr<HttpResponseHeaders> response_header_;
};
} // namespace net
diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc
index febc69c..5ca56b9 100644
--- a/net/url_request/url_request_throttler_unittest.cc
+++ b/net/url_request/url_request_throttler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,13 +16,15 @@
using base::TimeDelta;
using base::TimeTicks;
+namespace net {
+
namespace {
class MockURLRequestThrottlerManager;
-class MockBackoffEntry : public net::BackoffEntry {
+class MockBackoffEntry : public BackoffEntry {
public:
- explicit MockBackoffEntry(const net::BackoffEntry::Policy* const policy)
- : net::BackoffEntry(policy), fake_now_(TimeTicks()) {
+ explicit MockBackoffEntry(const BackoffEntry::Policy* const policy)
+ : BackoffEntry(policy), fake_now_(TimeTicks()) {
}
virtual ~MockBackoffEntry() {}
@@ -39,7 +41,7 @@ class MockBackoffEntry : public net::BackoffEntry {
TimeTicks fake_now_;
};
-class MockURLRequestThrottlerEntry : public net::URLRequestThrottlerEntry {
+class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry {
public :
MockURLRequestThrottlerEntry() : mock_backoff_entry_(&backoff_policy_) {
// Some tests become flaky if we have jitter.
@@ -60,11 +62,11 @@ class MockURLRequestThrottlerEntry : public net::URLRequestThrottlerEntry {
}
virtual ~MockURLRequestThrottlerEntry() {}
- const net::BackoffEntry* GetBackoffEntry() const {
+ const BackoffEntry* GetBackoffEntry() const {
return &mock_backoff_entry_;
}
- net::BackoffEntry* GetBackoffEntry() {
+ BackoffEntry* GetBackoffEntry() {
return &mock_backoff_entry_;
}
@@ -86,12 +88,12 @@ class MockURLRequestThrottlerEntry : public net::URLRequestThrottlerEntry {
}
base::TimeTicks sliding_window_release_time() const {
- return net::URLRequestThrottlerEntry::sliding_window_release_time();
+ return URLRequestThrottlerEntry::sliding_window_release_time();
}
void set_sliding_window_release_time(
const base::TimeTicks& release_time) {
- net::URLRequestThrottlerEntry::set_sliding_window_release_time(
+ URLRequestThrottlerEntry::set_sliding_window_release_time(
release_time);
}
@@ -100,7 +102,7 @@ class MockURLRequestThrottlerEntry : public net::URLRequestThrottlerEntry {
};
class MockURLRequestThrottlerHeaderAdapter
- : public net::URLRequestThrottlerHeaderInterface {
+ : public URLRequestThrottlerHeaderInterface {
public:
MockURLRequestThrottlerHeaderAdapter()
: fake_retry_value_("0.0"),
@@ -127,7 +129,7 @@ class MockURLRequestThrottlerHeaderAdapter
int fake_response_code_;
};
-class MockURLRequestThrottlerManager : public net::URLRequestThrottlerManager {
+class MockURLRequestThrottlerManager : public URLRequestThrottlerManager {
public:
MockURLRequestThrottlerManager() : create_entry_index_(0) {}
@@ -300,9 +302,9 @@ TEST_F(URLRequestThrottlerEntryTest, MalformedContent) {
}
TEST_F(URLRequestThrottlerEntryTest, SlidingWindow) {
- int max_send = net::URLRequestThrottlerEntry::kDefaultMaxSendThreshold;
+ int max_send = URLRequestThrottlerEntry::kDefaultMaxSendThreshold;
int sliding_window =
- net::URLRequestThrottlerEntry::kDefaultSlidingWindowPeriodMs;
+ URLRequestThrottlerEntry::kDefaultSlidingWindowPeriodMs;
TimeTicks time_1 = entry_->fake_time_now_ +
TimeDelta::FromMilliseconds(sliding_window / 3);
@@ -389,3 +391,5 @@ TEST(URLRequestThrottlerManager, IsHostBeingRegistered) {
EXPECT_EQ(3, manager.GetNumberOfEntries());
}
+
+} // namespace net
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index d0b8f58..e3cf631 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -53,6 +53,8 @@
using base::Time;
+namespace net {
+
namespace {
const string16 kChrome(ASCIIToUTF16("chrome"));
@@ -89,14 +91,14 @@ void FillBuffer(char* buffer, size_t len) {
}
}
-scoped_refptr<net::UploadData> CreateSimpleUploadData(const char* data) {
- scoped_refptr<net::UploadData> upload(new net::UploadData);
+scoped_refptr<UploadData> CreateSimpleUploadData(const char* data) {
+ scoped_refptr<UploadData> upload(new UploadData);
upload->AppendBytes(data, strlen(data));
return upload;
}
// Verify that the SSLInfo of a successful SSL connection has valid values.
-void CheckSSLInfo(const net::SSLInfo& ssl_info) {
+void CheckSSLInfo(const SSLInfo& ssl_info) {
// Allow ChromeFrame fake SSLInfo to get through.
if (ssl_info.cert.get() &&
ssl_info.cert.get()->issuer().GetDisplayName() == "Chrome Internal") {
@@ -109,7 +111,7 @@ void CheckSSLInfo(const net::SSLInfo& ssl_info) {
EXPECT_GT(ssl_info.security_bits, 0);
// The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated.
- int cipher_suite = net::SSLConnectionStatusToCipherSuite(
+ int cipher_suite = SSLConnectionStatusToCipherSuite(
ssl_info.connection_status);
EXPECT_NE(0, cipher_suite);
}
@@ -120,14 +122,14 @@ void CheckSSLInfo(const net::SSLInfo& ssl_info) {
class URLRequestTest : public PlatformTest {
public:
static void SetUpTestCase() {
- net::URLRequest::AllowFileAccess();
+ URLRequest::AllowFileAccess();
}
};
class URLRequestTestHTTP : public URLRequestTest {
public:
URLRequestTestHTTP()
- : test_server_(net::TestServer::TYPE_HTTP,
+ : test_server_(TestServer::TYPE_HTTP,
FilePath(FILE_PATH_LITERAL(
"net/data/url_request_unittest"))) {
}
@@ -151,11 +153,11 @@ class URLRequestTestHTTP : public URLRequestTest {
}
uploadBytes[kMsgSize] = '\0';
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
for (int i = 0; i < kIterations; ++i) {
TestDelegate d;
- net::URLRequest r(test_server_.GetURL("echo"), &d);
+ URLRequest r(test_server_.GetURL("echo"), &d);
r.set_context(context);
r.set_method(method.c_str());
@@ -201,7 +203,7 @@ class URLRequestTestHTTP : public URLRequestTest {
strlen(expected_data)));
}
- net::TestServer test_server_;
+ TestServer test_server_;
};
// In this unit test, we're using the HTTPTestServer as a proxy server and
@@ -213,7 +215,7 @@ TEST_F(URLRequestTestHTTP, ProxyTunnelRedirectTest) {
TestDelegate d;
{
- net::URLRequest r(GURL("https://www.redirect.com/"), &d);
+ URLRequest r(GURL("https://www.redirect.com/"), &d);
r.set_context(
new TestURLRequestContext(test_server_.host_port_pair().ToString()));
@@ -222,8 +224,8 @@ TEST_F(URLRequestTestHTTP, ProxyTunnelRedirectTest) {
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::FAILED, r.status().status());
- EXPECT_EQ(net::ERR_TUNNEL_CONNECTION_FAILED, r.status().os_error());
+ EXPECT_EQ(URLRequestStatus::FAILED, r.status().status());
+ EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().os_error());
EXPECT_EQ(1, d.response_started_count());
// We should not have followed the redirect.
EXPECT_EQ(0, d.received_redirect_count());
@@ -237,7 +239,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) {
TestDelegate d;
{
- net::URLRequest r(GURL("https://www.redirect.com/"), &d);
+ URLRequest r(GURL("https://www.redirect.com/"), &d);
scoped_refptr<TestURLRequestContext> context(
new TestURLRequestContext(test_server_.host_port_pair().ToString()));
TestNetworkDelegate network_delegate;
@@ -249,14 +251,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) {
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::FAILED, r.status().status());
- EXPECT_EQ(net::ERR_TUNNEL_CONNECTION_FAILED, r.status().os_error());
+ EXPECT_EQ(URLRequestStatus::FAILED, r.status().status());
+ EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().os_error());
EXPECT_EQ(1, d.response_started_count());
// We should not have followed the redirect.
EXPECT_EQ(0, d.received_redirect_count());
EXPECT_EQ(1, network_delegate.error_count());
- EXPECT_EQ(net::ERR_TUNNEL_CONNECTION_FAILED,
+ EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED,
network_delegate.last_os_error());
}
}
@@ -269,7 +271,7 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) {
TestDelegate d;
{
- net::URLRequest r(GURL("https://www.server-auth.com/"), &d);
+ URLRequest r(GURL("https://www.server-auth.com/"), &d);
r.set_context(
new TestURLRequestContext(test_server_.host_port_pair().ToString()));
@@ -278,8 +280,8 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) {
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::FAILED, r.status().status());
- EXPECT_EQ(net::ERR_TUNNEL_CONNECTION_FAILED, r.status().os_error());
+ EXPECT_EQ(URLRequestStatus::FAILED, r.status().status());
+ EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().os_error());
}
}
@@ -332,8 +334,8 @@ TEST_F(URLRequestTestHTTP, GetTest) {
TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) {
ASSERT_TRUE(test_server_.Start());
- net::TestServer https_test_server(
- net::TestServer::TYPE_HTTPS, FilePath(FILE_PATH_LITERAL("net/data/ssl")));
+ TestServer https_test_server(
+ TestServer::TYPE_HTTPS, FilePath(FILE_PATH_LITERAL("net/data/ssl")));
ASSERT_TRUE(https_test_server.Start());
// An https server is sent a request with an https referer,
@@ -357,7 +359,7 @@ class HTTPSRequestTest : public testing::Test {
};
TEST_F(HTTPSRequestTest, HTTPSGetTest) {
- net::TestServer test_server(net::TestServer::TYPE_HTTPS,
+ TestServer test_server(TestServer::TYPE_HTTPS,
FilePath(FILE_PATH_LITERAL("net/data/ssl")));
ASSERT_TRUE(test_server.Start());
@@ -382,9 +384,9 @@ TEST_F(HTTPSRequestTest, HTTPSGetTest) {
}
TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) {
- net::TestServer::HTTPSOptions https_options(
- net::TestServer::HTTPSOptions::CERT_MISMATCHED_NAME);
- net::TestServer test_server(https_options,
+ TestServer::HTTPSOptions https_options(
+ TestServer::HTTPSOptions::CERT_MISMATCHED_NAME);
+ TestServer test_server(https_options,
FilePath(FILE_PATH_LITERAL("net/data/ssl")));
ASSERT_TRUE(test_server.Start());
@@ -414,9 +416,9 @@ TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) {
}
TEST_F(HTTPSRequestTest, HTTPSExpiredTest) {
- net::TestServer::HTTPSOptions https_options(
- net::TestServer::HTTPSOptions::CERT_EXPIRED);
- net::TestServer test_server(https_options,
+ TestServer::HTTPSOptions https_options(
+ TestServer::HTTPSOptions::CERT_EXPIRED);
+ TestServer test_server(https_options,
FilePath(FILE_PATH_LITERAL("net/data/ssl")));
ASSERT_TRUE(test_server.Start());
@@ -454,8 +456,8 @@ class SSLClientAuthTestDelegate : public TestDelegate {
SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) {
}
virtual void OnCertificateRequested(
- net::URLRequest* request,
- net::SSLCertRequestInfo* cert_request_info) {
+ URLRequest* request,
+ SSLCertRequestInfo* cert_request_info) {
on_certificate_requested_count_++;
MessageLoop::current()->Quit();
}
@@ -474,9 +476,9 @@ class SSLClientAuthTestDelegate : public TestDelegate {
// - Getting a certificate request in an SSL renegotiation sending the
// HTTP request.
TEST_F(HTTPSRequestTest, ClientAuthTest) {
- net::TestServer::HTTPSOptions https_options;
+ TestServer::HTTPSOptions https_options;
https_options.request_client_certificate = true;
- net::TestServer test_server(https_options,
+ TestServer test_server(https_options,
FilePath(FILE_PATH_LITERAL("net/data/ssl")));
ASSERT_TRUE(test_server.Start());
@@ -543,7 +545,7 @@ TEST_F(URLRequestTestHTTP, CancelTest2) {
EXPECT_EQ(1, d.response_started_count());
EXPECT_EQ(0, d.bytes_received());
EXPECT_FALSE(d.received_data_before_response());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, r.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, r.status().status());
}
}
@@ -567,7 +569,7 @@ TEST_F(URLRequestTestHTTP, CancelTest3) {
// or it could have been all the bytes.
// EXPECT_EQ(0, d.bytes_received());
EXPECT_FALSE(d.received_data_before_response());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, r.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, r.status().status());
}
}
@@ -599,28 +601,28 @@ TEST_F(URLRequestTestHTTP, CancelTest4) {
TEST_F(URLRequestTestHTTP, CancelTest5) {
ASSERT_TRUE(test_server_.Start());
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
// populate cache
{
TestDelegate d;
- net::URLRequest r(test_server_.GetURL("cachetime"), &d);
+ URLRequest r(test_server_.GetURL("cachetime"), &d);
r.set_context(context);
r.Start();
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status());
+ EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status());
}
// cancel read from cache (see bug 990242)
{
TestDelegate d;
- net::URLRequest r(test_server_.GetURL("cachetime"), &d);
+ URLRequest r(test_server_.GetURL("cachetime"), &d);
r.set_context(context);
r.Start();
r.Cancel();
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::CANCELED, r.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, r.status().status());
EXPECT_EQ(1, d.response_started_count());
EXPECT_EQ(0, d.bytes_received());
EXPECT_FALSE(d.received_data_before_response());
@@ -803,7 +805,7 @@ TEST_F(URLRequestTest, DataURLImageTest) {
TEST_F(URLRequestTest, FileTest) {
FilePath app_path;
PathService::Get(base::FILE_EXE, &app_path);
- GURL app_url = net::FilePathToFileURL(app_path);
+ GURL app_url = FilePathToFileURL(app_path);
TestDelegate d;
{
@@ -833,7 +835,7 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) {
FilePath temp_path;
EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path));
- GURL temp_url = net::FilePathToFileURL(temp_path);
+ GURL temp_url = FilePathToFileURL(temp_path);
EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size));
int64 file_size;
@@ -849,8 +851,8 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) {
{
TestURLRequest r(temp_url, &d);
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kRange,
+ HttpRequestHeaders headers;
+ headers.SetHeader(HttpRequestHeaders::kRange,
base::StringPrintf(
"bytes=%" PRIuS "-%" PRIuS,
first_byte_position, last_byte_position));
@@ -877,7 +879,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) {
FilePath temp_path;
EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path));
- GURL temp_url = net::FilePathToFileURL(temp_path);
+ GURL temp_url = FilePathToFileURL(temp_path);
EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size));
int64 file_size;
@@ -893,8 +895,8 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) {
{
TestURLRequest r(temp_url, &d);
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kRange,
+ HttpRequestHeaders headers;
+ headers.SetHeader(HttpRequestHeaders::kRange,
base::StringPrintf("bytes=%" PRIuS "-",
first_byte_position));
r.SetExtraRequestHeaders(headers);
@@ -920,7 +922,7 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) {
FilePath temp_path;
EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path));
- GURL temp_url = net::FilePathToFileURL(temp_path);
+ GURL temp_url = FilePathToFileURL(temp_path);
EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size));
int64 file_size;
@@ -930,8 +932,8 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) {
{
TestURLRequest r(temp_url, &d);
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kRange,
+ HttpRequestHeaders headers;
+ headers.SetHeader(HttpRequestHeaders::kRange,
"bytes=0-0,10-200,200-300");
r.SetExtraRequestHeaders(headers);
r.Start();
@@ -965,7 +967,7 @@ TEST_F(URLRequestTestHTTP, ResponseHeadersTest) {
req.Start();
MessageLoop::current()->Run();
- const net::HttpResponseHeaders* headers = req.response_headers();
+ const HttpResponseHeaders* headers = req.response_headers();
// Simple sanity check that response_info() accesses the same data.
EXPECT_EQ(headers, req.response_info().headers.get());
@@ -1022,7 +1024,7 @@ TEST_F(URLRequestTest, ResolveShortcutTest) {
TestDelegate d;
{
- TestURLRequest r(net::FilePathToFileURL(FilePath(lnk_path)), &d);
+ TestURLRequest r(FilePathToFileURL(FilePath(lnk_path)), &d);
r.Start();
EXPECT_TRUE(r.is_pending());
@@ -1076,7 +1078,7 @@ TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) {
TEST_F(URLRequestTest, FileDirCancelTest) {
// Put in mock resource provider.
- net::NetModule::SetResourceProvider(TestNetResourceProvider);
+ NetModule::SetResourceProvider(TestNetResourceProvider);
TestDelegate d;
{
@@ -1085,7 +1087,7 @@ TEST_F(URLRequestTest, FileDirCancelTest) {
file_path = file_path.Append(FILE_PATH_LITERAL("net"));
file_path = file_path.Append(FILE_PATH_LITERAL("data"));
- TestURLRequest req(net::FilePathToFileURL(file_path), &d);
+ TestURLRequest req(FilePathToFileURL(file_path), &d);
req.Start();
EXPECT_TRUE(req.is_pending());
@@ -1095,7 +1097,7 @@ TEST_F(URLRequestTest, FileDirCancelTest) {
}
// Take out mock resource provider.
- net::NetModule::SetResourceProvider(NULL);
+ NetModule::SetResourceProvider(NULL);
}
TEST_F(URLRequestTest, FileDirRedirectNoCrash) {
@@ -1110,7 +1112,7 @@ TEST_F(URLRequestTest, FileDirRedirectNoCrash) {
path = path.Append(FILE_PATH_LITERAL("url_request_unittest"));
TestDelegate d;
- TestURLRequest req(net::FilePathToFileURL(path), &d);
+ TestURLRequest req(FilePathToFileURL(path), &d);
req.Start();
MessageLoop::current()->Run();
@@ -1142,8 +1144,8 @@ TEST_F(URLRequestTestHTTP, RestrictRedirects) {
req.Start();
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::FAILED, req.status().status());
- EXPECT_EQ(net::ERR_UNSAFE_REDIRECT, req.status().os_error());
+ EXPECT_EQ(URLRequestStatus::FAILED, req.status().status());
+ EXPECT_EQ(ERR_UNSAFE_REDIRECT, req.status().os_error());
}
TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) {
@@ -1155,8 +1157,8 @@ TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) {
req.Start();
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::FAILED, req.status().status());
- EXPECT_EQ(net::ERR_INVALID_URL, req.status().os_error());
+ EXPECT_EQ(URLRequestStatus::FAILED, req.status().status());
+ EXPECT_EQ(ERR_INVALID_URL, req.status().os_error());
}
TEST_F(URLRequestTestHTTP, NoUserPassInReferrer) {
@@ -1186,7 +1188,7 @@ TEST_F(URLRequestTestHTTP, CancelRedirect) {
EXPECT_EQ(1, d.response_started_count());
EXPECT_EQ(0, d.bytes_received());
EXPECT_FALSE(d.received_data_before_response());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
}
}
@@ -1208,7 +1210,7 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect) {
EXPECT_EQ(1, d.response_started_count());
EXPECT_FALSE(d.received_data_before_response());
- EXPECT_EQ(net::URLRequestStatus::SUCCESS, req.status().status());
+ EXPECT_EQ(URLRequestStatus::SUCCESS, req.status().status());
FilePath path;
PathService::Get(base::DIR_SOURCE_ROOT, &path);
@@ -1242,21 +1244,21 @@ TEST_F(URLRequestTestHTTP, CancelDeferredRedirect) {
EXPECT_EQ(1, d.response_started_count());
EXPECT_EQ(0, d.bytes_received());
EXPECT_FALSE(d.received_data_before_response());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
}
}
TEST_F(URLRequestTestHTTP, VaryHeader) {
ASSERT_TRUE(test_server_.Start());
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
// populate the cache
{
TestDelegate d;
- net::URLRequest req(test_server_.GetURL("echoheader?foo"), &d);
+ URLRequest req(test_server_.GetURL("echoheader?foo"), &d);
req.set_context(context);
- net::HttpRequestHeaders headers;
+ HttpRequestHeaders headers;
headers.SetHeader("foo", "1");
req.SetExtraRequestHeaders(headers);
req.Start();
@@ -1266,9 +1268,9 @@ TEST_F(URLRequestTestHTTP, VaryHeader) {
// expect a cache hit
{
TestDelegate d;
- net::URLRequest req(test_server_.GetURL("echoheader?foo"), &d);
+ URLRequest req(test_server_.GetURL("echoheader?foo"), &d);
req.set_context(context);
- net::HttpRequestHeaders headers;
+ HttpRequestHeaders headers;
headers.SetHeader("foo", "1");
req.SetExtraRequestHeaders(headers);
req.Start();
@@ -1280,9 +1282,9 @@ TEST_F(URLRequestTestHTTP, VaryHeader) {
// expect a cache miss
{
TestDelegate d;
- net::URLRequest req(test_server_.GetURL("echoheader?foo"), &d);
+ URLRequest req(test_server_.GetURL("echoheader?foo"), &d);
req.set_context(context);
- net::HttpRequestHeaders headers;
+ HttpRequestHeaders headers;
headers.SetHeader("foo", "2");
req.SetExtraRequestHeaders(headers);
req.Start();
@@ -1295,7 +1297,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) {
TEST_F(URLRequestTestHTTP, BasicAuth) {
ASSERT_TRUE(test_server_.Start());
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
// populate the cache
{
@@ -1303,7 +1305,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) {
d.set_username(kUser);
d.set_password(kSecret);
- net::URLRequest r(test_server_.GetURL("auth-basic"), &d);
+ URLRequest r(test_server_.GetURL("auth-basic"), &d);
r.set_context(context);
r.Start();
@@ -1320,9 +1322,9 @@ TEST_F(URLRequestTestHTTP, BasicAuth) {
d.set_username(kUser);
d.set_password(kSecret);
- net::URLRequest r(test_server_.GetURL("auth-basic"), &d);
+ URLRequest r(test_server_.GetURL("auth-basic"), &d);
r.set_context(context);
- r.set_load_flags(net::LOAD_VALIDATE_CACHE);
+ r.set_load_flags(LOAD_VALIDATE_CACHE);
r.Start();
MessageLoop::current()->Run();
@@ -1345,12 +1347,12 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) {
// Request a page that will give a 401 containing a Set-Cookie header.
// Verify that when the transaction is restarted, it includes the new cookie.
{
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
TestDelegate d;
d.set_username(kUser);
d.set_password(kSecret);
- net::URLRequest r(url_requiring_auth, &d);
+ URLRequest r(url_requiring_auth, &d);
r.set_context(context);
r.Start();
@@ -1366,7 +1368,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) {
// Same test as above, except this time the restart is initiated earlier
// (without user intervention since identity is embedded in the URL).
{
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
TestDelegate d;
GURL::Replacements replacements;
@@ -1376,7 +1378,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) {
replacements.SetPasswordStr(password);
GURL url_with_identity = url_requiring_auth.ReplaceComponents(replacements);
- net::URLRequest r(url_with_identity, &d);
+ URLRequest r(url_with_identity, &d);
r.set_context(context);
r.Start();
@@ -1391,15 +1393,15 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) {
}
TEST_F(URLRequestTest, DoNotSendCookies) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d);
+ URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d);
req.set_context(context);
req.Start();
MessageLoop::current()->Run();
@@ -1425,7 +1427,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) {
{
TestDelegate d;
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d);
- req.set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES);
+ req.set_load_flags(LOAD_DO_NOT_SEND_COOKIES);
req.set_context(context);
req.Start();
MessageLoop::current()->Run();
@@ -1440,15 +1442,15 @@ TEST_F(URLRequestTest, DoNotSendCookies) {
}
TEST_F(URLRequestTest, DoNotSaveCookies) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
- scoped_refptr<net::URLRequestContext> context(new TestURLRequestContext());
+ scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"),
+ URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"),
&d);
req.set_context(context);
req.Start();
@@ -1462,9 +1464,9 @@ TEST_F(URLRequestTest, DoNotSaveCookies) {
// Try to set-up another cookie and update the previous cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL(
+ URLRequest req(test_server.GetURL(
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d);
- req.set_load_flags(net::LOAD_DO_NOT_SAVE_COOKIES);
+ req.set_load_flags(LOAD_DO_NOT_SAVE_COOKIES);
req.set_context(context);
req.Start();
@@ -1496,7 +1498,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) {
}
TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1504,7 +1506,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) {
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d);
+ URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d);
req.set_context(context);
req.Start();
MessageLoop::current()->Run();
@@ -1550,7 +1552,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) {
}
TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1558,7 +1560,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) {
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"),
+ URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"),
&d);
req.set_context(context);
req.Start();
@@ -1574,7 +1576,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) {
context->set_cookie_policy(&cookie_policy);
TestDelegate d;
- net::URLRequest req(test_server.GetURL(
+ URLRequest req(test_server.GetURL(
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d);
req.set_context(context);
req.Start();
@@ -1607,7 +1609,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) {
}
TEST_F(URLRequestTest, DoNotSaveEmptyCookies) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1615,7 +1617,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) {
// Set up an empty cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie"), &d);
+ URLRequest req(test_server.GetURL("set-cookie"), &d);
req.set_context(context);
req.Start();
MessageLoop::current()->Run();
@@ -1627,7 +1629,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) {
}
TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1635,7 +1637,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) {
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d);
+ URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d);
req.set_context(context);
req.Start();
MessageLoop::current()->Run();
@@ -1682,7 +1684,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) {
}
TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1690,7 +1692,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) {
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"),
+ URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"),
&d);
req.set_context(context);
req.Start();
@@ -1707,7 +1709,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) {
context->set_cookie_policy(&cookie_policy);
TestDelegate d;
- net::URLRequest req(test_server.GetURL(
+ URLRequest req(test_server.GetURL(
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d);
req.set_context(context);
req.Start();
@@ -1739,7 +1741,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) {
}
TEST_F(URLRequestTest, CancelTest_During_CookiePolicy) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1750,7 +1752,7 @@ TEST_F(URLRequestTest, CancelTest_During_CookiePolicy) {
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
+ URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
&d);
req.set_context(context);
req.Start(); // Triggers an asynchronous cookie policy check.
@@ -1765,12 +1767,12 @@ TEST_F(URLRequestTest, CancelTest_During_CookiePolicy) {
context->set_cookie_policy(NULL);
// Let the cookie policy complete. Make sure it handles the destruction of
- // the net::URLRequest properly.
+ // the URLRequest properly.
MessageLoop::current()->RunAllPending();
}
TEST_F(URLRequestTest, CancelTest_During_OnGetCookies) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1782,14 +1784,14 @@ TEST_F(URLRequestTest, CancelTest_During_OnGetCookies) {
{
TestDelegate d;
d.set_cancel_in_get_cookies_blocked(true);
- net::URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
+ URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
&d);
req.set_context(context);
req.Start(); // Triggers an asynchronous cookie policy check.
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
EXPECT_EQ(1, d.blocked_get_cookies_count());
EXPECT_EQ(0, d.blocked_set_cookie_count());
@@ -1799,7 +1801,7 @@ TEST_F(URLRequestTest, CancelTest_During_OnGetCookies) {
}
TEST_F(URLRequestTest, CancelTest_During_OnSetCookie) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1811,14 +1813,14 @@ TEST_F(URLRequestTest, CancelTest_During_OnSetCookie) {
{
TestDelegate d;
d.set_cancel_in_set_cookie_blocked(true);
- net::URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
+ URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"),
&d);
req.set_context(context);
req.Start(); // Triggers an asynchronous cookie policy check.
MessageLoop::current()->Run();
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
// Even though the response will contain 3 set-cookie headers, we expect
// only one to be blocked as that first one will cause OnSetCookie to be
@@ -1833,7 +1835,7 @@ TEST_F(URLRequestTest, CancelTest_During_OnSetCookie) {
}
TEST_F(URLRequestTest, CookiePolicy_ForceSession) {
- net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath());
+ TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
@@ -1844,7 +1846,7 @@ TEST_F(URLRequestTest, CookiePolicy_ForceSession) {
// Set up a cookie.
{
TestDelegate d;
- net::URLRequest req(test_server.GetURL(
+ URLRequest req(test_server.GetURL(
"set-cookie?A=1;expires=\"Fri, 05 Feb 2010 23:42:01 GMT\""), &d);
req.set_context(context);
req.Start(); // Triggers an asynchronous cookie policy check.
@@ -1856,7 +1858,7 @@ TEST_F(URLRequestTest, CookiePolicy_ForceSession) {
}
// Now, check the cookie store.
- net::CookieList cookies =
+ CookieList cookies =
context->cookie_store()->GetCookieMonster()->GetAllCookies();
EXPECT_EQ(1U, cookies.size());
EXPECT_FALSE(cookies[0].IsPersistent());
@@ -1879,7 +1881,7 @@ TEST_F(URLRequestTestHTTP, Post302RedirectGet) {
req.set_upload(CreateSimpleUploadData(kData));
// Set headers (some of which are specific to the POST).
- net::HttpRequestHeaders headers;
+ HttpRequestHeaders headers;
headers.AddHeadersFromString(
"Content-Type: multipart/form-data; "
"boundary=----WebKitFormBoundaryAADeAA+NAAWMAAwZ\r\n"
@@ -1920,8 +1922,8 @@ TEST_F(URLRequestTestHTTP, Post307RedirectPost) {
&d);
req.set_method("POST");
req.set_upload(CreateSimpleUploadData(kData).get());
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kContentLength,
+ HttpRequestHeaders headers;
+ headers.SetHeader(HttpRequestHeaders::kContentLength,
base::UintToString(arraysize(kData) - 1));
req.SetExtraRequestHeaders(headers);
req.Start();
@@ -1931,10 +1933,10 @@ TEST_F(URLRequestTestHTTP, Post307RedirectPost) {
}
// Custom URLRequestJobs for use with interceptor tests
-class RestartTestJob : public net::URLRequestTestJob {
+class RestartTestJob : public URLRequestTestJob {
public:
- explicit RestartTestJob(net::URLRequest* request)
- : net::URLRequestTestJob(request, true) {}
+ explicit RestartTestJob(URLRequest* request)
+ : URLRequestTestJob(request, true) {}
protected:
virtual void StartAsync() {
this->NotifyRestartRequired();
@@ -1943,10 +1945,10 @@ class RestartTestJob : public net::URLRequestTestJob {
~RestartTestJob() {}
};
-class CancelTestJob : public net::URLRequestTestJob {
+class CancelTestJob : public URLRequestTestJob {
public:
- explicit CancelTestJob(net::URLRequest* request)
- : net::URLRequestTestJob(request, true) {}
+ explicit CancelTestJob(URLRequest* request)
+ : URLRequestTestJob(request, true) {}
protected:
virtual void StartAsync() {
request_->Cancel();
@@ -1955,10 +1957,10 @@ class CancelTestJob : public net::URLRequestTestJob {
~CancelTestJob() {}
};
-class CancelThenRestartTestJob : public net::URLRequestTestJob {
+class CancelThenRestartTestJob : public URLRequestTestJob {
public:
- explicit CancelThenRestartTestJob(net::URLRequest* request)
- : net::URLRequestTestJob(request, true) {
+ explicit CancelThenRestartTestJob(URLRequest* request)
+ : URLRequestTestJob(request, true) {
}
protected:
virtual void StartAsync() {
@@ -1970,7 +1972,7 @@ class CancelThenRestartTestJob : public net::URLRequestTestJob {
};
// An Interceptor for use with interceptor tests
-class TestInterceptor : net::URLRequest::Interceptor {
+class TestInterceptor : URLRequest::Interceptor {
public:
TestInterceptor()
: intercept_main_request_(false), restart_main_request_(false),
@@ -1983,14 +1985,14 @@ class TestInterceptor : net::URLRequest::Interceptor {
did_simulate_error_main_(false),
did_intercept_redirect_(false), did_cancel_redirect_(false),
did_intercept_final_(false), did_cancel_final_(false) {
- net::URLRequest::RegisterRequestInterceptor(this);
+ URLRequest::RegisterRequestInterceptor(this);
}
~TestInterceptor() {
- net::URLRequest::UnregisterRequestInterceptor(this);
+ URLRequest::UnregisterRequestInterceptor(this);
}
- virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) {
+ virtual URLRequestJob* MaybeIntercept(URLRequest* request) {
if (restart_main_request_) {
restart_main_request_ = false;
did_restart_main_ = true;
@@ -2010,19 +2012,19 @@ class TestInterceptor : net::URLRequest::Interceptor {
simulate_main_network_error_ = false;
did_simulate_error_main_ = true;
// will error since the requeted url is not one of its canned urls
- return new net::URLRequestTestJob(request, true);
+ return new URLRequestTestJob(request, true);
}
if (!intercept_main_request_)
return NULL;
intercept_main_request_ = false;
did_intercept_main_ = true;
- return new net::URLRequestTestJob(request,
+ return new URLRequestTestJob(request,
main_headers_,
main_data_,
true);
}
- virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
+ virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request,
const GURL& location) {
if (cancel_redirect_request_) {
cancel_redirect_request_ = false;
@@ -2033,13 +2035,13 @@ class TestInterceptor : net::URLRequest::Interceptor {
return NULL;
intercept_redirect_ = false;
did_intercept_redirect_ = true;
- return new net::URLRequestTestJob(request,
+ return new URLRequestTestJob(request,
redirect_headers_,
redirect_data_,
true);
}
- virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request) {
+ virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request) {
if (cancel_final_request_) {
cancel_final_request_ = false;
did_cancel_final_ = true;
@@ -2049,7 +2051,7 @@ class TestInterceptor : net::URLRequest::Interceptor {
return NULL;
intercept_final_response_ = false;
did_intercept_final_ = true;
- return new net::URLRequestTestJob(request,
+ return new URLRequestTestJob(request,
final_headers_,
final_data_,
true);
@@ -2096,11 +2098,11 @@ class TestInterceptor : net::URLRequest::Interceptor {
// Static getters for canned response header and data strings
static std::string ok_data() {
- return net::URLRequestTestJob::test_data_1();
+ return URLRequestTestJob::test_data_1();
}
static std::string ok_headers() {
- return net::URLRequestTestJob::test_headers();
+ return URLRequestTestJob::test_headers();
}
static std::string redirect_data() {
@@ -2108,7 +2110,7 @@ class TestInterceptor : net::URLRequest::Interceptor {
}
static std::string redirect_headers() {
- return net::URLRequestTestJob::test_redirect_headers();
+ return URLRequestTestJob::test_redirect_headers();
}
static std::string error_data() {
@@ -2116,7 +2118,7 @@ class TestInterceptor : net::URLRequest::Interceptor {
}
static std::string error_headers() {
- return net::URLRequestTestJob::test_error_headers();
+ return URLRequestTestJob::test_error_headers();
}
};
@@ -2130,9 +2132,9 @@ TEST_F(URLRequestTest, Intercept) {
TestDelegate d;
TestURLRequest req(GURL("http://test_intercept/foo"), &d);
- net::URLRequest::UserData* user_data0 = new net::URLRequest::UserData();
- net::URLRequest::UserData* user_data1 = new net::URLRequest::UserData();
- net::URLRequest::UserData* user_data2 = new net::URLRequest::UserData();
+ URLRequest::UserData* user_data0 = new URLRequest::UserData();
+ URLRequest::UserData* user_data1 = new URLRequest::UserData();
+ URLRequest::UserData* user_data2 = new URLRequest::UserData();
req.SetUserData(NULL, user_data0);
req.SetUserData(&user_data1, user_data1);
req.SetUserData(&user_data2, user_data2);
@@ -2303,7 +2305,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelMain) {
// Check we see a canceled request
EXPECT_FALSE(req.status().is_success());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
}
TEST_F(URLRequestTest, InterceptRespectsCancelRedirect) {
@@ -2335,7 +2337,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelRedirect) {
// Check we see a canceled request
EXPECT_FALSE(req.status().is_success());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
}
TEST_F(URLRequestTest, InterceptRespectsCancelFinal) {
@@ -2359,7 +2361,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelFinal) {
// Check we see a canceled request
EXPECT_FALSE(req.status().is_success());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
}
TEST_F(URLRequestTest, InterceptRespectsCancelInRestart) {
@@ -2385,7 +2387,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelInRestart) {
// Check we see a canceled request
EXPECT_FALSE(req.status().is_success());
- EXPECT_EQ(net::URLRequestStatus::CANCELED, req.status().status());
+ EXPECT_EQ(URLRequestStatus::CANCELED, req.status().status());
}
// Check that two different URL requests have different identifiers.
@@ -2404,8 +2406,8 @@ TEST_F(URLRequestTest, NetworkDelegateProxyError) {
TestURLRequest req(GURL("http://example.com"), &d);
req.set_method("GET");
- scoped_ptr<net::MockHostResolverBase> host_resolver(
- new net::MockHostResolver);
+ scoped_ptr<MockHostResolverBase> host_resolver(
+ new MockHostResolver);
host_resolver->rules()->AddSimulatedFailure("*");
TestNetworkDelegate network_delegate;
scoped_refptr<TestURLRequestContext> context(
@@ -2418,20 +2420,20 @@ TEST_F(URLRequestTest, NetworkDelegateProxyError) {
// Check we see a failed request.
EXPECT_FALSE(req.status().is_success());
- EXPECT_EQ(net::URLRequestStatus::FAILED, req.status().status());
- EXPECT_EQ(net::ERR_PROXY_CONNECTION_FAILED, req.status().os_error());
+ EXPECT_EQ(URLRequestStatus::FAILED, req.status().status());
+ EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, req.status().os_error());
EXPECT_EQ(1, network_delegate.error_count());
- EXPECT_EQ(net::ERR_PROXY_CONNECTION_FAILED, network_delegate.last_os_error());
+ EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, network_delegate.last_os_error());
}
class URLRequestTestFTP : public URLRequestTest {
public:
- URLRequestTestFTP() : test_server_(net::TestServer::TYPE_FTP, FilePath()) {
+ URLRequestTestFTP() : test_server_(TestServer::TYPE_FTP, FilePath()) {
}
protected:
- net::TestServer test_server_;
+ TestServer test_server_;
};
// Flaky, see http://crbug.com/25045.
@@ -2766,8 +2768,8 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptLanguage) {
TestURLRequest
req(test_server_.GetURL("echoheaderoverride?Accept-Language"), &d);
req.set_context(new TestURLRequestContext());
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kAcceptLanguage, "ru");
+ HttpRequestHeaders headers;
+ headers.SetHeader(HttpRequestHeaders::kAcceptLanguage, "ru");
req.SetExtraRequestHeaders(headers);
req.Start();
MessageLoop::current()->Run();
@@ -2795,8 +2797,8 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptCharset) {
TestURLRequest
req(test_server_.GetURL("echoheaderoverride?Accept-Charset"), &d);
req.set_context(new TestURLRequestContext());
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kAcceptCharset, "koi-8r");
+ HttpRequestHeaders headers;
+ headers.SetHeader(HttpRequestHeaders::kAcceptCharset, "koi-8r");
req.SetExtraRequestHeaders(headers);
req.Start();
MessageLoop::current()->Run();
@@ -2824,8 +2826,8 @@ TEST_F(URLRequestTestHTTP, OverrideUserAgent) {
TestURLRequest
req(test_server_.GetURL("echoheaderoverride?User-Agent"), &d);
req.set_context(new TestURLRequestContext());
- net::HttpRequestHeaders headers;
- headers.SetHeader(net::HttpRequestHeaders::kUserAgent, "Lynx (textmode)");
+ HttpRequestHeaders headers;
+ headers.SetHeader(HttpRequestHeaders::kUserAgent, "Lynx (textmode)");
req.SetExtraRequestHeaders(headers);
req.Start();
MessageLoop::current()->Run();
@@ -2834,3 +2836,5 @@ TEST_F(URLRequestTestHTTP, OverrideUserAgent) {
// closing parentheses.
EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true));
}
+
+} // namespace net
diff --git a/net/url_request/view_cache_helper.cc b/net/url_request/view_cache_helper.cc
index 531b055..8a3eaed 100644
--- a/net/url_request/view_cache_helper.cc
+++ b/net/url_request/view_cache_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,6 +20,8 @@
#define VIEW_CACHE_TAIL \
"</table></body></html>"
+namespace net {
+
namespace {
void HexDump(const char *buf, size_t buf_len, std::string* result) {
@@ -71,8 +73,6 @@ std::string FormatEntryInfo(disk_cache::Entry* entry,
} // namespace.
-namespace net {
-
ViewCacheHelper::ViewCacheHelper()
: disk_cache_(NULL),
entry_(NULL),
@@ -213,7 +213,7 @@ int ViewCacheHelper::DoGetBackend() {
if (!context_->http_transaction_factory())
return ERR_FAILED;
- net::HttpCache* http_cache = context_->http_transaction_factory()->GetCache();
+ HttpCache* http_cache = context_->http_transaction_factory()->GetCache();
if (!http_cache)
return ERR_FAILED;
@@ -282,16 +282,16 @@ int ViewCacheHelper::DoReadResponse() {
if (!buf_len_)
return buf_len_;
- buf_ = new net::IOBuffer(buf_len_);
+ buf_ = new IOBuffer(buf_len_);
return entry_->ReadData(0, 0, buf_, buf_len_, entry_callback_);
}
int ViewCacheHelper::DoReadResponseComplete(int result) {
entry_callback_->Release();
if (result && result == buf_len_) {
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
bool truncated;
- if (net::HttpCache::ParseResponseInfo(buf_->data(), buf_len_, &response,
+ if (HttpCache::ParseResponseInfo(buf_->data(), buf_len_, &response,
&truncated) &&
response.headers) {
if (truncated)
@@ -327,7 +327,7 @@ int ViewCacheHelper::DoReadData() {
if (!buf_len_)
return buf_len_;
- buf_ = new net::IOBuffer(buf_len_);
+ buf_ = new IOBuffer(buf_len_);
return entry_->ReadData(index_, 0, buf_, buf_len_, entry_callback_);
}
@@ -338,7 +338,7 @@ int ViewCacheHelper::DoReadDataComplete(int result) {
}
data_->append("</pre>");
index_++;
- if (index_ < net::HttpCache::kNumCacheEntryDataIndices) {
+ if (index_ < HttpCache::kNumCacheEntryDataIndices) {
next_state_ = STATE_READ_DATA;
} else {
data_->append(VIEW_CACHE_TAIL);
diff --git a/net/url_request/view_cache_helper.h b/net/url_request/view_cache_helper.h
index 1952916..4297a00 100644
--- a/net/url_request/view_cache_helper.h
+++ b/net/url_request/view_cache_helper.h
@@ -30,7 +30,7 @@ class ViewCacheHelper {
// operation completes. |out| must remain valid until this operation completes
// or the object is destroyed.
int GetEntryInfoHTML(const std::string& key,
- net::URLRequestContext* context,
+ URLRequestContext* context,
std::string* out,
CompletionCallback* callback);
@@ -39,7 +39,7 @@ class ViewCacheHelper {
// operation completes. |out| must remain valid until this operation completes
// or the object is destroyed. |url_prefix| will be prepended to each entry
// key as a link to the entry.
- int GetContentsHTML(net::URLRequestContext* context,
+ int GetContentsHTML(URLRequestContext* context,
const std::string& url_prefix,
std::string* out,
CompletionCallback* callback);
@@ -61,7 +61,7 @@ class ViewCacheHelper {
// Implements GetEntryInfoHTML and GetContentsHTML.
int GetInfoHTML(const std::string& key,
- net::URLRequestContext* context,
+ URLRequestContext* context,
const std::string& url_prefix,
std::string* out,
CompletionCallback* callback);
@@ -93,11 +93,11 @@ class ViewCacheHelper {
// Called to signal completion of asynchronous IO.
void OnIOComplete(int result);
- scoped_refptr<net::URLRequestContext> context_;
+ scoped_refptr<URLRequestContext> context_;
disk_cache::Backend* disk_cache_;
disk_cache::Entry* entry_;
void* iter_;
- scoped_refptr<net::IOBuffer> buf_;
+ scoped_refptr<IOBuffer> buf_;
int buf_len_;
int index_;
diff --git a/net/url_request/view_cache_helper_unittest.cc b/net/url_request/view_cache_helper_unittest.cc
index e9e497b..be9b30d 100644
--- a/net/url_request/view_cache_helper_unittest.cc
+++ b/net/url_request/view_cache_helper_unittest.cc
@@ -12,9 +12,11 @@
#include "net/url_request/url_request_context.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
-class TestURLRequestContext : public net::URLRequestContext {
+class TestURLRequestContext : public URLRequestContext {
public:
TestURLRequestContext();
@@ -22,12 +24,12 @@ class TestURLRequestContext : public net::URLRequestContext {
disk_cache::Backend* GetBackend();
private:
- net::HttpCache cache_;
+ HttpCache cache_;
};
TestURLRequestContext::TestURLRequestContext()
- : cache_(reinterpret_cast<net::HttpTransactionFactory*>(NULL), NULL,
- net::HttpCache::DefaultBackend::InMemory(0)) {
+ : cache_(reinterpret_cast<HttpTransactionFactory*>(NULL), NULL,
+ HttpCache::DefaultBackend::InMemory(0)) {
set_http_transaction_factory(&cache_);
}
@@ -41,7 +43,7 @@ void WriteHeaders(disk_cache::Entry* entry, int flags, const std::string data) {
pickle.WriteInt64(0);
pickle.WriteString(data);
- scoped_refptr<net::WrappedIOBuffer> buf(new net::WrappedIOBuffer(
+ scoped_refptr<WrappedIOBuffer> buf(new WrappedIOBuffer(
reinterpret_cast<const char*>(pickle.data())));
int len = static_cast<int>(pickle.size());
@@ -55,7 +57,7 @@ void WriteData(disk_cache::Entry* entry, int index, const std::string data) {
return;
int len = data.length();
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(len));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(len));
memcpy(buf->data(), data.data(), data.length());
TestCompletionCallback cb;
@@ -70,9 +72,9 @@ void WriteToEntry(disk_cache::Backend* cache, const std::string key,
disk_cache::Entry* entry;
int rv = cache->CreateEntry(key, &entry, &cb);
rv = cb.GetResult(rv);
- if (rv != net::OK) {
+ if (rv != OK) {
rv = cache->OpenEntry(key, &entry, &cb);
- ASSERT_EQ(net::OK, cb.GetResult(rv));
+ ASSERT_EQ(OK, cb.GetResult(rv));
}
WriteHeaders(entry, 0, data0);
@@ -82,12 +84,12 @@ void WriteToEntry(disk_cache::Backend* cache, const std::string key,
entry->Close();
}
-void FillCache(net::URLRequestContext* context) {
+void FillCache(URLRequestContext* context) {
TestCompletionCallback cb;
disk_cache::Backend* cache;
int rv =
context->http_transaction_factory()->GetCache()->GetBackend(&cache, &cb);
- ASSERT_EQ(net::OK, cb.GetResult(rv));
+ ASSERT_EQ(OK, cb.GetResult(rv));
std::string empty;
WriteToEntry(cache, "first", "some", empty, empty);
@@ -99,25 +101,25 @@ void FillCache(net::URLRequestContext* context) {
TEST(ViewCacheHelper, EmptyCache) {
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
- net::ViewCacheHelper helper;
+ ViewCacheHelper helper;
TestCompletionCallback cb;
std::string prefix, data;
int rv = helper.GetContentsHTML(context, prefix, &data, &cb);
- EXPECT_EQ(net::OK, cb.GetResult(rv));
+ EXPECT_EQ(OK, cb.GetResult(rv));
EXPECT_FALSE(data.empty());
}
TEST(ViewCacheHelper, ListContents) {
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
- net::ViewCacheHelper helper;
+ ViewCacheHelper helper;
FillCache(context);
std::string prefix, data;
TestCompletionCallback cb;
int rv = helper.GetContentsHTML(context, prefix, &data, &cb);
- EXPECT_EQ(net::OK, cb.GetResult(rv));
+ EXPECT_EQ(OK, cb.GetResult(rv));
EXPECT_EQ(0U, data.find("<html>"));
EXPECT_NE(std::string::npos, data.find("</html>"));
@@ -132,14 +134,14 @@ TEST(ViewCacheHelper, ListContents) {
TEST(ViewCacheHelper, DumpEntry) {
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
- net::ViewCacheHelper helper;
+ ViewCacheHelper helper;
FillCache(context);
std::string data;
TestCompletionCallback cb;
int rv = helper.GetEntryInfoHTML("second", context, &data, &cb);
- EXPECT_EQ(net::OK, cb.GetResult(rv));
+ EXPECT_EQ(OK, cb.GetResult(rv));
EXPECT_EQ(0U, data.find("<html>"));
EXPECT_NE(std::string::npos, data.find("</html>"));
@@ -157,7 +159,7 @@ TEST(ViewCacheHelper, DumpEntry) {
// Makes sure the links are correct.
TEST(ViewCacheHelper, Prefix) {
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
- net::ViewCacheHelper helper;
+ ViewCacheHelper helper;
FillCache(context);
@@ -165,7 +167,7 @@ TEST(ViewCacheHelper, Prefix) {
std::string prefix("prefix:");
TestCompletionCallback cb;
int rv = helper.GetContentsHTML(context, prefix, &data, &cb);
- EXPECT_EQ(net::OK, cb.GetResult(rv));
+ EXPECT_EQ(OK, cb.GetResult(rv));
EXPECT_EQ(0U, data.find("<html>"));
EXPECT_NE(std::string::npos, data.find("</html>"));
@@ -176,18 +178,18 @@ TEST(ViewCacheHelper, Prefix) {
TEST(ViewCacheHelper, TruncatedFlag) {
scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext());
- net::ViewCacheHelper helper;
+ ViewCacheHelper helper;
TestCompletionCallback cb;
disk_cache::Backend* cache;
int rv =
context->http_transaction_factory()->GetCache()->GetBackend(&cache, &cb);
- ASSERT_EQ(net::OK, cb.GetResult(rv));
+ ASSERT_EQ(OK, cb.GetResult(rv));
std::string key("the key");
disk_cache::Entry* entry;
rv = cache->CreateEntry(key, &entry, &cb);
- ASSERT_EQ(net::OK, cb.GetResult(rv));
+ ASSERT_EQ(OK, cb.GetResult(rv));
// RESPONSE_INFO_TRUNCATED defined on response_info.cc
int flags = 1 << 12;
@@ -196,7 +198,9 @@ TEST(ViewCacheHelper, TruncatedFlag) {
std::string data;
rv = helper.GetEntryInfoHTML(key, context, &data, &cb);
- EXPECT_EQ(net::OK, cb.GetResult(rv));
+ EXPECT_EQ(OK, cb.GetResult(rv));
EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED"));
}
+
+} // namespace net