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 #include "net/websockets/websocket_job.h" | 5 #include "net/websockets/websocket_job.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 net::HostPortPair host_port_pair_; | 312 net::HostPortPair host_port_pair_; |
313 net::HostPortProxyPair host_port_proxy_pair_; | 313 net::HostPortProxyPair host_port_proxy_pair_; |
314 }; | 314 }; |
315 } // namespace | 315 } // namespace |
316 | 316 |
317 namespace net { | 317 namespace net { |
318 | 318 |
319 class WebSocketJobSpdy3Test : public PlatformTest { | 319 class WebSocketJobSpdy3Test : public PlatformTest { |
320 public: | 320 public: |
321 virtual void SetUp() { | 321 virtual void SetUp() { |
322 spdy::SpdyFramer::set_enable_compression_default(false); | |
323 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY3); | 322 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY3); |
324 stream_type_ = STREAM_INVALID; | 323 stream_type_ = STREAM_INVALID; |
325 cookie_store_ = new MockCookieStore; | 324 cookie_store_ = new MockCookieStore; |
326 context_ = new MockURLRequestContext(cookie_store_.get()); | 325 context_ = new MockURLRequestContext(cookie_store_.get()); |
327 } | 326 } |
328 virtual void TearDown() { | 327 virtual void TearDown() { |
329 cookie_store_ = NULL; | 328 cookie_store_ = NULL; |
330 context_ = NULL; | 329 context_ = NULL; |
331 websocket_ = NULL; | 330 websocket_ = NULL; |
332 socket_ = NULL; | 331 socket_ = NULL; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 static const char kDataWorld[]; | 467 static const char kDataWorld[]; |
469 static const char* const kHandshakeRequestForSpdy[]; | 468 static const char* const kHandshakeRequestForSpdy[]; |
470 static const char* const kHandshakeResponseForSpdy[]; | 469 static const char* const kHandshakeResponseForSpdy[]; |
471 static const size_t kHandshakeRequestWithoutCookieLength; | 470 static const size_t kHandshakeRequestWithoutCookieLength; |
472 static const size_t kHandshakeRequestWithCookieLength; | 471 static const size_t kHandshakeRequestWithCookieLength; |
473 static const size_t kHandshakeRequestWithFilteredCookieLength; | 472 static const size_t kHandshakeRequestWithFilteredCookieLength; |
474 static const size_t kHandshakeResponseWithoutCookieLength; | 473 static const size_t kHandshakeResponseWithoutCookieLength; |
475 static const size_t kHandshakeResponseWithCookieLength; | 474 static const size_t kHandshakeResponseWithCookieLength; |
476 static const size_t kDataHelloLength; | 475 static const size_t kDataHelloLength; |
477 static const size_t kDataWorldLength; | 476 static const size_t kDataWorldLength; |
| 477 |
| 478 private: |
| 479 SpdyTestStateHelper spdy_state_; |
478 }; | 480 }; |
479 | 481 |
480 const char WebSocketJobSpdy3Test::kHandshakeRequestWithoutCookie[] = | 482 const char WebSocketJobSpdy3Test::kHandshakeRequestWithoutCookie[] = |
481 "GET /demo HTTP/1.1\r\n" | 483 "GET /demo HTTP/1.1\r\n" |
482 "Host: example.com\r\n" | 484 "Host: example.com\r\n" |
483 "Connection: Upgrade\r\n" | 485 "Connection: Upgrade\r\n" |
484 "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" | 486 "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" |
485 "Sec-WebSocket-Protocol: sample\r\n" | 487 "Sec-WebSocket-Protocol: sample\r\n" |
486 "Upgrade: WebSocket\r\n" | 488 "Upgrade: WebSocket\r\n" |
487 "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" | 489 "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 | 1094 |
1093 TEST_F(WebSocketJobSpdy3Test, ThrottlingSpdySpdyEnabled) { | 1095 TEST_F(WebSocketJobSpdy3Test, ThrottlingSpdySpdyEnabled) { |
1094 WebSocketJob::set_websocket_over_spdy_enabled(true); | 1096 WebSocketJob::set_websocket_over_spdy_enabled(true); |
1095 TestConnectBySpdy(SPDY_ON, THROTTLING_ON); | 1097 TestConnectBySpdy(SPDY_ON, THROTTLING_ON); |
1096 } | 1098 } |
1097 | 1099 |
1098 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. | 1100 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. |
1099 // TODO(toyoshim,yutak): Add tests to verify closing handshake. | 1101 // TODO(toyoshim,yutak): Add tests to verify closing handshake. |
1100 | 1102 |
1101 } // namespace net | 1103 } // namespace net |
OLD | NEW |