Fuzz BackoffEntrySerializer with net_backoff_entry_serializer_fuzzer.

This fuzzer tests both the "serialize-then-deserialize" and
"deserialize-then-serialize" directions.

Change-Id: I571de9e67377bb811262febd37378f1b06f190b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2185797
Reviewed-by: Jonathan Metzman <[email protected]>
Reviewed-by: Maksim Orlovich <[email protected]>
Commit-Queue: Dan McArdle <[email protected]>
Cr-Commit-Position: refs/heads/master@{#767349}
diff --git a/net/base/backoff_entry_serializer_fuzzer_input.proto b/net/base/backoff_entry_serializer_fuzzer_input.proto
new file mode 100644
index 0000000..d92f72e
--- /dev/null
+++ b/net/base/backoff_entry_serializer_fuzzer_input.proto
@@ -0,0 +1,29 @@
+// Copyright 2020 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.
+
+syntax = "proto2";
+
+package fuzz_proto;
+
+import "testing/libfuzzer/proto/json.proto";
+
+message FuzzerInput {
+  // Using int64 to match base::Time's internal representation.
+  required int64 parse_time = 1;
+  required int64 serialize_time = 2;
+  required BackoffEntryPolicy policy = 3;
+  required json_proto.ArrayValue serialized_entry = 4;
+}
+
+// Input for the fuzzer to try serializing a BackoffEntry.
+// Keep aligned with |net::BackoffEntry::Policy|.
+message BackoffEntryPolicy {
+  required int64 num_errors_to_ignore = 1;
+  required int64 initial_delay_ms = 2;
+  required double multiply_factor = 3;
+  required double jitter_factor = 4;
+  required int64 maximum_backoff_ms = 5;
+  required int64 entry_lifetime_ms = 6;
+  required bool always_use_initial_delay = 7;
+}
\ No newline at end of file