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

Side by Side Diff: net/spdy/spdy_websocket_stream_spdy2_unittest.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_stream.h ('k') | net/spdy/spdy_websocket_stream_spdy3_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/spdy/spdy_websocket_stream.h" 5 #include "net/spdy/spdy_websocket_stream.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"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
13 #include "net/proxy/proxy_server.h" 13 #include "net/proxy/proxy_server.h"
14 #include "net/spdy/spdy_http_utils.h" 14 #include "net/spdy/spdy_http_utils.h"
15 #include "net/spdy/spdy_protocol.h" 15 #include "net/spdy/spdy_protocol.h"
16 #include "net/spdy/spdy_session.h" 16 #include "net/spdy/spdy_session.h"
17 #include "net/spdy/spdy_test_util.h" 17 #include "net/spdy/spdy_test_util_spdy2.h"
18 #include "net/spdy/spdy_websocket_test_util.h" 18 #include "net/spdy/spdy_websocket_test_util_spdy2.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 using namespace net::test_spdy2;
22
21 namespace { 23 namespace {
22 24
23 struct SpdyWebSocketStreamEvent { 25 struct SpdyWebSocketStreamEvent {
24 enum EventType { 26 enum EventType {
25 EVENT_CREATED, 27 EVENT_CREATED,
26 EVENT_SENT_HEADERS, 28 EVENT_SENT_HEADERS,
27 EVENT_RECEIVED_HEADER, 29 EVENT_RECEIVED_HEADER,
28 EVENT_SENT_DATA, 30 EVENT_SENT_DATA,
29 EVENT_RECEIVED_DATA, 31 EVENT_RECEIVED_DATA,
30 EVENT_CLOSE, 32 EVENT_CLOSE,
(...skipping 10 matching lines...) Expand all
41 EventType event_type; 43 EventType event_type;
42 spdy::SpdyHeaderBlock headers; 44 spdy::SpdyHeaderBlock headers;
43 int result; 45 int result;
44 std::string data; 46 std::string data;
45 }; 47 };
46 48
47 } // namespace 49 } // namespace
48 50
49 namespace net { 51 namespace net {
50 52
53 namespace {
54
51 class SpdyWebSocketStreamEventRecorder : public SpdyWebSocketStream::Delegate { 55 class SpdyWebSocketStreamEventRecorder : public SpdyWebSocketStream::Delegate {
52 public: 56 public:
53 explicit SpdyWebSocketStreamEventRecorder(const CompletionCallback& callback) 57 explicit SpdyWebSocketStreamEventRecorder(const CompletionCallback& callback)
54 : callback_(callback) {} 58 : callback_(callback) {}
55 virtual ~SpdyWebSocketStreamEventRecorder() {} 59 virtual ~SpdyWebSocketStreamEventRecorder() {}
56 60
57 typedef base::Callback<void(SpdyWebSocketStreamEvent*)> StreamEventCallback; 61 typedef base::Callback<void(SpdyWebSocketStreamEvent*)> StreamEventCallback;
58 62
59 void SetOnCreated(const StreamEventCallback& callback) { 63 void SetOnCreated(const StreamEventCallback& callback) {
60 on_created_ = callback; 64 on_created_ = callback;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 StreamEventCallback on_sent_headers_; 154 StreamEventCallback on_sent_headers_;
151 StreamEventCallback on_received_header_; 155 StreamEventCallback on_received_header_;
152 StreamEventCallback on_sent_data_; 156 StreamEventCallback on_sent_data_;
153 StreamEventCallback on_received_data_; 157 StreamEventCallback on_received_data_;
154 StreamEventCallback on_close_; 158 StreamEventCallback on_close_;
155 CompletionCallback callback_; 159 CompletionCallback callback_;
156 160
157 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStreamEventRecorder); 161 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStreamEventRecorder);
158 }; 162 };
159 163
160 class SpdyWebSocketStreamTest : public testing::Test { 164 } // namespace
165
166 class SpdyWebSocketStreamSpdy2Test : public testing::Test {
161 public: 167 public:
162 OrderedSocketData* data() { return data_.get(); } 168 OrderedSocketData* data() { return data_.get(); }
163 169
164 void DoSendHelloFrame(SpdyWebSocketStreamEvent* event) { 170 void DoSendHelloFrame(SpdyWebSocketStreamEvent* event) {
165 websocket_stream_->SendData(kMessageFrame, kMessageFrameLength); 171 websocket_stream_->SendData(kMessageFrame, kMessageFrameLength);
166 } 172 }
167 173
168 void DoSendClosingFrame(SpdyWebSocketStreamEvent* event) { 174 void DoSendClosingFrame(SpdyWebSocketStreamEvent* event) {
169 websocket_stream_->SendData(kClosingFrame, kClosingFrameLength); 175 websocket_stream_->SendData(kClosingFrame, kClosingFrameLength);
170 } 176 }
171 177
172 void DoClose(SpdyWebSocketStreamEvent* event) { 178 void DoClose(SpdyWebSocketStreamEvent* event) {
173 websocket_stream_->Close(); 179 websocket_stream_->Close();
174 } 180 }
175 181
176 void DoSync(SpdyWebSocketStreamEvent* event) { 182 void DoSync(SpdyWebSocketStreamEvent* event) {
177 sync_callback_.SetResult(OK); 183 sync_callback_.SetResult(OK);
178 } 184 }
179 185
180 protected: 186 protected:
181 SpdyWebSocketStreamTest() {} 187 SpdyWebSocketStreamSpdy2Test() {}
182 virtual ~SpdyWebSocketStreamTest() {} 188 virtual ~SpdyWebSocketStreamSpdy2Test() {}
183 189
184 virtual void SetUp() { 190 virtual void SetUp() {
185 EnableCompression(false); 191 EnableCompression(false);
186 SpdySession::SetSSLMode(false); 192 SpdySession::SetSSLMode(false);
187 193
188 host_port_pair_.set_host("example.com"); 194 host_port_pair_.set_host("example.com");
189 host_port_pair_.set_port(80); 195 host_port_pair_.set_port(80);
190 host_port_proxy_pair_.first = host_port_pair_; 196 host_port_proxy_pair_.first = host_port_pair_;
191 host_port_proxy_pair_.second = ProxyServer::Direct(); 197 host_port_proxy_pair_.second = ProxyServer::Direct();
192 198
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 HostPortProxyPair host_port_proxy_pair_; 310 HostPortProxyPair host_port_proxy_pair_;
305 TestCompletionCallback completion_callback_; 311 TestCompletionCallback completion_callback_;
306 TestCompletionCallback sync_callback_; 312 TestCompletionCallback sync_callback_;
307 313
308 static const char kMessageFrame[]; 314 static const char kMessageFrame[];
309 static const char kClosingFrame[]; 315 static const char kClosingFrame[];
310 static const size_t kMessageFrameLength; 316 static const size_t kMessageFrameLength;
311 static const size_t kClosingFrameLength; 317 static const size_t kClosingFrameLength;
312 }; 318 };
313 319
314 const char SpdyWebSocketStreamTest::kMessageFrame[] = "\0hello\xff"; 320 const char SpdyWebSocketStreamSpdy2Test::kMessageFrame[] = "\0hello\xff";
315 const char SpdyWebSocketStreamTest::kClosingFrame[] = "\xff\0"; 321 const char SpdyWebSocketStreamSpdy2Test::kClosingFrame[] = "\xff\0";
316 const size_t SpdyWebSocketStreamTest::kMessageFrameLength = 322 const size_t SpdyWebSocketStreamSpdy2Test::kMessageFrameLength =
317 arraysize(SpdyWebSocketStreamTest::kMessageFrame) - 1; 323 arraysize(SpdyWebSocketStreamSpdy2Test::kMessageFrame) - 1;
318 const size_t SpdyWebSocketStreamTest::kClosingFrameLength = 324 const size_t SpdyWebSocketStreamSpdy2Test::kClosingFrameLength =
319 arraysize(SpdyWebSocketStreamTest::kClosingFrame) - 1; 325 arraysize(SpdyWebSocketStreamSpdy2Test::kClosingFrame) - 1;
320 326
321 TEST_F(SpdyWebSocketStreamTest, Basic) { 327 TEST_F(SpdyWebSocketStreamSpdy2Test, Basic) {
322 Prepare(1); 328 Prepare(1);
323 MockWrite writes[] = { 329 MockWrite writes[] = {
324 CreateMockWrite(*request_frame_.get(), 1), 330 CreateMockWrite(*request_frame_.get(), 1),
325 CreateMockWrite(*message_frame_.get(), 3), 331 CreateMockWrite(*message_frame_.get(), 3),
326 CreateMockWrite(*closing_frame_.get(), 5) 332 CreateMockWrite(*closing_frame_.get(), 5)
327 }; 333 };
328 334
329 MockRead reads[] = { 335 MockRead reads[] = {
330 CreateMockRead(*response_frame_.get(), 2), 336 CreateMockRead(*response_frame_.get(), 2),
331 CreateMockRead(*message_frame_.get(), 4), 337 CreateMockRead(*message_frame_.get(), 4),
332 // Skip sequence 6 to notify closing has been sent. 338 // Skip sequence 6 to notify closing has been sent.
333 CreateMockRead(*closing_frame_.get(), 7), 339 CreateMockRead(*closing_frame_.get(), 7),
334 MockRead(SYNCHRONOUS, 0, 8) // EOF cause OnCloseSpdyStream event. 340 MockRead(SYNCHRONOUS, 0, 8) // EOF cause OnCloseSpdyStream event.
335 }; 341 };
336 342
337 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), 343 EXPECT_EQ(OK, InitSession(reads, arraysize(reads),
338 writes, arraysize(writes), false)); 344 writes, arraysize(writes), false));
339 345
340 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 346 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
341 delegate.SetOnReceivedHeader( 347 delegate.SetOnReceivedHeader(
342 base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, 348 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
343 base::Unretained(this))); 349 base::Unretained(this)));
344 delegate.SetOnReceivedData( 350 delegate.SetOnReceivedData(
345 base::Bind(&SpdyWebSocketStreamTest::DoSendClosingFrame, 351 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame,
346 base::Unretained(this))); 352 base::Unretained(this)));
347 353
348 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 354 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate));
349 355
350 BoundNetLog net_log; 356 BoundNetLog net_log;
351 GURL url("ws://example.com/echo"); 357 GURL url("ws://example.com/echo");
352 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log)); 358 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log));
353 359
354 ASSERT_TRUE(websocket_stream_->stream_); 360 ASSERT_TRUE(websocket_stream_->stream_);
355 EXPECT_EQ(stream_id_, websocket_stream_->stream_->stream_id()); 361 EXPECT_EQ(stream_id_, websocket_stream_->stream_->stream_id());
(...skipping 30 matching lines...) Expand all
386 events[6].event_type); 392 events[6].event_type);
387 EXPECT_EQ(OK, events[6].result); 393 EXPECT_EQ(OK, events[6].result);
388 394
389 // EOF close SPDY session. 395 // EOF close SPDY session.
390 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( 396 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(
391 host_port_proxy_pair_)); 397 host_port_proxy_pair_));
392 EXPECT_TRUE(data()->at_read_eof()); 398 EXPECT_TRUE(data()->at_read_eof());
393 EXPECT_TRUE(data()->at_write_eof()); 399 EXPECT_TRUE(data()->at_write_eof());
394 } 400 }
395 401
396 TEST_F(SpdyWebSocketStreamTest, DestructionBeforeClose) { 402 TEST_F(SpdyWebSocketStreamSpdy2Test, DestructionBeforeClose) {
397 Prepare(1); 403 Prepare(1);
398 MockWrite writes[] = { 404 MockWrite writes[] = {
399 CreateMockWrite(*request_frame_.get(), 1), 405 CreateMockWrite(*request_frame_.get(), 1),
400 CreateMockWrite(*message_frame_.get(), 3) 406 CreateMockWrite(*message_frame_.get(), 3)
401 }; 407 };
402 408
403 MockRead reads[] = { 409 MockRead reads[] = {
404 CreateMockRead(*response_frame_.get(), 2), 410 CreateMockRead(*response_frame_.get(), 2),
405 CreateMockRead(*message_frame_.get(), 4), 411 CreateMockRead(*message_frame_.get(), 4),
406 MockRead(ASYNC, ERR_IO_PENDING, 5) 412 MockRead(ASYNC, ERR_IO_PENDING, 5)
407 }; 413 };
408 414
409 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), 415 EXPECT_EQ(OK, InitSession(reads, arraysize(reads),
410 writes, arraysize(writes), false)); 416 writes, arraysize(writes), false));
411 417
412 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 418 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
413 delegate.SetOnReceivedHeader( 419 delegate.SetOnReceivedHeader(
414 base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, 420 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
415 base::Unretained(this))); 421 base::Unretained(this)));
416 delegate.SetOnReceivedData( 422 delegate.SetOnReceivedData(
417 base::Bind(&SpdyWebSocketStreamTest::DoSync, base::Unretained(this))); 423 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync,
424 base::Unretained(this)));
418 425
419 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 426 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate));
420 427
421 BoundNetLog net_log; 428 BoundNetLog net_log;
422 GURL url("ws://example.com/echo"); 429 GURL url("ws://example.com/echo");
423 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log)); 430 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log));
424 431
425 SendRequest(); 432 SendRequest();
426 433
427 sync_callback_.WaitForResult(); 434 sync_callback_.WaitForResult();
(...skipping 19 matching lines...) Expand all
447 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_RECEIVED_DATA, 454 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_RECEIVED_DATA,
448 events[3].event_type); 455 events[3].event_type);
449 EXPECT_EQ(static_cast<int>(kMessageFrameLength), events[3].result); 456 EXPECT_EQ(static_cast<int>(kMessageFrameLength), events[3].result);
450 457
451 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession( 458 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(
452 host_port_proxy_pair_)); 459 host_port_proxy_pair_));
453 EXPECT_TRUE(data()->at_read_eof()); 460 EXPECT_TRUE(data()->at_read_eof());
454 EXPECT_TRUE(data()->at_write_eof()); 461 EXPECT_TRUE(data()->at_write_eof());
455 } 462 }
456 463
457 TEST_F(SpdyWebSocketStreamTest, DestructionAfterExplicitClose) { 464 TEST_F(SpdyWebSocketStreamSpdy2Test, DestructionAfterExplicitClose) {
458 Prepare(1); 465 Prepare(1);
459 MockWrite writes[] = { 466 MockWrite writes[] = {
460 CreateMockWrite(*request_frame_.get(), 1), 467 CreateMockWrite(*request_frame_.get(), 1),
461 CreateMockWrite(*message_frame_.get(), 3), 468 CreateMockWrite(*message_frame_.get(), 3),
462 CreateMockWrite(*closing_frame_.get(), 5) 469 CreateMockWrite(*closing_frame_.get(), 5)
463 }; 470 };
464 471
465 MockRead reads[] = { 472 MockRead reads[] = {
466 CreateMockRead(*response_frame_.get(), 2), 473 CreateMockRead(*response_frame_.get(), 2),
467 CreateMockRead(*message_frame_.get(), 4), 474 CreateMockRead(*message_frame_.get(), 4),
468 MockRead(ASYNC, ERR_IO_PENDING, 6) 475 MockRead(ASYNC, ERR_IO_PENDING, 6)
469 }; 476 };
470 477
471 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), 478 EXPECT_EQ(OK, InitSession(reads, arraysize(reads),
472 writes, arraysize(writes), false)); 479 writes, arraysize(writes), false));
473 480
474 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 481 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
475 delegate.SetOnReceivedHeader( 482 delegate.SetOnReceivedHeader(
476 base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, 483 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
477 base::Unretained(this))); 484 base::Unretained(this)));
478 delegate.SetOnReceivedData( 485 delegate.SetOnReceivedData(
479 base::Bind(&SpdyWebSocketStreamTest::DoClose, base::Unretained(this))); 486 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoClose,
487 base::Unretained(this)));
480 488
481 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 489 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate));
482 490
483 BoundNetLog net_log; 491 BoundNetLog net_log;
484 GURL url("ws://example.com/echo"); 492 GURL url("ws://example.com/echo");
485 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log)); 493 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log));
486 494
487 SendRequest(); 495 SendRequest();
488 496
489 completion_callback_.WaitForResult(); 497 completion_callback_.WaitForResult();
(...skipping 17 matching lines...) Expand all
507 EXPECT_EQ(static_cast<int>(kMessageFrameLength), events[2].result); 515 EXPECT_EQ(static_cast<int>(kMessageFrameLength), events[2].result);
508 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_RECEIVED_DATA, 516 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_RECEIVED_DATA,
509 events[3].event_type); 517 events[3].event_type);
510 EXPECT_EQ(static_cast<int>(kMessageFrameLength), events[3].result); 518 EXPECT_EQ(static_cast<int>(kMessageFrameLength), events[3].result);
511 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_CLOSE, events[4].event_type); 519 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_CLOSE, events[4].event_type);
512 520
513 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession( 521 EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(
514 host_port_proxy_pair_)); 522 host_port_proxy_pair_));
515 } 523 }
516 524
517 TEST_F(SpdyWebSocketStreamTest, IOPending) { 525 TEST_F(SpdyWebSocketStreamSpdy2Test, IOPending) {
518 Prepare(3); 526 Prepare(3);
519 scoped_ptr<spdy::SpdyFrame> settings_frame( 527 scoped_ptr<spdy::SpdyFrame> settings_frame(
520 ConstructSpdySettings(spdy_settings_to_send_)); 528 ConstructSpdySettings(spdy_settings_to_send_));
521 MockWrite writes[] = { 529 MockWrite writes[] = {
522 // Setting throttling make SpdySession send settings frame automatically. 530 // Setting throttling make SpdySession send settings frame automatically.
523 CreateMockWrite(*settings_frame.get(), 1), 531 CreateMockWrite(*settings_frame.get(), 1),
524 CreateMockWrite(*request_frame_.get(), 3), 532 CreateMockWrite(*request_frame_.get(), 3),
525 CreateMockWrite(*message_frame_.get(), 6), 533 CreateMockWrite(*message_frame_.get(), 6),
526 CreateMockWrite(*closing_frame_.get(), 9) 534 CreateMockWrite(*closing_frame_.get(), 9)
527 }; 535 };
(...skipping 18 matching lines...) Expand all
546 scoped_ptr<SpdyWebSocketStream> block_stream( 554 scoped_ptr<SpdyWebSocketStream> block_stream(
547 new SpdyWebSocketStream(session_, &block_delegate)); 555 new SpdyWebSocketStream(session_, &block_delegate));
548 BoundNetLog block_net_log; 556 BoundNetLog block_net_log;
549 GURL block_url("ws://example.com/block"); 557 GURL block_url("ws://example.com/block");
550 ASSERT_EQ(OK, 558 ASSERT_EQ(OK,
551 block_stream->InitializeStream(block_url, HIGHEST, block_net_log)); 559 block_stream->InitializeStream(block_url, HIGHEST, block_net_log));
552 560
553 // Create a WebSocketStream under test. 561 // Create a WebSocketStream under test.
554 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 562 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
555 delegate.SetOnCreated( 563 delegate.SetOnCreated(
556 base::Bind(&SpdyWebSocketStreamTest::DoSync, base::Unretained(this))); 564 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync,
565 base::Unretained(this)));
557 delegate.SetOnReceivedHeader( 566 delegate.SetOnReceivedHeader(
558 base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, 567 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
559 base::Unretained(this))); 568 base::Unretained(this)));
560 delegate.SetOnReceivedData( 569 delegate.SetOnReceivedData(
561 base::Bind(&SpdyWebSocketStreamTest::DoSendClosingFrame, 570 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame,
562 base::Unretained(this))); 571 base::Unretained(this)));
563 572
564 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 573 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate));
565 BoundNetLog net_log; 574 BoundNetLog net_log;
566 GURL url("ws://example.com/echo"); 575 GURL url("ws://example.com/echo");
567 ASSERT_EQ(ERR_IO_PENDING, websocket_stream_->InitializeStream( 576 ASSERT_EQ(ERR_IO_PENDING, websocket_stream_->InitializeStream(
568 url, HIGHEST, net_log)); 577 url, HIGHEST, net_log));
569 578
570 // Delete the fist stream to allow create the second stream. 579 // Delete the fist stream to allow create the second stream.
571 block_stream.reset(); 580 block_stream.reset();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 EXPECT_EQ(OK, events[7].result); 619 EXPECT_EQ(OK, events[7].result);
611 620
612 // EOF close SPDY session. 621 // EOF close SPDY session.
613 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( 622 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(
614 host_port_proxy_pair_)); 623 host_port_proxy_pair_));
615 EXPECT_TRUE(data()->at_read_eof()); 624 EXPECT_TRUE(data()->at_read_eof());
616 EXPECT_TRUE(data()->at_write_eof()); 625 EXPECT_TRUE(data()->at_write_eof());
617 } 626 }
618 627
619 } // namespace net 628 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_websocket_stream.h ('k') | net/spdy/spdy_websocket_stream_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698