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

Unified Diff: net/url_request/url_request_test_job.cc

Issue 25772002: Allows prefetch requests to live beyond the renderer by delaying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 7 years, 2 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
« no previous file with comments | « net/url_request/url_request_test_job.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_test_job.cc
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index e0a32b38db6d6d17f30397597788aaffa9b19150..31a07feaa882b7e518d622fe974557532ff60ca7 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -36,9 +36,15 @@ GURL URLRequestTestJob::test_url_2() {
GURL URLRequestTestJob::test_url_3() {
return GURL("test:url3");
}
+GURL URLRequestTestJob::test_url_4() {
+ return GURL("test:url4");
+}
GURL URLRequestTestJob::test_url_error() {
return GURL("test:error");
}
+GURL URLRequestTestJob::test_url_redirect_to_url_2() {
+ return GURL("test:redirect_to_2");
+}
// static getters for known URL responses
std::string URLRequestTestJob::test_data_1() {
@@ -50,6 +56,9 @@ std::string URLRequestTestJob::test_data_2() {
std::string URLRequestTestJob::test_data_3() {
return std::string("<html><title>Test Three Three Three</title></html>");
}
+std::string URLRequestTestJob::test_data_4() {
+ return std::string("<html><title>Test Four Four Four Four</title></html>");
+}
// static getter for simple response headers
std::string URLRequestTestJob::test_headers() {
@@ -69,6 +78,17 @@ std::string URLRequestTestJob::test_redirect_headers() {
return std::string(kHeaders, arraysize(kHeaders));
}
+// static getter for redirect response headers
+std::string URLRequestTestJob::test_redirect_to_url_2_headers() {
+ std::string headers = "HTTP/1.1 302 MOVED";
+ headers.push_back('\0');
+ headers += "Location: ";
+ headers += test_url_2().spec();
+ headers.push_back('\0');
+ headers.push_back('\0');
+ return headers;
+}
+
// static getter for error response headers
std::string URLRequestTestJob::test_error_headers() {
static const char kHeaders[] =
@@ -162,6 +182,11 @@ void URLRequestTestJob::StartAsync() {
response_data_ = test_data_2();
} else if (request_->url().spec() == test_url_3().spec()) {
response_data_ = test_data_3();
+ } else if (request_->url().spec() == test_url_4().spec()) {
+ response_data_ = test_data_4();
+ } else if (request_->url().spec() == test_url_redirect_to_url_2().spec()) {
+ response_headers_ =
+ new HttpResponseHeaders(test_redirect_to_url_2_headers());
} else {
AdvanceJob();
« no previous file with comments | « net/url_request/url_request_test_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698