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

Unified Diff: content/test/fuzzer/clear_site_data_fuzzer.cc

Issue 2333733002: Add a fuzzer test for the Clear-Site-Data header. (Closed)
Patch Set: Addressed comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/fuzzer/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/fuzzer/clear_site_data_fuzzer.cc
diff --git a/content/test/fuzzer/clear_site_data_fuzzer.cc b/content/test/fuzzer/clear_site_data_fuzzer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a0cc6b27648eabc9620a94ff0b356cc11710c68b
--- /dev/null
+++ b/content/test/fuzzer/clear_site_data_fuzzer.cc
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+#include <vector>
+
+#include "content/browser/browsing_data/clear_site_data_throttle.h"
+
+namespace content {
+
+class ClearSiteDataFuzzerTest {
+ public:
+ ClearSiteDataFuzzerTest() : throttle_(nullptr) {}
+
+ void TestHeader(const std::string& header) {
+ bool remove_cookies;
+ bool remove_storage;
+ bool remove_cache;
+ std::vector<content::ClearSiteDataThrottle::ConsoleMessage> messages;
+
+ throttle_.ParseHeader(header, &remove_cookies, &remove_storage,
+ &remove_cache, &messages);
+ }
+
+ private:
+ content::ClearSiteDataThrottle throttle_;
+};
+
+ClearSiteDataFuzzerTest* test = new ClearSiteDataFuzzerTest();
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ test->TestHeader(std::string(reinterpret_cast<const char*>(data), size));
+ return 0;
+}
+
+} // namespace content
« 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