| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // Queues |callback| to handle a request to |hostname_|. Each callback is | 53 // Queues |callback| to handle a request to |hostname_|. Each callback is |
| 54 // used only once, and in the order that they're pushed. | 54 // used only once, and in the order that they're pushed. |
| 55 void PushJobCallback(const JobCallback& callback); | 55 void PushJobCallback(const JobCallback& callback); |
| 56 | 56 |
| 57 // Returns a JobCallback that will fail with the given network |error|. | 57 // Returns a JobCallback that will fail with the given network |error|. |
| 58 static JobCallback ErrorJob(int error); | 58 static JobCallback ErrorJob(int error); |
| 59 | 59 |
| 60 // Returns a JobCallback that will fail with HTTP 400 Bad Request. | 60 // Returns a JobCallback that will fail with HTTP 400 Bad Request. |
| 61 static JobCallback BadRequestJob(); | 61 static JobCallback BadRequestJob(); |
| 62 | 62 |
| 63 // Returns a JobCallback that will fail with the specified HTTP error (e.g. |
| 64 // "404 Not Found"). |
| 65 static JobCallback HttpErrorJob(std::string error); |
| 66 |
| 63 // Returns a JobCallback that will process a policy register request that | 67 // Returns a JobCallback that will process a policy register request that |
| 64 // should succeed. The request parameters are validated, and an appropriate | 68 // should succeed. The request parameters are validated, and an appropriate |
| 65 // response is sent back. | 69 // response is sent back. |
| 66 // |expected_type| is the expected type in the register request. | 70 // |expected_type| is the expected type in the register request. |
| 67 // If |expect_reregister| is true then the request must have the reregister | 71 // If |expect_reregister| is true then the request must have the reregister |
| 68 // flag set; otherwise the flag must be not set. | 72 // flag set; otherwise the flag must be not set. |
| 69 static JobCallback RegisterJob( | 73 static JobCallback RegisterJob( |
| 70 enterprise_management::DeviceRegisterRequest::Type expected_type, | 74 enterprise_management::DeviceRegisterRequest::Type expected_type, |
| 71 bool expect_reregister); | 75 bool expect_reregister); |
| 72 | 76 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 86 // Owned by URLRequestFilter. This handle is valid on IO and only while the | 90 // Owned by URLRequestFilter. This handle is valid on IO and only while the |
| 87 // interceptor is valid. | 91 // interceptor is valid. |
| 88 Delegate* delegate_; | 92 Delegate* delegate_; |
| 89 | 93 |
| 90 DISALLOW_COPY_AND_ASSIGN(TestRequestInterceptor); | 94 DISALLOW_COPY_AND_ASSIGN(TestRequestInterceptor); |
| 91 }; | 95 }; |
| 92 | 96 |
| 93 } // namespace policy | 97 } // namespace policy |
| 94 | 98 |
| 95 #endif // CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ | 99 #endif // CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ |
| OLD | NEW |