Merge third_party/http2/tools into third_party/http2/test_tools. Some of the benchmarking code is removed rather than moved, since I see no indication of anyone using this code within recent past. This also fixes unnecessary google3 includes in random_decoder_test_test. PiperOrigin-RevId: 446701621
diff --git a/quiche/http2/decoder/decode_http2_structures_test.cc b/quiche/http2/decoder/decode_http2_structures_test.cc index 7266249..c94440b 100644 --- a/quiche/http2/decoder/decode_http2_structures_test.cc +++ b/quiche/http2/decoder/decode_http2_structures_test.cc
@@ -16,8 +16,8 @@ #include "quiche/http2/decoder/decode_status.h" #include "quiche/http2/http2_constants.h" #include "quiche/http2/http2_structures_test_util.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/frame_decoder_state_test_util.cc b/quiche/http2/decoder/frame_decoder_state_test_util.cc index 7a1d759..3781561 100644 --- a/quiche/http2/decoder/frame_decoder_state_test_util.cc +++ b/quiche/http2/decoder/frame_decoder_state_test_util.cc
@@ -8,7 +8,7 @@ #include "quiche/http2/http2_structures.h" #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" namespace http2 {
diff --git a/quiche/http2/decoder/frame_decoder_state_test_util.h b/quiche/http2/decoder/frame_decoder_state_test_util.h index 13a08d3..d940d8f 100644 --- a/quiche/http2/decoder/frame_decoder_state_test_util.h +++ b/quiche/http2/decoder/frame_decoder_state_test_util.h
@@ -7,7 +7,7 @@ #include "quiche/http2/decoder/frame_decoder_state.h" #include "quiche/http2/http2_structures.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_export.h" namespace http2 {
diff --git a/quiche/http2/decoder/http2_frame_decoder_test.cc b/quiche/http2/decoder/http2_frame_decoder_test.cc index 3402f9b..5e8eb88 100644 --- a/quiche/http2/decoder/http2_frame_decoder_test.cc +++ b/quiche/http2/decoder/http2_frame_decoder_test.cc
@@ -14,7 +14,7 @@ #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector_listener.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/decoder/http2_structure_decoder_test.cc b/quiche/http2/decoder/http2_structure_decoder_test.cc index a44a20f..a550e9c 100644 --- a/quiche/http2/decoder/http2_structure_decoder_test.cc +++ b/quiche/http2/decoder/http2_structure_decoder_test.cc
@@ -28,8 +28,8 @@ #include "quiche/http2/decoder/decode_status.h" #include "quiche/http2/http2_constants.h" #include "quiche/http2/http2_structures_test_util.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc index db8a5e7..ad60b5e 100644 --- a/quiche/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc
@@ -15,9 +15,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc index 44fea32..b0eec6b 100644 --- a/quiche/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc
@@ -15,7 +15,7 @@ #include "quiche/http2/http2_structures.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/data_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/data_payload_decoder_test.cc index 2a9443b..46542c7 100644 --- a/quiche/http2/decoder/payload_decoders/data_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/data_payload_decoder_test.cc
@@ -15,9 +15,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc index 451ad39..576c6e7 100644 --- a/quiche/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc
@@ -14,9 +14,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/headers_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/headers_payload_decoder_test.cc index b4b8fbd..c51219b 100644 --- a/quiche/http2/decoder/payload_decoders/headers_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/headers_payload_decoder_test.cc
@@ -14,9 +14,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/payload_decoder_base_test_util.h b/quiche/http2/decoder/payload_decoders/payload_decoder_base_test_util.h index da84571..77f53cc 100644 --- a/quiche/http2/decoder/payload_decoders/payload_decoder_base_test_util.h +++ b/quiche/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -20,8 +20,8 @@ #include "quiche/http2/http2_constants_test_util.h" #include "quiche/http2/http2_structures.h" #include "quiche/http2/test_tools/frame_parts.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_export.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/decoder/payload_decoders/ping_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/ping_payload_decoder_test.cc index 33ab9c9..bac4555 100644 --- a/quiche/http2/decoder/payload_decoders/ping_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/ping_payload_decoder_test.cc
@@ -12,9 +12,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/priority_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/priority_payload_decoder_test.cc index 558e542..fe4657c 100644 --- a/quiche/http2/decoder/payload_decoders/priority_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/priority_payload_decoder_test.cc
@@ -12,9 +12,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/priority_update_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/priority_update_payload_decoder_test.cc index 0ed2a59..94a1fa7 100644 --- a/quiche/http2/decoder/payload_decoders/priority_update_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/priority_update_payload_decoder_test.cc
@@ -14,9 +14,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc index e8806de..2b15341 100644 --- a/quiche/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc
@@ -14,9 +14,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc index b4bd192..40c613e 100644 --- a/quiche/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc
@@ -13,9 +13,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/settings_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/settings_payload_decoder_test.cc index 1c93864..8173c72 100644 --- a/quiche/http2/decoder/payload_decoders/settings_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/settings_payload_decoder_test.cc
@@ -15,9 +15,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc index fccddeb..182816a 100644 --- a/quiche/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc
@@ -16,7 +16,7 @@ #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc b/quiche/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc index 03bb862..dad599e 100644 --- a/quiche/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc +++ b/quiche/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc
@@ -12,9 +12,9 @@ #include "quiche/http2/http2_structures_test_util.h" #include "quiche/http2/test_tools/frame_parts.h" #include "quiche/http2/test_tools/frame_parts_collector.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/hpack/decoder/hpack_block_decoder_test.cc b/quiche/http2/hpack/decoder/hpack_block_decoder_test.cc index 4e18c02..88fa658 100644 --- a/quiche/http2/hpack/decoder/hpack_block_decoder_test.cc +++ b/quiche/http2/hpack/decoder/hpack_block_decoder_test.cc
@@ -16,7 +16,7 @@ #include "quiche/http2/hpack/tools/hpack_block_builder.h" #include "quiche/http2/hpack/tools/hpack_example.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/decoder/hpack_decoder_tables_test.cc b/quiche/http2/hpack/decoder/hpack_decoder_tables_test.cc index 42ca482..bebfbb6 100644 --- a/quiche/http2/hpack/decoder/hpack_decoder_tables_test.cc +++ b/quiche/http2/hpack/decoder/hpack_decoder_tables_test.cc
@@ -11,7 +11,7 @@ #include "quiche/http2/hpack/http2_hpack_constants.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_util.h" +#include "quiche/http2/test_tools/random_util.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/decoder/hpack_decoder_test.cc b/quiche/http2/hpack/decoder/hpack_decoder_test.cc index 398e1ec..82a86a5 100644 --- a/quiche/http2/hpack/decoder/hpack_decoder_test.cc +++ b/quiche/http2/hpack/decoder/hpack_decoder_test.cc
@@ -20,7 +20,7 @@ #include "quiche/http2/hpack/tools/hpack_example.h" #include "quiche/http2/http2_constants.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_util.h" +#include "quiche/http2/test_tools/random_util.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/decoder/hpack_entry_decoder_test.cc b/quiche/http2/hpack/decoder/hpack_entry_decoder_test.cc index 275495d..a84e3a6 100644 --- a/quiche/http2/hpack/decoder/hpack_entry_decoder_test.cc +++ b/quiche/http2/hpack/decoder/hpack_entry_decoder_test.cc
@@ -11,7 +11,7 @@ #include "quiche/http2/hpack/decoder/hpack_entry_collector.h" #include "quiche/http2/hpack/tools/hpack_block_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/decoder/hpack_entry_type_decoder_test.cc b/quiche/http2/hpack/decoder/hpack_entry_type_decoder_test.cc index fe1a710..f90622e 100644 --- a/quiche/http2/hpack/decoder/hpack_entry_type_decoder_test.cc +++ b/quiche/http2/hpack/decoder/hpack_entry_type_decoder_test.cc
@@ -7,7 +7,7 @@ #include <vector> #include "quiche/http2/hpack/tools/hpack_block_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/decoder/hpack_string_decoder_test.cc b/quiche/http2/hpack/decoder/hpack_string_decoder_test.cc index eb034af..e27e9db 100644 --- a/quiche/http2/hpack/decoder/hpack_string_decoder_test.cc +++ b/quiche/http2/hpack/decoder/hpack_string_decoder_test.cc
@@ -11,7 +11,7 @@ #include "quiche/http2/hpack/decoder/hpack_string_decoder_listener.h" #include "quiche/http2/hpack/tools/hpack_block_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/huffman/hpack_huffman_decoder_test.cc b/quiche/http2/hpack/huffman/hpack_huffman_decoder_test.cc index 728d3d4..137af27 100644 --- a/quiche/http2/hpack/huffman/hpack_huffman_decoder_test.cc +++ b/quiche/http2/hpack/huffman/hpack_huffman_decoder_test.cc
@@ -12,7 +12,7 @@ #include "absl/strings/escaping.h" #include "quiche/http2/decoder/decode_buffer.h" #include "quiche/http2/decoder/decode_status.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/huffman/hpack_huffman_transcoder_test.cc b/quiche/http2/hpack/huffman/hpack_huffman_transcoder_test.cc index cf4dab2..83691be 100644 --- a/quiche/http2/hpack/huffman/hpack_huffman_transcoder_test.cc +++ b/quiche/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
@@ -11,7 +11,7 @@ #include "quiche/http2/decoder/decode_status.h" #include "quiche/http2/hpack/huffman/hpack_huffman_decoder.h" #include "quiche/http2/hpack/huffman/hpack_huffman_encoder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/quiche_text_utils.h"
diff --git a/quiche/http2/hpack/varint/hpack_varint_decoder_test.cc b/quiche/http2/hpack/varint/hpack_varint_decoder_test.cc index f4c6de5..5da7a20 100644 --- a/quiche/http2/hpack/varint/hpack_varint_decoder_test.cc +++ b/quiche/http2/hpack/varint/hpack_varint_decoder_test.cc
@@ -11,7 +11,7 @@ #include "absl/base/macros.h" #include "absl/strings/escaping.h" #include "absl/strings/string_view.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/platform/api/quiche_test_helpers.h"
diff --git a/quiche/http2/hpack/varint/hpack_varint_round_trip_test.cc b/quiche/http2/hpack/varint/hpack_varint_round_trip_test.cc index 06cc88d..bf890ba 100644 --- a/quiche/http2/hpack/varint/hpack_varint_round_trip_test.cc +++ b/quiche/http2/hpack/varint/hpack_varint_round_trip_test.cc
@@ -17,7 +17,7 @@ #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "quiche/http2/hpack/tools/hpack_block_builder.h" -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include "quiche/common/platform/api/quiche_logging.h" #include "quiche/common/platform/api/quiche_test.h" #include "quiche/common/quiche_text_utils.h"
diff --git a/quiche/http2/http2_structures_test_util.h b/quiche/http2/http2_structures_test_util.h index c628bf8..ec4b9d7 100644 --- a/quiche/http2/http2_structures_test_util.h +++ b/quiche/http2/http2_structures_test_util.h
@@ -8,8 +8,8 @@ #include <string> #include "quiche/http2/http2_structures.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/http2/test_tools/http2_random.h" -#include "quiche/http2/tools/http2_frame_builder.h" #include "quiche/common/platform/api/quiche_test.h" namespace http2 {
diff --git a/quiche/http2/tools/http2_frame_builder.cc b/quiche/http2/test_tools/http2_frame_builder.cc similarity index 98% rename from quiche/http2/tools/http2_frame_builder.cc rename to quiche/http2/test_tools/http2_frame_builder.cc index e0ce2e2..d31ddc9 100644 --- a/quiche/http2/tools/http2_frame_builder.cc +++ b/quiche/http2/test_tools/http2_frame_builder.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "quiche/http2/tools/http2_frame_builder.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #ifdef WIN32 #include <winsock2.h> // for htonl() functions
diff --git a/quiche/http2/tools/http2_frame_builder.h b/quiche/http2/test_tools/http2_frame_builder.h similarity index 94% rename from quiche/http2/tools/http2_frame_builder.h rename to quiche/http2/test_tools/http2_frame_builder.h index d0ec441..8ff1916 100644 --- a/quiche/http2/tools/http2_frame_builder.h +++ b/quiche/http2/test_tools/http2_frame_builder.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef QUICHE_HTTP2_TOOLS_HTTP2_FRAME_BUILDER_H_ -#define QUICHE_HTTP2_TOOLS_HTTP2_FRAME_BUILDER_H_ +#ifndef QUICHE_HTTP2_TEST_TOOLS_HTTP2_FRAME_BUILDER_H_ +#define QUICHE_HTTP2_TEST_TOOLS_HTTP2_FRAME_BUILDER_H_ // Http2FrameBuilder builds wire-format HTTP/2 frames (or fragments thereof) // from components. @@ -100,4 +100,4 @@ } // namespace test } // namespace http2 -#endif // QUICHE_HTTP2_TOOLS_HTTP2_FRAME_BUILDER_H_ +#endif // QUICHE_HTTP2_TEST_TOOLS_HTTP2_FRAME_BUILDER_H_
diff --git a/quiche/http2/tools/http2_frame_builder_test.cc b/quiche/http2/test_tools/http2_frame_builder_test.cc similarity index 98% rename from quiche/http2/tools/http2_frame_builder_test.cc rename to quiche/http2/test_tools/http2_frame_builder_test.cc index bc270aa..3ded5d7 100644 --- a/quiche/http2/tools/http2_frame_builder_test.cc +++ b/quiche/http2/test_tools/http2_frame_builder_test.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "quiche/http2/tools/http2_frame_builder.h" +#include "quiche/http2/test_tools/http2_frame_builder.h" #include "quiche/common/platform/api/quiche_test.h"
diff --git a/quiche/http2/tools/random_decoder_test.cc b/quiche/http2/test_tools/random_decoder_test.cc similarity index 98% rename from quiche/http2/tools/random_decoder_test.cc rename to quiche/http2/test_tools/random_decoder_test.cc index 0ceb412..32952c6 100644 --- a/quiche/http2/tools/random_decoder_test.cc +++ b/quiche/http2/test_tools/random_decoder_test.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "quiche/http2/tools/random_decoder_test.h" +#include "quiche/http2/test_tools/random_decoder_test.h" #include <stddef.h>
diff --git a/quiche/http2/tools/random_decoder_test.h b/quiche/http2/test_tools/random_decoder_test.h similarity index 98% rename from quiche/http2/tools/random_decoder_test.h rename to quiche/http2/test_tools/random_decoder_test.h index 852968a..1a33912 100644 --- a/quiche/http2/tools/random_decoder_test.h +++ b/quiche/http2/test_tools/random_decoder_test.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef QUICHE_HTTP2_TOOLS_RANDOM_DECODER_TEST_H_ -#define QUICHE_HTTP2_TOOLS_RANDOM_DECODER_TEST_H_ +#ifndef QUICHE_HTTP2_TEST_TOOLS_RANDOM_DECODER_TEST_H_ +#define QUICHE_HTTP2_TEST_TOOLS_RANDOM_DECODER_TEST_H_ // RandomDecoderTest is a base class for tests of decoding various kinds // of HTTP/2 and HPACK encodings. @@ -254,4 +254,4 @@ } // namespace test } // namespace http2 -#endif // QUICHE_HTTP2_TOOLS_RANDOM_DECODER_TEST_H_ +#endif // QUICHE_HTTP2_TEST_TOOLS_RANDOM_DECODER_TEST_H_
diff --git a/quiche/http2/test_tools/random_decoder_test_test.cc b/quiche/http2/test_tools/random_decoder_test_test.cc new file mode 100644 index 0000000..a2a213e --- /dev/null +++ b/quiche/http2/test_tools/random_decoder_test_test.cc
@@ -0,0 +1,327 @@ +#include "quiche/http2/test_tools/random_decoder_test.h" + +#include <stddef.h> + +#include <functional> +#include <set> +#include <type_traits> + +#include "quiche/http2/decoder/decode_buffer.h" +#include "quiche/http2/decoder/decode_status.h" +#include "quiche/http2/test_tools/http2_random.h" +#include "quiche/common/platform/api/quiche_logging.h" +#include "quiche/common/platform/api/quiche_test.h" + +namespace http2 { +namespace test { +namespace { +const char kData[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; +const bool kReturnNonZeroOnFirst = true; +const bool kMayReturnZeroOnFirst = false; + +// Confirm the behavior of various parts of RandomDecoderTest. +class RandomDecoderTestTest : public RandomDecoderTest { + public: + RandomDecoderTestTest() : data_db_(kData) { + QUICHE_CHECK_EQ(sizeof kData, 8u); + } + + protected: + typedef std::function<DecodeStatus(DecodeBuffer* db)> DecodingFn; + + DecodeStatus StartDecoding(DecodeBuffer* db) override { + ++start_decoding_calls_; + if (start_decoding_fn_) { + return start_decoding_fn_(db); + } + return DecodeStatus::kDecodeError; + } + + DecodeStatus ResumeDecoding(DecodeBuffer* db) override { + ++resume_decoding_calls_; + if (resume_decoding_fn_) { + return resume_decoding_fn_(db); + } + return DecodeStatus::kDecodeError; + } + + bool StopDecodeOnDone() override { + ++stop_decode_on_done_calls_; + if (override_stop_decode_on_done_) { + return sub_stop_decode_on_done_; + } + return RandomDecoderTest::StopDecodeOnDone(); + } + + size_t start_decoding_calls_ = 0; + size_t resume_decoding_calls_ = 0; + size_t stop_decode_on_done_calls_ = 0; + + DecodingFn start_decoding_fn_; + DecodingFn resume_decoding_fn_; + + DecodeBuffer data_db_; + + bool sub_stop_decode_on_done_ = true; + bool override_stop_decode_on_done_ = true; +}; + +// Decode a single byte on the StartDecoding call, then stop. +TEST_F(RandomDecoderTestTest, StopOnStartPartiallyDone) { + start_decoding_fn_ = [this](DecodeBuffer* db) { + EXPECT_EQ(1u, start_decoding_calls_); + // Make sure the correct buffer is being used. + EXPECT_EQ(kData, db->cursor()); + EXPECT_EQ(sizeof kData, db->Remaining()); + db->DecodeUInt8(); + return DecodeStatus::kDecodeDone; + }; + + EXPECT_EQ(DecodeStatus::kDecodeDone, + DecodeSegments(&data_db_, SelectRemaining())); + EXPECT_EQ(1u, data_db_.Offset()); + // StartDecoding should only be called once from each call to DecodeSegments. + EXPECT_EQ(1u, start_decoding_calls_); + EXPECT_EQ(0u, resume_decoding_calls_); + EXPECT_EQ(1u, stop_decode_on_done_calls_); +} + +// Stop decoding upon return from the first ResumeDecoding call. +TEST_F(RandomDecoderTestTest, StopOnResumePartiallyDone) { + start_decoding_fn_ = [this](DecodeBuffer* db) { + EXPECT_EQ(1u, start_decoding_calls_); + db->DecodeUInt8(); + return DecodeStatus::kDecodeInProgress; + }; + resume_decoding_fn_ = [this](DecodeBuffer* db) { + EXPECT_EQ(1u, resume_decoding_calls_); + // Make sure the correct buffer is being used. + EXPECT_EQ(data_db_.cursor(), db->cursor()); + db->DecodeUInt16(); + return DecodeStatus::kDecodeDone; + }; + + // Check that the base class honors it's member variable stop_decode_on_done_. + override_stop_decode_on_done_ = false; + stop_decode_on_done_ = true; + + EXPECT_EQ(DecodeStatus::kDecodeDone, + DecodeSegments(&data_db_, SelectRemaining())); + EXPECT_EQ(3u, data_db_.Offset()); + EXPECT_EQ(1u, start_decoding_calls_); + EXPECT_EQ(1u, resume_decoding_calls_); + EXPECT_EQ(1u, stop_decode_on_done_calls_); +} + +// Decode a random sized chunks, always reporting back kDecodeInProgress. +TEST_F(RandomDecoderTestTest, InProgressWhenEmpty) { + start_decoding_fn_ = [this](DecodeBuffer* db) { + EXPECT_EQ(1u, start_decoding_calls_); + // Consume up to 2 bytes. + if (db->HasData()) { + db->DecodeUInt8(); + if (db->HasData()) { + db->DecodeUInt8(); + } + } + return DecodeStatus::kDecodeInProgress; + }; + resume_decoding_fn_ = [](DecodeBuffer* db) { + // Consume all available bytes. + if (db->HasData()) { + db->AdvanceCursor(db->Remaining()); + } + return DecodeStatus::kDecodeInProgress; + }; + + EXPECT_EQ(DecodeStatus::kDecodeInProgress, + DecodeSegments(&data_db_, SelectRandom(kMayReturnZeroOnFirst))); + EXPECT_TRUE(data_db_.Empty()); + EXPECT_EQ(1u, start_decoding_calls_); + EXPECT_LE(1u, resume_decoding_calls_); + EXPECT_EQ(0u, stop_decode_on_done_calls_); +} + +TEST_F(RandomDecoderTestTest, DoneExactlyAtEnd) { + start_decoding_fn_ = [this](DecodeBuffer* db) { + EXPECT_EQ(1u, start_decoding_calls_); + EXPECT_EQ(1u, db->Remaining()); + EXPECT_EQ(1u, db->FullSize()); + db->DecodeUInt8(); + return DecodeStatus::kDecodeInProgress; + }; + resume_decoding_fn_ = [this](DecodeBuffer* db) { + EXPECT_EQ(1u, db->Remaining()); + EXPECT_EQ(1u, db->FullSize()); + db->DecodeUInt8(); + if (data_db_.Remaining() == 1) { + return DecodeStatus::kDecodeDone; + } + return DecodeStatus::kDecodeInProgress; + }; + override_stop_decode_on_done_ = true; + sub_stop_decode_on_done_ = true; + + EXPECT_EQ(DecodeStatus::kDecodeDone, DecodeSegments(&data_db_, SelectOne())); + EXPECT_EQ(0u, data_db_.Remaining()); + EXPECT_EQ(1u, start_decoding_calls_); + EXPECT_EQ((sizeof kData) - 1, resume_decoding_calls_); + // Didn't need to call StopDecodeOnDone because we didn't finish early. + EXPECT_EQ(0u, stop_decode_on_done_calls_); +} + +TEST_F(RandomDecoderTestTest, DecodeSeveralWaysToEnd) { + // Each call to StartDecoding or ResumeDecoding will consume all that is + // available. When all the data has been consumed, returns kDecodeDone. + size_t decoded_since_start = 0; + auto shared_fn = [&decoded_since_start, this](DecodeBuffer* db) { + decoded_since_start += db->Remaining(); + db->AdvanceCursor(db->Remaining()); + EXPECT_EQ(0u, db->Remaining()); + if (decoded_since_start == data_db_.FullSize()) { + return DecodeStatus::kDecodeDone; + } + return DecodeStatus::kDecodeInProgress; + }; + + start_decoding_fn_ = [&decoded_since_start, shared_fn](DecodeBuffer* db) { + decoded_since_start = 0; + return shared_fn(db); + }; + resume_decoding_fn_ = shared_fn; + + Validator validator = ValidateDoneAndEmpty(); + + EXPECT_TRUE(DecodeAndValidateSeveralWays(&data_db_, kMayReturnZeroOnFirst, + validator)); + + // We should have reached the end. + EXPECT_EQ(0u, data_db_.Remaining()); + + // We currently have 4 ways of decoding; update this if that changes. + EXPECT_EQ(4u, start_decoding_calls_); + + // Didn't need to call StopDecodeOnDone because we didn't finish early. + EXPECT_EQ(0u, stop_decode_on_done_calls_); +} + +TEST_F(RandomDecoderTestTest, DecodeTwoWaysAndStopEarly) { + // On the second decode, return kDecodeDone before finishing. + size_t decoded_since_start = 0; + auto shared_fn = [&decoded_since_start, this](DecodeBuffer* db) { + uint32_t amount = db->Remaining(); + if (start_decoding_calls_ == 2 && amount > 1) { + amount = 1; + } + decoded_since_start += amount; + db->AdvanceCursor(amount); + if (decoded_since_start == data_db_.FullSize()) { + return DecodeStatus::kDecodeDone; + } + if (decoded_since_start > 1 && start_decoding_calls_ == 2) { + return DecodeStatus::kDecodeDone; + } + return DecodeStatus::kDecodeInProgress; + }; + + start_decoding_fn_ = [&decoded_since_start, shared_fn](DecodeBuffer* db) { + decoded_since_start = 0; + return shared_fn(db); + }; + resume_decoding_fn_ = shared_fn; + + // We expect the first and second to succeed, but the second to end at a + // different offset, which DecodeAndValidateSeveralWays should complain about. + Validator validator = [this](const DecodeBuffer& /*input*/, + DecodeStatus status) -> AssertionResult { + if (start_decoding_calls_ <= 2 && status != DecodeStatus::kDecodeDone) { + return ::testing::AssertionFailure() + << "Expected DecodeStatus::kDecodeDone, not " << status; + } + if (start_decoding_calls_ > 2) { + return ::testing::AssertionFailure() + << "How did we get to pass " << start_decoding_calls_; + } + return ::testing::AssertionSuccess(); + }; + + EXPECT_FALSE(DecodeAndValidateSeveralWays(&data_db_, kMayReturnZeroOnFirst, + validator)); + EXPECT_EQ(2u, start_decoding_calls_); + EXPECT_EQ(1u, stop_decode_on_done_calls_); +} + +TEST_F(RandomDecoderTestTest, DecodeThreeWaysAndError) { + // Return kDecodeError from ResumeDecoding on the third decoding pass. + size_t decoded_since_start = 0; + auto shared_fn = [&decoded_since_start, this](DecodeBuffer* db) { + if (start_decoding_calls_ == 3 && decoded_since_start > 0) { + return DecodeStatus::kDecodeError; + } + uint32_t amount = db->Remaining(); + if (start_decoding_calls_ == 3 && amount > 1) { + amount = 1; + } + decoded_since_start += amount; + db->AdvanceCursor(amount); + if (decoded_since_start == data_db_.FullSize()) { + return DecodeStatus::kDecodeDone; + } + return DecodeStatus::kDecodeInProgress; + }; + + start_decoding_fn_ = [&decoded_since_start, shared_fn](DecodeBuffer* db) { + decoded_since_start = 0; + return shared_fn(db); + }; + resume_decoding_fn_ = shared_fn; + + Validator validator = ValidateDoneAndEmpty(); + EXPECT_FALSE(DecodeAndValidateSeveralWays(&data_db_, kReturnNonZeroOnFirst, + validator)); + EXPECT_EQ(3u, start_decoding_calls_); + EXPECT_EQ(0u, stop_decode_on_done_calls_); +} + +// CorruptEnum should produce lots of different values. On the assumption that +// the enum gets at least a byte of storage, we should be able to produce +// 256 distinct values. +TEST(CorruptEnumTest, ManyValues) { + std::set<uint64_t> values; + DecodeStatus status; + QUICHE_LOG(INFO) << "sizeof status = " << sizeof status; + Http2Random rng; + for (int ndx = 0; ndx < 256; ++ndx) { + CorruptEnum(&status, &rng); + values.insert(static_cast<uint64_t>(status)); + } +} + +// In practice the underlying type is an int, and currently that is 4 bytes. +typedef typename std::underlying_type<DecodeStatus>::type DecodeStatusUT; + +struct CorruptEnumTestStruct { + DecodeStatusUT filler1; + DecodeStatus status; + DecodeStatusUT filler2; +}; + +// CorruptEnum should only overwrite the enum, not any adjacent storage. +TEST(CorruptEnumTest, CorruptsOnlyEnum) { + Http2Random rng; + for (const DecodeStatusUT filler : {DecodeStatusUT(), ~DecodeStatusUT()}) { + QUICHE_LOG(INFO) << "filler=0x" << std::hex << filler; + CorruptEnumTestStruct s; + s.filler1 = filler; + s.filler2 = filler; + for (int ndx = 0; ndx < 256; ++ndx) { + CorruptEnum(&s.status, &rng); + EXPECT_EQ(s.filler1, filler); + EXPECT_EQ(s.filler2, filler); + } + } +} + +} // namespace +} // namespace test +} // namespace http2
diff --git a/quiche/http2/tools/random_util.cc b/quiche/http2/test_tools/random_util.cc similarity index 96% rename from quiche/http2/tools/random_util.cc rename to quiche/http2/test_tools/random_util.cc index 00550b2..cf171bb 100644 --- a/quiche/http2/tools/random_util.cc +++ b/quiche/http2/test_tools/random_util.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "quiche/http2/tools/random_util.h" +#include "quiche/http2/test_tools/random_util.h" #include <cmath>
diff --git a/quiche/http2/tools/random_util.h b/quiche/http2/test_tools/random_util.h similarity index 84% rename from quiche/http2/tools/random_util.h rename to quiche/http2/test_tools/random_util.h index abc404d..ea4cea3 100644 --- a/quiche/http2/tools/random_util.h +++ b/quiche/http2/test_tools/random_util.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef QUICHE_HTTP2_TOOLS_RANDOM_UTIL_H_ -#define QUICHE_HTTP2_TOOLS_RANDOM_UTIL_H_ +#ifndef QUICHE_HTTP2_TEST_TOOLS_RANDOM_UTIL_H_ +#define QUICHE_HTTP2_TEST_TOOLS_RANDOM_UTIL_H_ #include <stddef.h> @@ -27,4 +27,4 @@ } // namespace test } // namespace http2 -#endif // QUICHE_HTTP2_TOOLS_RANDOM_UTIL_H_ +#endif // QUICHE_HTTP2_TEST_TOOLS_RANDOM_UTIL_H_