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

Side by Side Diff: net/url_request/url_request_fuzzer.cc

Issue 2250263003: Move FuzzedDataProvider to //base and expose to blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ... also remove PLATFORM_EXPORT Created 4 years, 4 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') | third_party/WebKit/Source/core/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "net/base/fuzzed_data_provider.h" 13 #include "base/test/fuzzed_data_provider.h"
14 #include "net/base/request_priority.h" 14 #include "net/base/request_priority.h"
15 #include "net/socket/fuzzed_socket_factory.h" 15 #include "net/socket/fuzzed_socket_factory.h"
16 #include "net/url_request/url_request.h" 16 #include "net/url_request/url_request.h"
17 #include "net/url_request/url_request_context.h" 17 #include "net/url_request/url_request_context.h"
18 #include "net/url_request/url_request_test_util.h" 18 #include "net/url_request/url_request_test_util.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 // Integration fuzzer for URLRequest's handling of HTTP requests. Can follow 21 // Integration fuzzer for URLRequest's handling of HTTP requests. Can follow
22 // redirects, both on the same server (using a new socket or the old one) and 22 // redirects, both on the same server (using a new socket or the old one) and
23 // across servers. 23 // across servers.
24 // TODO(mmenke): Add support for testing HTTPS, FTP, auth, proxies, uploading, 24 // TODO(mmenke): Add support for testing HTTPS, FTP, auth, proxies, uploading,
25 // cancelation, deferring reads / redirects, using preconnected sockets, SPDY, 25 // cancelation, deferring reads / redirects, using preconnected sockets, SPDY,
26 // QUIC, DNS failures (they all currently resolve to localhost), IPv6 DNS 26 // QUIC, DNS failures (they all currently resolve to localhost), IPv6 DNS
27 // results, URLs with IPs instead of hostnames (v4 and v6), etc. 27 // results, URLs with IPs instead of hostnames (v4 and v6), etc.
28 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 28 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
29 net::FuzzedDataProvider data_provider(data, size); 29 base::FuzzedDataProvider data_provider(data, size);
30 net::TestURLRequestContext url_request_context(true); 30 net::TestURLRequestContext url_request_context(true);
31 net::FuzzedSocketFactory fuzzed_socket_factory(&data_provider); 31 net::FuzzedSocketFactory fuzzed_socket_factory(&data_provider);
32 url_request_context.set_client_socket_factory(&fuzzed_socket_factory); 32 url_request_context.set_client_socket_factory(&fuzzed_socket_factory);
33 url_request_context.Init(); 33 url_request_context.Init();
34 34
35 net::TestDelegate delegate; 35 net::TestDelegate delegate;
36 36
37 std::unique_ptr<net::URLRequest> url_request( 37 std::unique_ptr<net::URLRequest> url_request(
38 url_request_context.CreateRequest(GURL("http://foo/"), 38 url_request_context.CreateRequest(GURL("http://foo/"),
39 net::DEFAULT_PRIORITY, &delegate)); 39 net::DEFAULT_PRIORITY, &delegate));
40 url_request->Start(); 40 url_request->Start();
41 // TestDelegate quits the message loop on completion. 41 // TestDelegate quits the message loop on completion.
42 base::RunLoop().Run(); 42 base::RunLoop().Run();
43 return 0; 43 return 0;
44 } 44 }
OLDNEW
« no previous file with comments | « net/url_request/url_request_data_job_fuzzer.cc ('k') | third_party/WebKit/Source/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698