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

Side by Side Diff: net/spdy/spdy_websocket_stream_spdy2_unittest.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 6 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.cc ('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"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 writes, arraysize(writes), false)); 341 writes, arraysize(writes), false));
342 342
343 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 343 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
344 delegate.SetOnReceivedHeader( 344 delegate.SetOnReceivedHeader(
345 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, 345 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
346 base::Unretained(this))); 346 base::Unretained(this)));
347 delegate.SetOnReceivedData( 347 delegate.SetOnReceivedData(
348 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame, 348 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame,
349 base::Unretained(this))); 349 base::Unretained(this)));
350 350
351 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 351 websocket_stream_.reset(new SpdyWebSocketStream(session_.get(), &delegate));
352 352
353 BoundNetLog net_log; 353 BoundNetLog net_log;
354 GURL url("ws://example.com/echo"); 354 GURL url("ws://example.com/echo");
355 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log)); 355 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log));
356 356
357 ASSERT_TRUE(websocket_stream_->stream_); 357 ASSERT_TRUE(websocket_stream_->stream_);
358 358
359 SendRequest(); 359 SendRequest();
360 360
361 completion_callback_.WaitForResult(); 361 completion_callback_.WaitForResult();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 writes, arraysize(writes), false)); 414 writes, arraysize(writes), false));
415 415
416 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 416 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
417 delegate.SetOnReceivedHeader( 417 delegate.SetOnReceivedHeader(
418 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, 418 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
419 base::Unretained(this))); 419 base::Unretained(this)));
420 delegate.SetOnReceivedData( 420 delegate.SetOnReceivedData(
421 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync, 421 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync,
422 base::Unretained(this))); 422 base::Unretained(this)));
423 423
424 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 424 websocket_stream_.reset(new SpdyWebSocketStream(session_.get(), &delegate));
425 425
426 BoundNetLog net_log; 426 BoundNetLog net_log;
427 GURL url("ws://example.com/echo"); 427 GURL url("ws://example.com/echo");
428 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log)); 428 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log));
429 429
430 SendRequest(); 430 SendRequest();
431 431
432 sync_callback_.WaitForResult(); 432 sync_callback_.WaitForResult();
433 433
434 // WebSocketStream destruction remove its SPDY stream from the session. 434 // WebSocketStream destruction remove its SPDY stream from the session.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 writes, arraysize(writes), false)); 477 writes, arraysize(writes), false));
478 478
479 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 479 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
480 delegate.SetOnReceivedHeader( 480 delegate.SetOnReceivedHeader(
481 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, 481 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
482 base::Unretained(this))); 482 base::Unretained(this)));
483 delegate.SetOnReceivedData( 483 delegate.SetOnReceivedData(
484 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoClose, 484 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoClose,
485 base::Unretained(this))); 485 base::Unretained(this)));
486 486
487 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 487 websocket_stream_.reset(new SpdyWebSocketStream(session_.get(), &delegate));
488 488
489 BoundNetLog net_log; 489 BoundNetLog net_log;
490 GURL url("ws://example.com/echo"); 490 GURL url("ws://example.com/echo");
491 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log)); 491 ASSERT_EQ(OK, websocket_stream_->InitializeStream(url, HIGHEST, net_log));
492 492
493 SendRequest(); 493 SendRequest();
494 494
495 completion_callback_.WaitForResult(); 495 completion_callback_.WaitForResult();
496 496
497 // SPDY stream has already been removed from the session by Close(). 497 // SPDY stream has already been removed from the session by Close().
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 }; 543 };
544 544
545 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), 545 EXPECT_EQ(OK, InitSession(reads, arraysize(reads),
546 writes, arraysize(writes), true)); 546 writes, arraysize(writes), true));
547 547
548 // Create a dummy WebSocketStream which cause ERR_IO_PENDING to another 548 // Create a dummy WebSocketStream which cause ERR_IO_PENDING to another
549 // WebSocketStream under test. 549 // WebSocketStream under test.
550 SpdyWebSocketStreamEventRecorder block_delegate((CompletionCallback())); 550 SpdyWebSocketStreamEventRecorder block_delegate((CompletionCallback()));
551 551
552 scoped_ptr<SpdyWebSocketStream> block_stream( 552 scoped_ptr<SpdyWebSocketStream> block_stream(
553 new SpdyWebSocketStream(session_, &block_delegate)); 553 new SpdyWebSocketStream(session_.get(), &block_delegate));
554 BoundNetLog block_net_log; 554 BoundNetLog block_net_log;
555 GURL block_url("ws://example.com/block"); 555 GURL block_url("ws://example.com/block");
556 ASSERT_EQ(OK, 556 ASSERT_EQ(OK,
557 block_stream->InitializeStream(block_url, HIGHEST, block_net_log)); 557 block_stream->InitializeStream(block_url, HIGHEST, block_net_log));
558 558
559 // Create a WebSocketStream under test. 559 // Create a WebSocketStream under test.
560 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); 560 SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback());
561 delegate.SetOnCreated( 561 delegate.SetOnCreated(
562 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync, 562 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync,
563 base::Unretained(this))); 563 base::Unretained(this)));
564 delegate.SetOnReceivedHeader( 564 delegate.SetOnReceivedHeader(
565 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, 565 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame,
566 base::Unretained(this))); 566 base::Unretained(this)));
567 delegate.SetOnReceivedData( 567 delegate.SetOnReceivedData(
568 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame, 568 base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame,
569 base::Unretained(this))); 569 base::Unretained(this)));
570 570
571 websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); 571 websocket_stream_.reset(new SpdyWebSocketStream(session_.get(), &delegate));
572 BoundNetLog net_log; 572 BoundNetLog net_log;
573 GURL url("ws://example.com/echo"); 573 GURL url("ws://example.com/echo");
574 ASSERT_EQ(ERR_IO_PENDING, websocket_stream_->InitializeStream( 574 ASSERT_EQ(ERR_IO_PENDING, websocket_stream_->InitializeStream(
575 url, HIGHEST, net_log)); 575 url, HIGHEST, net_log));
576 576
577 // Delete the fist stream to allow create the second stream. 577 // Delete the fist stream to allow create the second stream.
578 block_stream.reset(); 578 block_stream.reset();
579 ASSERT_EQ(OK, sync_callback_.WaitForResult()); 579 ASSERT_EQ(OK, sync_callback_.WaitForResult());
580 580
581 SendRequest(); 581 SendRequest();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 EXPECT_EQ(OK, events[7].result); 617 EXPECT_EQ(OK, events[7].result);
618 618
619 // EOF close SPDY session. 619 // EOF close SPDY session.
620 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession( 620 EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(
621 spdy_session_key_)); 621 spdy_session_key_));
622 EXPECT_TRUE(data()->at_read_eof()); 622 EXPECT_TRUE(data()->at_read_eof());
623 EXPECT_TRUE(data()->at_write_eof()); 623 EXPECT_TRUE(data()->at_write_eof());
624 } 624 }
625 625
626 } // namespace net 626 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_websocket_stream.cc ('k') | net/spdy/spdy_websocket_stream_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698