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