| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 namespace headless { | 27 namespace headless { |
| 28 | 28 |
| 29 class MockGenericURLRequestJobDelegate : public GenericURLRequestJob::Delegate { | 29 class MockGenericURLRequestJobDelegate : public GenericURLRequestJob::Delegate { |
| 30 public: | 30 public: |
| 31 MockGenericURLRequestJobDelegate(); | 31 MockGenericURLRequestJobDelegate(); |
| 32 ~MockGenericURLRequestJobDelegate() override; | 32 ~MockGenericURLRequestJobDelegate() override; |
| 33 | 33 |
| 34 bool BlockOrRewriteRequest( | 34 bool BlockOrRewriteRequest( |
| 35 const GURL& url, | 35 const GURL& url, |
| 36 const std::string& method, |
| 36 const std::string& referrer, | 37 const std::string& referrer, |
| 37 GenericURLRequestJob::RewriteCallback callback) override; | 38 GenericURLRequestJob::RewriteCallback callback) override; |
| 38 | 39 |
| 39 const GenericURLRequestJob::HttpResponse* MaybeMatchResource( | 40 const GenericURLRequestJob::HttpResponse* MaybeMatchResource( |
| 40 const GURL& url, | 41 const GURL& url, |
| 42 const std::string& method, |
| 41 const net::HttpRequestHeaders& request_headers) override; | 43 const net::HttpRequestHeaders& request_headers) override; |
| 42 | 44 |
| 43 void OnResourceLoadComplete(const GURL& final_url, | 45 void OnResourceLoadComplete(const GURL& final_url, |
| 44 const std::string& mime_type, | 46 const std::string& mime_type, |
| 45 int http_response_code) override; | 47 int http_response_code) override; |
| 46 | 48 |
| 47 void SetShouldBlock(bool should_block) { should_block_ = should_block; } | 49 void SetShouldBlock(bool should_block) { should_block_ = should_block; } |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 bool should_block_; | 52 bool should_block_; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 146 |
| 145 private: | 147 private: |
| 146 std::string response_data_; | 148 std::string response_data_; |
| 147 | 149 |
| 148 DISALLOW_COPY_AND_ASSIGN(MockURLRequestDelegate); | 150 DISALLOW_COPY_AND_ASSIGN(MockURLRequestDelegate); |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 } // namespace headless | 153 } // namespace headless |
| 152 | 154 |
| 153 #endif // HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ | 155 #endif // HEADLESS_PUBLIC_UTIL_TESTING_GENERIC_URL_REQUEST_MOCKS_H_ |
| OLD | NEW |