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

Unified Diff: net/http2/hpack/decoder/hpack_entry_type_decoder_test.cc

Issue 2554683003: Revert of Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Created 4 years 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: net/http2/hpack/decoder/hpack_entry_type_decoder_test.cc
diff --git a/net/http2/hpack/decoder/hpack_entry_type_decoder_test.cc b/net/http2/hpack/decoder/hpack_entry_type_decoder_test.cc
deleted file mode 100644
index 0abf0c980a64114618d9d6215f49dda363937323..0000000000000000000000000000000000000000
--- a/net/http2/hpack/decoder/hpack_entry_type_decoder_test.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// 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 "net/http2/hpack/decoder/hpack_entry_type_decoder.h"
-
-#include <vector>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/logging.h"
-#include "net/http2/hpack/tools/hpack_block_builder.h"
-#include "net/http2/tools/failure.h"
-#include "net/http2/tools/random_decoder_test.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using ::testing::AssertionFailure;
-using ::testing::AssertionResult;
-using ::testing::AssertionSuccess;
-
-namespace net {
-namespace test {
-namespace {
-const bool kReturnNonZeroOnFirst = true;
-
-class HpackEntryTypeDecoderTest : public RandomDecoderTest {
- public:
- AssertionResult ValidatorForDynamicTableSizeUpdate(uint32_t size) {
- VERIFY_EQ(HpackEntryType::kDynamicTableSizeUpdate, decoder_.entry_type());
- VERIFY_EQ(size, decoder_.varint());
- return AssertionSuccess();
- }
-
- AssertionResult ValidatorForHeaderWithIndex(const HpackEntryType entry_type,
- uint32_t index) {
- VERIFY_EQ(entry_type, decoder_.entry_type());
- VERIFY_EQ(index, decoder_.varint());
- return AssertionSuccess();
- }
-
- protected:
- DecodeStatus StartDecoding(DecodeBuffer* b) override {
- CHECK_LT(0u, b->Remaining());
- return decoder_.Start(b);
- }
-
- DecodeStatus ResumeDecoding(DecodeBuffer* b) override {
- return decoder_.Resume(b);
- }
-
- HpackEntryTypeDecoder decoder_;
-};
-
-TEST_F(HpackEntryTypeDecoderTest, DynamicTableSizeUpdate) {
- for (uint32_t size = 0; size < 1000 * 1000; size += 256) {
- HpackBlockBuilder bb;
- bb.AppendDynamicTableSizeUpdate(size);
- DecodeBuffer db(bb.buffer());
- NoArgValidator validator = base::Bind(
- &HpackEntryTypeDecoderTest::ValidatorForDynamicTableSizeUpdate,
- base::Unretained(this), size);
- EXPECT_TRUE(DecodeAndValidateSeveralWays(&db, kReturnNonZeroOnFirst,
- ValidateDoneAndEmpty(validator)))
- << "\nentry_type=kDynamicTableSizeUpdate, size=" << size;
- // Run the validator again to make sure that DecodeAndValidateSeveralWays
- // did the right thing.
- EXPECT_TRUE(validator.Run());
- }
-}
-
-TEST_F(HpackEntryTypeDecoderTest, HeaderWithIndex) {
- std::vector<HpackEntryType> entry_types = {
- HpackEntryType::kIndexedHeader, HpackEntryType::kIndexedLiteralHeader,
- HpackEntryType::kUnindexedLiteralHeader,
- HpackEntryType::kNeverIndexedLiteralHeader,
- };
- for (const HpackEntryType entry_type : entry_types) {
- const uint32_t first = entry_type == HpackEntryType::kIndexedHeader ? 1 : 0;
- for (uint32_t index = first; index < 1000; ++index) {
- HpackBlockBuilder bb;
- bb.AppendEntryTypeAndVarint(entry_type, index);
- DecodeBuffer db(bb.buffer());
- NoArgValidator validator =
- base::Bind(&HpackEntryTypeDecoderTest::ValidatorForHeaderWithIndex,
- base::Unretained(this), entry_type, index);
- EXPECT_TRUE(DecodeAndValidateSeveralWays(&db, kReturnNonZeroOnFirst,
- ValidateDoneAndEmpty(validator)))
- << "\nentry_type=" << entry_type << ", index=" << index;
- // Run the validator again to make sure that DecodeAndValidateSeveralWays
- // did the right thing.
- EXPECT_TRUE(validator.Run());
- }
- }
-}
-
-} // namespace
-} // namespace test
-} // namespace net
« no previous file with comments | « net/http2/hpack/decoder/hpack_entry_type_decoder.cc ('k') | net/http2/hpack/decoder/hpack_string_collector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698