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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzzer_helpers.py

Issue 2166463002: bluetooth: Basic Web Bluetooth Fuzzer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Move to testing/clusterfuzz directory Created 4 years, 5 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
Index: third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzzer_helpers.py
diff --git a/third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzzer_helpers.py b/third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzzer_helpers.py
new file mode 100644
index 0000000000000000000000000000000000000000..798fe86306d617b10e27cc7bc1bfc7cf9351adc0
--- /dev/null
+++ b/third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzzer_helpers.py
@@ -0,0 +1,26 @@
+# 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.
+
+"""Module that includes classes and functions used by fuzzers."""
+
+
+def FillInParameter(parameter, func, template):
+ """Replaces occurrences of a parameter by calling a provided generator.
+
+ Args:
+ parameter: A string representing the parameter that should be replaced.
+ func: A function that returns a string representing the value used to
+ replace an instance of the parameter.
+ template: A string that contains the parameter to be replaced.
+
+ Returns:
+ A string containing the value of |template| in which instances of
+ |pameter| have been replaced by results of calling |func|.
+
+ """
+ result = template
+ while parameter in result:
+ result = result.replace(parameter, func(), 1)
+
+ return result

Powered by Google App Engine
This is Rietveld 408576698