| Index: chrome/browser/policy/cloud/test_request_interceptor.cc
|
| diff --git a/chrome/browser/policy/cloud/test_request_interceptor.cc b/chrome/browser/policy/cloud/test_request_interceptor.cc
|
| index 83be515a7829a4b71442adae1b6527a643cefa1b..53ee897e722764e70f027f5f8602e780df827515 100644
|
| --- a/chrome/browser/policy/cloud/test_request_interceptor.cc
|
| +++ b/chrome/browser/policy/cloud/test_request_interceptor.cc
|
| @@ -42,19 +42,24 @@ net::URLRequestJob* ErrorJobCallback(int error,
|
| return new net::URLRequestErrorJob(request, network_delegate, error);
|
| }
|
|
|
| -// Helper callback for jobs that should fail with a 400 HTTP error.
|
| -net::URLRequestJob* BadRequestJobCallback(
|
| +// Helper callback for jobs that should fail with the specified HTTP error.
|
| +net::URLRequestJob* HttpErrorJobCallback(
|
| + const std::string& error,
|
| net::URLRequest* request,
|
| net::NetworkDelegate* network_delegate) {
|
| - static const char kBadHeaders[] =
|
| - "HTTP/1.1 400 Bad request\n"
|
| - "Content-type: application/protobuf\n"
|
| - "\n";
|
| - std::string headers(kBadHeaders, arraysize(kBadHeaders));
|
| + std::string headers =
|
| + "HTTP/1.1 " + error + "\nContent-type: application/protobuf\n\n";
|
| return new net::URLRequestTestJob(
|
| request, network_delegate, headers, std::string(), true);
|
| }
|
|
|
| +// Helper callback for jobs that should fail with a 400 HTTP error.
|
| +net::URLRequestJob* BadRequestJobCallback(
|
| + net::URLRequest* request,
|
| + net::NetworkDelegate* network_delegate) {
|
| + return HttpErrorJobCallback("400 Bad request", request, network_delegate);
|
| +}
|
| +
|
| net::URLRequestJob* FileJobCallback(const base::FilePath& file_path,
|
| net::URLRequest* request,
|
| net::NetworkDelegate* network_delegate) {
|
| @@ -317,6 +322,12 @@ TestRequestInterceptor::JobCallback TestRequestInterceptor::BadRequestJob() {
|
| }
|
|
|
| // static
|
| +TestRequestInterceptor::JobCallback TestRequestInterceptor::HttpErrorJob(
|
| + std::string error) {
|
| + return base::Bind(&HttpErrorJobCallback, error);
|
| +}
|
| +
|
| +// static
|
| TestRequestInterceptor::JobCallback TestRequestInterceptor::RegisterJob(
|
| em::DeviceRegisterRequest::Type expected_type,
|
| bool expect_reregister) {
|
|
|