Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" | 12 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" |
| 13 | 13 |
| 14 namespace base { | |
| 15 class FilePath; | |
| 16 } | |
| 17 | |
| 14 namespace net { | 18 namespace net { |
| 15 class NetworkDelegate; | 19 class NetworkDelegate; |
| 16 class URLRequest; | 20 class URLRequest; |
| 17 class URLRequestJob; | 21 class URLRequestJob; |
| 18 } | 22 } |
| 19 | 23 |
| 20 namespace policy { | 24 namespace policy { |
| 21 | 25 |
| 22 // Intercepts all requests to the given hostname while in scope, and allows | 26 // Intercepts all requests to the given hostname while in scope, and allows |
| 23 // queuing callbacks to handle expected requests. Must be created and destroyed | 27 // queuing callbacks to handle expected requests. Must be created and destroyed |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 49 // Returns a JobCallback that will process a policy register request that | 53 // Returns a JobCallback that will process a policy register request that |
| 50 // should succeed. The request parameters are validated, and an appropriate | 54 // should succeed. The request parameters are validated, and an appropriate |
| 51 // response is sent back. | 55 // response is sent back. |
| 52 // |expected_type| is the expected type in the register request. | 56 // |expected_type| is the expected type in the register request. |
| 53 // If |expect_reregister| is true then the request must have the reregister | 57 // If |expect_reregister| is true then the request must have the reregister |
| 54 // flag set; otherwise the flag must be not set. | 58 // flag set; otherwise the flag must be not set. |
| 55 static JobCallback RegisterJob( | 59 static JobCallback RegisterJob( |
| 56 enterprise_management::DeviceRegisterRequest::Type expected_type, | 60 enterprise_management::DeviceRegisterRequest::Type expected_type, |
| 57 bool expect_reregister); | 61 bool expect_reregister); |
| 58 | 62 |
| 63 // Returns a JobCallback that will sends the contents of |file_path|. | |
|
Joao da Silva
2013/05/28 11:59:35
nit: sends -> send
csorba
2013/05/28 12:07:25
Done.
| |
| 64 static JobCallback FileJob(const base::FilePath& file_path); | |
| 65 | |
| 59 private: | 66 private: |
| 60 class Delegate; | 67 class Delegate; |
| 61 | 68 |
| 62 const std::string hostname_; | 69 const std::string hostname_; |
| 63 | 70 |
| 64 // Owned by URLRequestFilter. This handle is valid on IO and only while the | 71 // Owned by URLRequestFilter. This handle is valid on IO and only while the |
| 65 // interceptor is valid. | 72 // interceptor is valid. |
| 66 Delegate* delegate_; | 73 Delegate* delegate_; |
| 67 | 74 |
| 68 DISALLOW_COPY_AND_ASSIGN(TestRequestInterceptor); | 75 DISALLOW_COPY_AND_ASSIGN(TestRequestInterceptor); |
| 69 }; | 76 }; |
| 70 | 77 |
| 71 } // namespace policy | 78 } // namespace policy |
| 72 | 79 |
| 73 #endif // CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ | 80 #endif // CHROME_BROWSER_POLICY_CLOUD_TEST_REQUEST_INTERCEPTOR_H_ |
| OLD | NEW |