Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: net/url_request/url_request_test_util.h

Issue 1919013003: Add fuzzer to test Fuzz URLRequestDataJob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_request_fuzzer
Patch Set: rebase on #390645 Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_data_job_fuzzer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_
6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "net/base/io_buffer.h" 24 #include "net/base/io_buffer.h"
25 #include "net/base/load_timing_info.h" 25 #include "net/base/load_timing_info.h"
26 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
27 #include "net/base/net_export.h"
27 #include "net/base/network_delegate_impl.h" 28 #include "net/base/network_delegate_impl.h"
28 #include "net/base/request_priority.h" 29 #include "net/base/request_priority.h"
29 #include "net/base/sdch_manager.h" 30 #include "net/base/sdch_manager.h"
30 #include "net/cert/cert_verifier.h" 31 #include "net/cert/cert_verifier.h"
31 #include "net/cookies/cookie_monster.h" 32 #include "net/cookies/cookie_monster.h"
32 #include "net/disk_cache/disk_cache.h" 33 #include "net/disk_cache/disk_cache.h"
33 #include "net/ftp/ftp_network_layer.h" 34 #include "net/ftp/ftp_network_layer.h"
34 #include "net/http/http_auth_handler_factory.h" 35 #include "net/http/http_auth_handler_factory.h"
35 #include "net/http/http_cache.h" 36 #include "net/http/http_cache.h"
36 #include "net/http/http_network_layer.h" 37 #include "net/http/http_network_layer.h"
37 #include "net/http/http_network_session.h" 38 #include "net/http/http_network_session.h"
38 #include "net/http/http_request_headers.h" 39 #include "net/http/http_request_headers.h"
39 #include "net/proxy/proxy_service.h" 40 #include "net/proxy/proxy_service.h"
40 #include "net/ssl/ssl_config_service_defaults.h" 41 #include "net/ssl/ssl_config_service_defaults.h"
41 #include "net/url_request/url_request.h" 42 #include "net/url_request/url_request.h"
42 #include "net/url_request/url_request_context.h" 43 #include "net/url_request/url_request_context.h"
43 #include "net/url_request/url_request_context_getter.h" 44 #include "net/url_request/url_request_context_getter.h"
44 #include "net/url_request/url_request_context_storage.h" 45 #include "net/url_request/url_request_context_storage.h"
45 #include "net/url_request/url_request_job_factory.h" 46 #include "net/url_request/url_request_job_factory.h"
46 #include "url/url_util.h" 47 #include "url/url_util.h"
47 48
48 using base::TimeDelta; 49 using base::TimeDelta;
49 50
50 namespace net { 51 namespace net {
51 52
52 //----------------------------------------------------------------------------- 53 //-----------------------------------------------------------------------------
53 54
54 class TestURLRequestContext : public URLRequestContext { 55 class NET_EXPORT_PRIVATE TestURLRequestContext : public URLRequestContext {
55 public: 56 public:
56 TestURLRequestContext(); 57 TestURLRequestContext();
57 // Default constructor like TestURLRequestContext() but does not call 58 // Default constructor like TestURLRequestContext() but does not call
58 // Init() in case |delay_initialization| is true. This allows modifying the 59 // Init() in case |delay_initialization| is true. This allows modifying the
59 // URLRequestContext before it is constructed completely. If 60 // URLRequestContext before it is constructed completely. If
60 // |delay_initialization| is true, Init() needs be be called manually. 61 // |delay_initialization| is true, Init() needs be be called manually.
61 explicit TestURLRequestContext(bool delay_initialization); 62 explicit TestURLRequestContext(bool delay_initialization);
62 ~TestURLRequestContext() override; 63 ~TestURLRequestContext() override;
63 64
64 void Init(); 65 void Init();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 protected: 133 protected:
133 ~TestURLRequestContextGetter() override; 134 ~TestURLRequestContextGetter() override;
134 135
135 private: 136 private:
136 const scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; 137 const scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
137 std::unique_ptr<TestURLRequestContext> context_; 138 std::unique_ptr<TestURLRequestContext> context_;
138 }; 139 };
139 140
140 //----------------------------------------------------------------------------- 141 //-----------------------------------------------------------------------------
141 142
142 class TestDelegate : public URLRequest::Delegate { 143 class NET_EXPORT_PRIVATE TestDelegate : public URLRequest::Delegate {
Charlie Harrison 2016/04/29 17:03:13 Looks like I don't need this anymore, will remove.
143 public: 144 public:
144 TestDelegate(); 145 TestDelegate();
145 ~TestDelegate() override; 146 ~TestDelegate() override;
146 147
147 void set_cancel_in_received_redirect(bool val) { cancel_in_rr_ = val; } 148 void set_cancel_in_received_redirect(bool val) { cancel_in_rr_ = val; }
148 void set_cancel_in_response_started(bool val) { cancel_in_rs_ = val; } 149 void set_cancel_in_response_started(bool val) { cancel_in_rs_ = val; }
149 void set_cancel_in_received_data(bool val) { cancel_in_rd_ = val; } 150 void set_cancel_in_received_data(bool val) { cancel_in_rd_ = val; }
150 void set_cancel_in_received_data_pending(bool val) { 151 void set_cancel_in_received_data_pending(bool val) {
151 cancel_in_rd_pending_ = val; 152 cancel_in_rd_pending_ = val;
152 } 153 }
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 NetworkDelegate* network_delegate) const override; 421 NetworkDelegate* network_delegate) const override;
421 void set_main_intercept_job(std::unique_ptr<URLRequestJob> job); 422 void set_main_intercept_job(std::unique_ptr<URLRequestJob> job);
422 423
423 private: 424 private:
424 mutable std::unique_ptr<URLRequestJob> main_intercept_job_; 425 mutable std::unique_ptr<URLRequestJob> main_intercept_job_;
425 }; 426 };
426 427
427 } // namespace net 428 } // namespace net
428 429
429 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ 430 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_data_job_fuzzer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698