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

Side by Side Diff: net/http2/hpack/decoder/hpack_string_collector.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_HTTP2_HPACK_DECODER_HPACK_STRING_COLLECTOR_H_
6 #define NET_HTTP2_HPACK_DECODER_HPACK_STRING_COLLECTOR_H_
7
8 // Supports tests of decoding HPACK strings.
9
10 #include <stddef.h>
11
12 #include <iosfwd>
13 #include <string>
14
15 #include "base/strings/string_piece.h"
16 #include "net/http2/hpack/decoder/hpack_string_decoder_listener.h"
17 #include "testing/gtest/include/gtest/gtest.h"
18
19 namespace net {
20 namespace test {
21
22 // Records the callbacks associated with a decoding a string; must
23 // call Clear() between decoding successive strings.
24 struct HpackStringCollector : public HpackStringDecoderListener {
25 enum CollectorState {
26 kGenesis,
27 kStarted,
28 kEnded,
29 };
30
31 HpackStringCollector();
32 HpackStringCollector(const std::string& str, bool huffman);
33
34 void Clear();
35 bool IsClear() const;
36 bool IsInProgress() const;
37 bool HasEnded() const;
38
39 void OnStringStart(bool huffman, size_t length) override;
40 void OnStringData(const char* data, size_t length) override;
41 void OnStringEnd() override;
42
43 ::testing::AssertionResult Collected(base::StringPiece str,
44 bool is_huffman_encoded) const;
45
46 std::string ToString() const;
47
48 std::string s;
49 size_t len;
50 bool huffman_encoded;
51 CollectorState state;
52 };
53
54 bool operator==(const HpackStringCollector& a, const HpackStringCollector& b);
55
56 bool operator!=(const HpackStringCollector& a, const HpackStringCollector& b);
57
58 std::ostream& operator<<(std::ostream& out, const HpackStringCollector& v);
59
60 } // namespace test
61 } // namespace net
62
63 #endif // NET_HTTP2_HPACK_DECODER_HPACK_STRING_COLLECTOR_H_
OLDNEW
« no previous file with comments | « net/http2/hpack/decoder/hpack_entry_type_decoder_test.cc ('k') | net/http2/hpack/decoder/hpack_string_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698