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

Side by Side Diff: net/spdy/spdy_websocket_test_util.h

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/spdy/spdy_websocket_stream_unittest.cc ('k') | net/spdy/spdy_websocket_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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_SPDY_SPDY_WEBSOCKET_TEST_UTIL_H_
6 #define NET_SPDY_SPDY_WEBSOCKET_TEST_UTIL_H_
7
8 #include "net/base/request_priority.h"
9 #include "net/spdy/spdy_header_block.h"
10 #include "net/spdy/spdy_protocol.h"
11 #include "net/spdy/spdy_test_util_common.h"
12
13 namespace net {
14
15 class SpdyWebSocketTestUtil {
16 public:
17 explicit SpdyWebSocketTestUtil(NextProto protocol);
18
19 // Returns the value corresponding to the given key (passed through
20 // GetHeaderKey()), or the empty string if none exists.
21 std::string GetHeader(const SpdyHeaderBlock& headers,
22 const std::string& key) const;
23
24 // Adds the given key/value pair to |headers|, passing the key
25 // through GetHeaderKey().
26 void SetHeader(const std::string& key,
27 const std::string& value,
28 SpdyHeaderBlock* headers) const;
29
30 // Constructs a standard SPDY SYN_STREAM frame for WebSocket over
31 // SPDY opening handshake.
32 SpdyFrame* ConstructSpdyWebSocketSynStream(int stream_id,
33 const char* path,
34 const char* host,
35 const char* origin);
36
37 // Constructs a standard SPDY SYN_REPLY packet to match the
38 // WebSocket over SPDY opening handshake.
39 SpdyFrame* ConstructSpdyWebSocketSynReply(int stream_id);
40
41 // Constructs a WebSocket over SPDY handshake request packet.
42 SpdyFrame* ConstructSpdyWebSocketHandshakeRequestFrame(
43 scoped_ptr<SpdyHeaderBlock> headers,
44 SpdyStreamId stream_id,
45 RequestPriority request_priority);
46
47 // Constructs a WebSocket over SPDY handshake response packet.
48 SpdyFrame* ConstructSpdyWebSocketHandshakeResponseFrame(
49 scoped_ptr<SpdyHeaderBlock> headers,
50 SpdyStreamId stream_id,
51 RequestPriority request_priority);
52
53 // Constructs a SPDY HEADERS frame for a WebSocket frame over SPDY.
54 SpdyFrame* ConstructSpdyWebSocketHeadersFrame(int stream_id,
55 const char* length,
56 bool fin);
57
58 // Constructs a WebSocket over SPDY data packet.
59 SpdyFrame* ConstructSpdyWebSocketDataFrame(const char* data,
60 int len,
61 SpdyStreamId stream_id,
62 bool fin);
63
64 // Forwards to |spdy_util_|.
65 SpdyFrame* ConstructSpdySettings(const SettingsMap& settings) const;
66 SpdyFrame* ConstructSpdySettingsAck() const;
67 SpdyMajorVersion spdy_version() const;
68
69 private:
70 // Modify the header key based on the SPDY version and return it.
71 std::string GetHeaderKey(const std::string& key) const;
72
73 SpdyTestUtil spdy_util_;
74 };
75
76 } // namespace net
77
78 #endif // NET_SPDY_SPDY_WEBSOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_websocket_stream_unittest.cc ('k') | net/spdy/spdy_websocket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698