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

Unified Diff: content/common/net/url_fetcher_impl_unittest.cc

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/net/url_fetcher_impl_unittest.cc
diff --git a/content/common/net/url_fetcher_impl_unittest.cc b/content/common/net/url_fetcher_impl_unittest.cc
index 909bb6f0247c24a93797f79b0b55c9c8feb1e940..acd275310a0ce3f64d2840780c3542eb0b91216e 100644
--- a/content/common/net/url_fetcher_impl_unittest.cc
+++ b/content/common/net/url_fetcher_impl_unittest.cc
@@ -9,6 +9,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
+#include "content/public/common/content_url_request_user_data.h"
#include "content/public/common/url_fetcher_delegate.h"
#include "crypto/nss_util.h"
#include "net/http/http_response_headers.h"
@@ -109,6 +110,8 @@ void URLFetcherTest::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
io_message_loop_proxy()));
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
fetcher_->Start();
}
@@ -299,6 +302,8 @@ void URLFetcherTempFileTest::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
io_message_loop_proxy()));
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
// Use the IO message loop to do the file operations in this test.
fetcher_->SaveResponseToTemporaryFile(io_message_loop_proxy());
@@ -362,6 +367,8 @@ void URLFetcherPostTest::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, content::URLFetcher::POST, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
io_message_loop_proxy()));
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
fetcher_->SetUploadData("application/x-www-form-urlencoded",
"bobsyeruncle");
fetcher_->Start();
@@ -378,6 +385,8 @@ void URLFetcherDownloadProgressTest::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
io_message_loop_proxy()));
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
previous_progress_ = 0;
fetcher_->Start();
}
@@ -396,6 +405,8 @@ void URLFetcherDownloadProgressCancelTest::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
io_message_loop_proxy()));
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
cancelled_ = false;
fetcher_->Start();
}
@@ -438,6 +449,8 @@ void URLFetcherProtectTest::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
io_message_loop_proxy()));
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
start_time_ = Time::Now();
fetcher_->SetMaxRetries(11);
fetcher_->Start();
@@ -461,8 +474,9 @@ void URLFetcherProtectTest::OnURLFetchComplete(
static int count = 0;
count++;
if (count < 20) {
- fetcher_->StartWithRequestContextGetter(new TestURLRequestContextGetter(
- io_message_loop_proxy()));
+ fetcher_->StartWithRequestContextGetterAndUserData(
+ new TestURLRequestContextGetter(io_message_loop_proxy()),
+ new content::ContentURLRequestUserData());
} else {
// We have already sent 20 requests continuously. And we expect that
// it takes more than 1 second due to the overload protection settings.
@@ -476,6 +490,8 @@ void URLFetcherProtectTestPassedThrough::CreateFetcher(const GURL& url) {
fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
fetcher_->SetRequestContext(new TestURLRequestContextGetter(
io_message_loop_proxy()));
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
fetcher_->SetAutomaticallyRetryOn5xx(false);
start_time_ = Time::Now();
fetcher_->SetMaxRetries(11);
@@ -540,6 +556,8 @@ void URLFetcherCancelTest::CreateFetcher(const GURL& url) {
CancelTestURLRequestContextGetter* context_getter =
new CancelTestURLRequestContextGetter(io_message_loop_proxy());
fetcher_->SetRequestContext(context_getter);
+ fetcher_->SetContentURLRequestUserData(
+ new content::ContentURLRequestUserData());
fetcher_->SetMaxRetries(2);
fetcher_->Start();
// We need to wait for the creation of the net::URLRequestContext, since we
@@ -572,8 +590,9 @@ void URLFetcherMultipleAttemptTest::OnURLFetchComplete(
EXPECT_FALSE(data.empty());
if (!data.empty() && data_.empty()) {
data_ = data;
- fetcher_->StartWithRequestContextGetter(
- new TestURLRequestContextGetter(io_message_loop_proxy()));
+ fetcher_->StartWithRequestContextGetterAndUserData(
+ new TestURLRequestContextGetter(io_message_loop_proxy()),
+ new content::ContentURLRequestUserData());
} else {
EXPECT_EQ(data, data_);
delete fetcher_; // Have to delete this here and not in the destructor,

Powered by Google App Engine
This is Rietveld 408576698