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

Unified Diff: chrome/browser/policy/cloud/test_request_interceptor.cc

Issue 2705213002: Show different error message if ARC is disabled. (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « chrome/browser/policy/cloud/test_request_interceptor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/browser/policy/cloud/test_request_interceptor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698