OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ | 5 #ifndef HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ |
6 #define HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ | 6 #define HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "headless/public/util/generic_url_request_job.h" | 12 #include "headless/public/util/generic_url_request_job.h" |
13 #include "headless/public/util/testing/generic_url_request_mocks.h" | 13 #include "headless/public/util/testing/generic_url_request_mocks.h" |
14 #include "net/cookies/cookie_store.h" | 14 #include "net/cookies/cookie_store.h" |
15 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
16 #include "net/url_request/url_request_context.h" | 16 #include "net/url_request/url_request_context.h" |
17 #include "net/url_request/url_request_job_factory.h" | 17 #include "net/url_request/url_request_job_factory.h" |
18 | 18 |
19 namespace headless { | 19 namespace headless { |
20 | 20 |
21 class MockGenericURLRequestJobDelegate : public GenericURLRequestJob::Delegate { | 21 class MockGenericURLRequestJobDelegate : public GenericURLRequestJob::Delegate { |
22 public: | 22 public: |
23 MockGenericURLRequestJobDelegate(); | 23 MockGenericURLRequestJobDelegate(); |
24 ~MockGenericURLRequestJobDelegate() override; | 24 ~MockGenericURLRequestJobDelegate() override; |
25 | 25 |
26 bool BlockOrRewriteRequest( | 26 bool BlockOrRewriteRequest( |
27 const GURL& url, | 27 const GURL& url, |
| 28 const std::string& devtools_id, |
28 const std::string& method, | 29 const std::string& method, |
29 const std::string& referrer, | 30 const std::string& referrer, |
30 GenericURLRequestJob::RewriteCallback callback) override; | 31 GenericURLRequestJob::RewriteCallback callback) override; |
31 | 32 |
32 const GenericURLRequestJob::HttpResponse* MaybeMatchResource( | 33 const GenericURLRequestJob::HttpResponse* MaybeMatchResource( |
33 const GURL& url, | 34 const GURL& url, |
| 35 const std::string& devtools_id, |
34 const std::string& method, | 36 const std::string& method, |
35 const net::HttpRequestHeaders& request_headers) override; | 37 const net::HttpRequestHeaders& request_headers) override; |
36 | 38 |
37 void OnResourceLoadComplete(const GURL& final_url, | 39 void OnResourceLoadComplete(const GURL& final_url, |
| 40 const std::string& devtools_id, |
38 const std::string& mime_type, | 41 const std::string& mime_type, |
39 int http_response_code) override; | 42 int http_response_code) override; |
40 | 43 |
41 void SetShouldBlock(bool should_block) { should_block_ = should_block; } | 44 void SetShouldBlock(bool should_block) { should_block_ = should_block; } |
42 | 45 |
43 private: | 46 private: |
44 bool should_block_; | 47 bool should_block_; |
45 | 48 |
46 DISALLOW_COPY_AND_ASSIGN(MockGenericURLRequestJobDelegate); | 49 DISALLOW_COPY_AND_ASSIGN(MockGenericURLRequestJobDelegate); |
47 }; | 50 }; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 140 |
138 private: | 141 private: |
139 std::string response_data_; | 142 std::string response_data_; |
140 | 143 |
141 DISALLOW_COPY_AND_ASSIGN(MockURLRequestDelegate); | 144 DISALLOW_COPY_AND_ASSIGN(MockURLRequestDelegate); |
142 }; | 145 }; |
143 | 146 |
144 } // namespace headless | 147 } // namespace headless |
145 | 148 |
146 #endif // HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ | 149 #endif // HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ |
OLD | NEW |