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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 net::HostPortPair host_port_pair_; | 327 net::HostPortPair host_port_pair_; |
328 net::HostPortProxyPair host_port_proxy_pair_; | 328 net::HostPortProxyPair host_port_proxy_pair_; |
329 }; | 329 }; |
330 } // namespace | 330 } // namespace |
331 | 331 |
332 namespace net { | 332 namespace net { |
333 | 333 |
334 class WebSocketJobSpdy3Test : public PlatformTest { | 334 class WebSocketJobSpdy3Test : public PlatformTest { |
335 public: | 335 public: |
336 virtual void SetUp() { | 336 virtual void SetUp() { |
337 SpdySession::set_default_protocol(kProtoSPDY3); | |
338 stream_type_ = STREAM_INVALID; | 337 stream_type_ = STREAM_INVALID; |
339 cookie_store_ = new MockCookieStore; | 338 cookie_store_ = new MockCookieStore; |
340 context_.reset(new MockURLRequestContext(cookie_store_.get())); | 339 context_.reset(new MockURLRequestContext(cookie_store_.get())); |
341 } | 340 } |
342 virtual void TearDown() { | 341 virtual void TearDown() { |
343 cookie_store_ = NULL; | 342 cookie_store_ = NULL; |
344 context_.reset(); | 343 context_.reset(); |
345 websocket_ = NULL; | 344 websocket_ = NULL; |
346 socket_ = NULL; | 345 socket_ = NULL; |
347 } | 346 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 static const char kDataWorld[]; | 474 static const char kDataWorld[]; |
476 static const char* const kHandshakeRequestForSpdy[]; | 475 static const char* const kHandshakeRequestForSpdy[]; |
477 static const char* const kHandshakeResponseForSpdy[]; | 476 static const char* const kHandshakeResponseForSpdy[]; |
478 static const size_t kHandshakeRequestWithoutCookieLength; | 477 static const size_t kHandshakeRequestWithoutCookieLength; |
479 static const size_t kHandshakeRequestWithCookieLength; | 478 static const size_t kHandshakeRequestWithCookieLength; |
480 static const size_t kHandshakeRequestWithFilteredCookieLength; | 479 static const size_t kHandshakeRequestWithFilteredCookieLength; |
481 static const size_t kHandshakeResponseWithoutCookieLength; | 480 static const size_t kHandshakeResponseWithoutCookieLength; |
482 static const size_t kHandshakeResponseWithCookieLength; | 481 static const size_t kHandshakeResponseWithCookieLength; |
483 static const size_t kDataHelloLength; | 482 static const size_t kDataHelloLength; |
484 static const size_t kDataWorldLength; | 483 static const size_t kDataWorldLength; |
485 | |
486 private: | |
487 SpdyTestStateHelper spdy_state_; | |
488 }; | 484 }; |
489 | 485 |
490 const char WebSocketJobSpdy3Test::kHandshakeRequestWithoutCookie[] = | 486 const char WebSocketJobSpdy3Test::kHandshakeRequestWithoutCookie[] = |
491 "GET /demo HTTP/1.1\r\n" | 487 "GET /demo HTTP/1.1\r\n" |
492 "Host: example.com\r\n" | 488 "Host: example.com\r\n" |
493 "Upgrade: WebSocket\r\n" | 489 "Upgrade: WebSocket\r\n" |
494 "Connection: Upgrade\r\n" | 490 "Connection: Upgrade\r\n" |
495 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" | 491 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" |
496 "Origin: http://example.com\r\n" | 492 "Origin: http://example.com\r\n" |
497 "Sec-WebSocket-Protocol: sample\r\n" | 493 "Sec-WebSocket-Protocol: sample\r\n" |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 | 1087 |
1092 TEST_F(WebSocketJobSpdy3Test, ThrottlingSpdySpdyEnabled) { | 1088 TEST_F(WebSocketJobSpdy3Test, ThrottlingSpdySpdyEnabled) { |
1093 WebSocketJob::set_websocket_over_spdy_enabled(true); | 1089 WebSocketJob::set_websocket_over_spdy_enabled(true); |
1094 TestConnectBySpdy(SPDY_ON, THROTTLING_ON); | 1090 TestConnectBySpdy(SPDY_ON, THROTTLING_ON); |
1095 } | 1091 } |
1096 | 1092 |
1097 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. | 1093 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. |
1098 // TODO(toyoshim,yutak): Add tests to verify closing handshake. | 1094 // TODO(toyoshim,yutak): Add tests to verify closing handshake. |
1099 | 1095 |
1100 } // namespace net | 1096 } // namespace net |
OLD | NEW |