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

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

Issue 289823002: SPDY4: SpdySession should send SETTINGS acknowledgements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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_test_util_common.cc ('k') | net/spdy/spdy_websocket_test_util.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_CLOSE, events[4].event_type); 555 EXPECT_EQ(SpdyWebSocketStreamEvent::EVENT_CLOSE, events[4].event_type);
556 556
557 EXPECT_TRUE( 557 EXPECT_TRUE(
558 HasSpdySession(http_session_->spdy_session_pool(), spdy_session_key_)); 558 HasSpdySession(http_session_->spdy_session_pool(), spdy_session_key_));
559 } 559 }
560 560
561 TEST_P(SpdyWebSocketStreamTest, IOPending) { 561 TEST_P(SpdyWebSocketStreamTest, IOPending) {
562 Prepare(1); 562 Prepare(1);
563 scoped_ptr<SpdyFrame> settings_frame( 563 scoped_ptr<SpdyFrame> settings_frame(
564 spdy_util_.ConstructSpdySettings(spdy_settings_to_send_)); 564 spdy_util_.ConstructSpdySettings(spdy_settings_to_send_));
565 scoped_ptr<SpdyFrame> settings_ack(spdy_util_.ConstructSpdySettingsAck());
565 MockWrite writes[] = { 566 MockWrite writes[] = {
566 CreateMockWrite(*request_frame_.get(), 1), 567 CreateMockWrite(*settings_ack, 1),
567 CreateMockWrite(*message_frame_.get(), 3), 568 CreateMockWrite(*request_frame_.get(), 2),
568 CreateMockWrite(*closing_frame_.get(), 5) 569 CreateMockWrite(*message_frame_.get(), 4),
570 CreateMockWrite(*closing_frame_.get(), 6)
569 }; 571 };
570 572
571 MockRead reads[] = { 573 MockRead reads[] = {
572 CreateMockRead(*settings_frame.get(), 0), 574 CreateMockRead(*settings_frame.get(), 0),
573 CreateMockRead(*response_frame_.get(), 2), 575 CreateMockRead(*response_frame_.get(), 3),
574 CreateMockRead(*message_frame_.get(), 4), 576 CreateMockRead(*message_frame_.get(), 5),
575 CreateMockRead(*closing_frame_.get(), 6), 577 CreateMockRead(*closing_frame_.get(), 7),
576 MockRead(SYNCHRONOUS, 0, 7) // EOF cause OnCloseSpdyStream event. 578 MockRead(SYNCHRONOUS, 0, 8) // EOF cause OnCloseSpdyStream event.
577 }; 579 };
578 580
579 DeterministicSocketData data(reads, arraysize(reads), 581 DeterministicSocketData data(reads, arraysize(reads),
580 writes, arraysize(writes)); 582 writes, arraysize(writes));
581 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data); 583 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data);
582 http_session_ = 584 http_session_ =
583 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_); 585 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_);
584 586
585 session_ = CreateInsecureSpdySession( 587 session_ = CreateInsecureSpdySession(
586 http_session_, spdy_session_key_, BoundNetLog()); 588 http_session_, spdy_session_key_, BoundNetLog());
(...skipping 28 matching lines...) Expand all
615 GURL url("ws://example.com/echo"); 617 GURL url("ws://example.com/echo");
616 ASSERT_EQ(ERR_IO_PENDING, websocket_stream_->InitializeStream( 618 ASSERT_EQ(ERR_IO_PENDING, websocket_stream_->InitializeStream(
617 url, HIGHEST, net_log)); 619 url, HIGHEST, net_log));
618 620
619 // Delete the fist stream to allow create the second stream. 621 // Delete the fist stream to allow create the second stream.
620 block_stream.reset(); 622 block_stream.reset();
621 ASSERT_EQ(OK, sync_callback_.WaitForResult()); 623 ASSERT_EQ(OK, sync_callback_.WaitForResult());
622 624
623 SendRequest(); 625 SendRequest();
624 626
625 data.RunFor(7); 627 data.RunFor(8);
626 completion_callback_.WaitForResult(); 628 completion_callback_.WaitForResult();
627 629
628 websocket_stream_.reset(); 630 websocket_stream_.reset();
629 631
630 const std::vector<SpdyWebSocketStreamEvent>& block_events = 632 const std::vector<SpdyWebSocketStreamEvent>& block_events =
631 block_delegate.GetSeenEvents(); 633 block_delegate.GetSeenEvents();
632 ASSERT_EQ(0U, block_events.size()); 634 ASSERT_EQ(0U, block_events.size());
633 635
634 const std::vector<SpdyWebSocketStreamEvent>& events = 636 const std::vector<SpdyWebSocketStreamEvent>& events =
635 delegate.GetSeenEvents(); 637 delegate.GetSeenEvents();
(...skipping 24 matching lines...) Expand all
660 EXPECT_EQ(OK, events[7].result); 662 EXPECT_EQ(OK, events[7].result);
661 663
662 // EOF close SPDY session. 664 // EOF close SPDY session.
663 EXPECT_FALSE( 665 EXPECT_FALSE(
664 HasSpdySession(http_session_->spdy_session_pool(), spdy_session_key_)); 666 HasSpdySession(http_session_->spdy_session_pool(), spdy_session_key_));
665 EXPECT_TRUE(data.at_read_eof()); 667 EXPECT_TRUE(data.at_read_eof());
666 EXPECT_TRUE(data.at_write_eof()); 668 EXPECT_TRUE(data.at_write_eof());
667 } 669 }
668 670
669 } // namespace net 671 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | net/spdy/spdy_websocket_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698