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

Side by Side Diff: content/test/fuzzer/clear_site_data_fuzzer.cc

Issue 2333733002: Add a fuzzer test for the Clear-Site-Data header. (Closed)
Patch Set: Created 4 years, 3 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 | « content/test/fuzzer/BUILD.gn ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <stddef.h>
6 #include <stdint.h>
7 #include <vector>
8
9 #include "content/browser/browsing_data/clear_site_data_throttle.h"
10
11 namespace content {
12
13 class ClearSiteDataFuzzerTest {
14 public:
15 ClearSiteDataFuzzerTest() : throttle_(nullptr) {}
16
17 void TestHeader(const std::string& header) {
18 bool remove_cookies;
19 bool remove_storage;
20 bool remove_cache;
21
22 throttle_.ParseHeader(header, &remove_cookies, &remove_storage,
23 &remove_cache, &messages_);
24
25 // Keep clearing the output messages vector so that it doesn't grow
26 // ad infinitum.
27 messages_.clear();
aizatsky 2016/09/12 19:54:50 Maybe make it local?
msramek 2016/09/13 14:50:06 Done. This was my attempt to optimize by sparing t
28 }
29
30 private:
31 content::ClearSiteDataThrottle throttle_;
32 std::vector<content::ClearSiteDataThrottle::ConsoleMessage> messages_;
33 };
34
35 ClearSiteDataFuzzerTest* test = new ClearSiteDataFuzzerTest();
36
37 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
38 std::string header(reinterpret_cast<const char*>(data), size);
39 test->TestHeader(header);
aizatsky 2016/09/12 19:54:50 I don't think a separate method is needed. I'd sim
msramek 2016/09/13 14:50:06 I just noticed that I can inline |header|, so I di
40 return 0;
41 }
42
43 } // namespace content
OLDNEW
« no previous file with comments | « content/test/fuzzer/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698