OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ | 5 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ |
6 #define NET_SPDY_SPDY_TEST_UTIL_H_ | 6 #define NET_SPDY_SPDY_TEST_UTIL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "net/base/cert_verifier.h" | 9 #include "net/base/cert_verifier.h" |
10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 bool compressed, | 221 bool compressed, |
222 int stream_id, | 222 int stream_id, |
223 RequestPriority request_priority, | 223 RequestPriority request_priority, |
224 bool direct); | 224 bool direct); |
225 | 225 |
226 // Constructs a standard SPDY SYN_STREAM frame for a CONNECT request. | 226 // Constructs a standard SPDY SYN_STREAM frame for a CONNECT request. |
227 SpdyFrame* ConstructSpdyConnect(const char* const extra_headers[], | 227 SpdyFrame* ConstructSpdyConnect(const char* const extra_headers[], |
228 int extra_header_count, | 228 int extra_header_count, |
229 int stream_id); | 229 int stream_id); |
230 | 230 |
231 // Constructs a standard SPDY SYN_STREAM frame for WebSocket over SPDY | |
232 // opening handshake. | |
233 SpdyFrame* ConstructSpdyWebSocket(int stream_id, | |
234 const char* path, | |
235 const char* host, | |
236 const char* origin); | |
237 | |
238 // Constructs a standard SPDY push SYN packet. | 231 // Constructs a standard SPDY push SYN packet. |
239 // |extra_headers| are the extra header-value pairs, which typically | 232 // |extra_headers| are the extra header-value pairs, which typically |
240 // will vary the most between calls. | 233 // will vary the most between calls. |
241 // Returns a SpdyFrame. | 234 // Returns a SpdyFrame. |
242 SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], | 235 SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], |
243 int extra_header_count, | 236 int extra_header_count, |
244 int stream_id, | 237 int stream_id, |
245 int associated_stream_id); | 238 int associated_stream_id); |
246 SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], | 239 SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], |
247 int extra_header_count, | 240 int extra_header_count, |
(...skipping 22 matching lines...) Expand all Loading... |
270 SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], | 263 SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], |
271 int extra_header_count, | 264 int extra_header_count, |
272 int stream_id); | 265 int stream_id); |
273 | 266 |
274 // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. | 267 // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. |
275 // |extra_headers| are the extra header-value pairs, which typically | 268 // |extra_headers| are the extra header-value pairs, which typically |
276 // will vary the most between calls. | 269 // will vary the most between calls. |
277 // Returns a SpdyFrame. | 270 // Returns a SpdyFrame. |
278 SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); | 271 SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); |
279 | 272 |
280 // Constructs a standard SPDY SYN_REPLY packet to match the WebSocket over SPDY | |
281 // opening handshake. | |
282 // Returns a SpdyFrame. | |
283 SpdyFrame* ConstructSpdyWebSocketSynReply(int stream_id); | |
284 | |
285 // Constructs a standard SPDY SYN_REPLY packet with an Internal Server | 273 // Constructs a standard SPDY SYN_REPLY packet with an Internal Server |
286 // Error status code. | 274 // Error status code. |
287 // Returns a SpdyFrame. | 275 // Returns a SpdyFrame. |
288 SpdyFrame* ConstructSpdySynReplyError(int stream_id); | 276 SpdyFrame* ConstructSpdySynReplyError(int stream_id); |
289 | 277 |
290 // Constructs a standard SPDY SYN_REPLY packet with the specified status code. | 278 // Constructs a standard SPDY SYN_REPLY packet with the specified status code. |
291 // Returns a SpdyFrame. | 279 // Returns a SpdyFrame. |
292 SpdyFrame* ConstructSpdySynReplyError(const char* const status, | 280 SpdyFrame* ConstructSpdySynReplyError(const char* const status, |
293 const char* const* const extra_headers, | 281 const char* const* const extra_headers, |
294 int extra_header_count, | 282 int extra_header_count, |
(...skipping 22 matching lines...) Expand all Loading... |
317 int extra_header_count); | 305 int extra_header_count); |
318 | 306 |
319 // Constructs a single SPDY data frame with the contents "hello!" | 307 // Constructs a single SPDY data frame with the contents "hello!" |
320 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, | 308 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, |
321 bool fin); | 309 bool fin); |
322 | 310 |
323 // Constructs a single SPDY data frame with the given content. | 311 // Constructs a single SPDY data frame with the given content. |
324 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, | 312 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, |
325 uint32 len, bool fin); | 313 uint32 len, bool fin); |
326 | 314 |
327 // Constructs a SPDY HEADERS frame for a WebSocket frame over SPDY. | |
328 SpdyFrame* ConstructSpdyWebSocketHeadersFrame(int stream_id, | |
329 const char* length, | |
330 bool fin); | |
331 | |
332 // Wraps |frame| in the payload of a data frame in stream |stream_id|. | 315 // Wraps |frame| in the payload of a data frame in stream |stream_id|. |
333 SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, | 316 SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, |
334 int stream_id); | 317 int stream_id); |
335 | 318 |
336 // Create an async MockWrite from the given SpdyFrame. | 319 // Create an async MockWrite from the given SpdyFrame. |
337 MockWrite CreateMockWrite(const SpdyFrame& req); | 320 MockWrite CreateMockWrite(const SpdyFrame& req); |
338 | 321 |
339 // Create an async MockWrite from the given SpdyFrame and sequence number. | 322 // Create an async MockWrite from the given SpdyFrame and sequence number. |
340 MockWrite CreateMockWrite(const SpdyFrame& req, int seq); | 323 MockWrite CreateMockWrite(const SpdyFrame& req, int seq); |
341 | 324 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 419 |
437 private: | 420 private: |
438 DISALLOW_COPY_AND_ASSIGN(SpdyTestStateHelper); | 421 DISALLOW_COPY_AND_ASSIGN(SpdyTestStateHelper); |
439 }; | 422 }; |
440 | 423 |
441 } // namespace test_spdy2 | 424 } // namespace test_spdy2 |
442 | 425 |
443 } // namespace net | 426 } // namespace net |
444 | 427 |
445 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ | 428 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ |
OLD | NEW |