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(); |