OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_UPDATE_CLIENT_URL_REQUEST_POST_INTERCEPTOR_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_URL_REQUEST_POST_INTERCEPTOR_H_ |
6 #define COMPONENTS_UPDATE_CLIENT_URL_REQUEST_POST_INTERCEPTOR_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_URL_REQUEST_POST_INTERCEPTOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class FilePath; | 21 class FilePath; |
22 class SequencedTaskRunner; | 22 class SequencedTaskRunner; |
23 } | 23 } |
24 | 24 |
25 namespace net { | |
26 class URLRequest; | |
27 } | |
28 | |
29 namespace update_client { | 25 namespace update_client { |
30 | 26 |
31 // Intercepts requests to a file path, counts them, and captures the body of | 27 // Intercepts requests to a file path, counts them, and captures the body of |
32 // the requests. Optionally, for each request, it can return a canned response | 28 // the requests. Optionally, for each request, it can return a canned response |
33 // from a given file. The class maintains a queue of expectations, and returns | 29 // from a given file. The class maintains a queue of expectations, and returns |
34 // one and only one response for each request that matches and it is | 30 // one and only one response for each request that matches and it is |
35 // intercepted. | 31 // intercepted. |
36 class URLRequestPostInterceptor { | 32 class URLRequestPostInterceptor { |
37 public: | 33 public: |
38 // Allows a generic string maching interface when setting up expectations. | 34 // Allows a generic string maching interface when setting up expectations. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 152 |
157 private: | 153 private: |
158 const std::string expected_; | 154 const std::string expected_; |
159 | 155 |
160 DISALLOW_COPY_AND_ASSIGN(PartialMatch); | 156 DISALLOW_COPY_AND_ASSIGN(PartialMatch); |
161 }; | 157 }; |
162 | 158 |
163 } // namespace update_client | 159 } // namespace update_client |
164 | 160 |
165 #endif // COMPONENTS_UPDATE_CLIENT_URL_REQUEST_POST_INTERCEPTOR_H_ | 161 #endif // COMPONENTS_UPDATE_CLIENT_URL_REQUEST_POST_INTERCEPTOR_H_ |
OLD | NEW |