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

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

Issue 9582034: Fork SPDY/2 and SPDY/3 versions of our SPDY tests, in preparation for landing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix merge bug Created 8 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_websocket_test_util.h ('k') | net/spdy/spdy_websocket_test_util_spdy2.h » ('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) 2011 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 #include "net/spdy/spdy_websocket_test_util.h"
6
7 #include "net/spdy/spdy_framer.h"
8 #include "net/spdy/spdy_http_utils.h"
9 #include "net/spdy/spdy_test_util.h"
10
11 static const int kDefaultAssociatedStreamId = 0;
12 static const bool kDefaultCompressed = false;
13 static const char* const kDefaultDataPointer = NULL;
14 static const uint32 kDefaultDataLength = 0;
15 static const char** const kDefaultExtraHeaders = NULL;
16 static const int kDefaultExtraHeaderCount = 0;
17
18 namespace net {
19
20 spdy::SpdyFrame* ConstructSpdyWebSocketHandshakeRequestFrame(
21 const char* const headers[],
22 int header_count,
23 spdy::SpdyStreamId stream_id,
24 RequestPriority request_priority) {
25
26 // SPDY SYN_STREAM control frame header.
27 const SpdyHeaderInfo kSynStreamHeader = {
28 spdy::SYN_STREAM,
29 stream_id,
30 kDefaultAssociatedStreamId,
31 ConvertRequestPriorityToSpdyPriority(request_priority),
32 spdy::CONTROL_FLAG_NONE,
33 kDefaultCompressed,
34 spdy::INVALID,
35 kDefaultDataPointer,
36 kDefaultDataLength,
37 spdy::DATA_FLAG_NONE
38 };
39
40 // Construct SPDY SYN_STREAM control frame.
41 return ConstructSpdyPacket(
42 kSynStreamHeader,
43 kDefaultExtraHeaders,
44 kDefaultExtraHeaderCount,
45 headers,
46 header_count);
47 }
48
49 spdy::SpdyFrame* ConstructSpdyWebSocketHandshakeResponseFrame(
50 const char* const headers[],
51 int header_count,
52 spdy::SpdyStreamId stream_id,
53 RequestPriority request_priority) {
54
55 // SPDY SYN_REPLY control frame header.
56 const SpdyHeaderInfo kSynReplyHeader = {
57 spdy::SYN_REPLY,
58 stream_id,
59 kDefaultAssociatedStreamId,
60 ConvertRequestPriorityToSpdyPriority(request_priority),
61 spdy::CONTROL_FLAG_NONE,
62 kDefaultCompressed,
63 spdy::INVALID,
64 kDefaultDataPointer,
65 kDefaultDataLength,
66 spdy::DATA_FLAG_NONE
67 };
68
69 // Construct SPDY SYN_REPLY control frame.
70 return ConstructSpdyPacket(
71 kSynReplyHeader,
72 kDefaultExtraHeaders,
73 kDefaultExtraHeaderCount,
74 headers,
75 header_count);
76 }
77
78 spdy::SpdyFrame* ConstructSpdyWebSocketDataFrame(
79 const char* data,
80 int len,
81 spdy::SpdyStreamId stream_id,
82 bool fin) {
83
84 // Construct SPDY data frame.
85 spdy::SpdyFramer framer;
86 return framer.CreateDataFrame(
87 stream_id,
88 data,
89 len,
90 fin ? spdy::DATA_FLAG_FIN : spdy::DATA_FLAG_NONE);
91 }
92
93 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_websocket_test_util.h ('k') | net/spdy/spdy_websocket_test_util_spdy2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698