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

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

Issue 13845012: [SPDY] Add flag and about:flags entry for SPDY/4 alpha 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 8 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_session.cc ('k') | net/spdy/spdy_test_util_spdy3.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 (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_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "net/base/ip_endpoint.h" 7 #include "net/base/ip_endpoint.h"
8 #include "net/base/net_log_unittest.h" 8 #include "net/base/net_log_unittest.h"
9 #include "net/base/request_priority.h" 9 #include "net/base/request_priority.h"
10 #include "net/base/test_data_directory.h" 10 #include "net/base/test_data_directory.h"
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 EXPECT_EQ(SpdySession::FLOW_CONTROL_NONE, session->flow_control_state()); 1705 EXPECT_EQ(SpdySession::FLOW_CONTROL_NONE, session->flow_control_state());
1706 EXPECT_TRUE(session->buffered_spdy_framer_ == NULL); 1706 EXPECT_TRUE(session->buffered_spdy_framer_ == NULL);
1707 EXPECT_EQ(0, session->session_send_window_size_); 1707 EXPECT_EQ(0, session->session_send_window_size_);
1708 EXPECT_EQ(0, session->session_recv_window_size_); 1708 EXPECT_EQ(0, session->session_recv_window_size_);
1709 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_); 1709 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
1710 1710
1711 InitializeSession( 1711 InitializeSession(
1712 http_session_.get(), session.get(), test_host_port_pair_); 1712 http_session_.get(), session.get(), test_host_port_pair_);
1713 1713
1714 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM, session->flow_control_state()); 1714 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM, session->flow_control_state());
1715 EXPECT_EQ(kSpdyVersion3, session->buffered_spdy_framer_->protocol_version()); 1715 EXPECT_EQ(kSpdyVersion3, session->GetProtocolVersion());
1716 EXPECT_EQ(0, session->session_send_window_size_); 1716 EXPECT_EQ(0, session->session_send_window_size_);
1717 EXPECT_EQ(0, session->session_recv_window_size_); 1717 EXPECT_EQ(0, session->session_recv_window_size_);
1718 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_); 1718 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
1719 } 1719 }
1720 1720
1721 // Within this framework and with the "enable_spdy_31" flag, a 1721 // Within this framework and with the "enable_spdy_31" flag, a
1722 // SpdySession should be initialized with flow control enabled for 1722 // SpdySession should be initialized with flow control enabled for
1723 // streams and sessions and with protocol version 3. 1723 // streams and sessions and with protocol version 3.
1724 TEST_F(SpdySessionSpdy3Test, ProtocolNegotiation31) { 1724 TEST_F(SpdySessionSpdy3Test, ProtocolNegotiation31) {
1725 session_deps_.enable_spdy_31 = true; 1725 session_deps_.enable_spdy_31 = true;
(...skipping 14 matching lines...) Expand all
1740 EXPECT_TRUE(session->buffered_spdy_framer_ == NULL); 1740 EXPECT_TRUE(session->buffered_spdy_framer_ == NULL);
1741 EXPECT_EQ(0, session->session_send_window_size_); 1741 EXPECT_EQ(0, session->session_send_window_size_);
1742 EXPECT_EQ(0, session->session_recv_window_size_); 1742 EXPECT_EQ(0, session->session_recv_window_size_);
1743 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_); 1743 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
1744 1744
1745 InitializeSession( 1745 InitializeSession(
1746 http_session_.get(), session.get(), test_host_port_pair_); 1746 http_session_.get(), session.get(), test_host_port_pair_);
1747 1747
1748 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION, 1748 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION,
1749 session->flow_control_state()); 1749 session->flow_control_state());
1750 EXPECT_EQ(kSpdyVersion3, session->buffered_spdy_framer_->protocol_version()); 1750 EXPECT_EQ(kSpdyVersion3, session->GetProtocolVersion());
1751 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_send_window_size_); 1751 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_send_window_size_);
1752 EXPECT_EQ(kDefaultInitialRecvWindowSize, session->session_recv_window_size_); 1752 EXPECT_EQ(kDefaultInitialRecvWindowSize, session->session_recv_window_size_);
1753 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_); 1753 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
1754 }
1755
1756 // Within this framework and with the "enable_spdy_4" flag, a
1757 // SpdySession should be initialized with flow control enabled for
1758 // streams and sessions and with protocol version 4.
1759 //
1760 // NOTE(akalin): We are still figuring out the story for SPDY4 test
1761 // coverage.
1762 TEST_F(SpdySessionSpdy3Test, ProtocolNegotiation4) {
1763 session_deps_.enable_spdy_4 = true;
1764 session_deps_.host_resolver->set_synchronous_mode(true);
1765
1766 MockConnect connect_data(SYNCHRONOUS, OK);
1767 MockRead reads[] = {
1768 MockRead(SYNCHRONOUS, 0, 0) // EOF
1769 };
1770 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0);
1771 data.set_connect_data(connect_data);
1772 session_deps_.socket_factory->AddSocketDataProvider(&data);
1773
1774 CreateNetworkSession();
1775 scoped_refptr<SpdySession> session = GetSession(pair_);
1776
1777 EXPECT_EQ(SpdySession::FLOW_CONTROL_NONE, session->flow_control_state());
1778 EXPECT_TRUE(session->buffered_spdy_framer_ == NULL);
1779 EXPECT_EQ(0, session->session_send_window_size_);
1780 EXPECT_EQ(0, session->session_recv_window_size_);
1781 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
1782
1783 InitializeSession(
1784 http_session_.get(), session.get(), test_host_port_pair_);
1785
1786 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION,
1787 session->flow_control_state());
1788 EXPECT_EQ(kSpdyVersion4, session->GetProtocolVersion());
1789 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_send_window_size_);
1790 EXPECT_EQ(kDefaultInitialRecvWindowSize, session->session_recv_window_size_);
1791 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
1754 } 1792 }
1755 1793
1756 // SpdySession::IncreaseRecvWindowSize should be callable even if 1794 // SpdySession::IncreaseRecvWindowSize should be callable even if
1757 // session flow control isn't turned on, but it should have no effect. 1795 // session flow control isn't turned on, but it should have no effect.
1758 TEST_F(SpdySessionSpdy3Test, IncreaseRecvWindowSize) { 1796 TEST_F(SpdySessionSpdy3Test, IncreaseRecvWindowSize) {
1759 session_deps_.host_resolver->set_synchronous_mode(true); 1797 session_deps_.host_resolver->set_synchronous_mode(true);
1760 1798
1761 MockConnect connect_data(SYNCHRONOUS, OK); 1799 MockConnect connect_data(SYNCHRONOUS, OK);
1762 MockRead reads[] = { 1800 MockRead reads[] = {
1763 MockRead(SYNCHRONOUS, 0, 0) // EOF 1801 MockRead(SYNCHRONOUS, 0, 0) // EOF
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 EXPECT_EQ(0, delegate1.body_data_sent()); 2661 EXPECT_EQ(0, delegate1.body_data_sent());
2624 2662
2625 EXPECT_TRUE(delegate2.send_headers_completed()); 2663 EXPECT_TRUE(delegate2.send_headers_completed());
2626 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status")); 2664 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status"));
2627 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version")); 2665 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version"));
2628 EXPECT_EQ("", delegate2.received_data()); 2666 EXPECT_EQ("", delegate2.received_data());
2629 EXPECT_EQ(0, delegate2.body_data_sent()); 2667 EXPECT_EQ(0, delegate2.body_data_sent());
2630 } 2668 }
2631 2669
2632 } // namespace net 2670 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_test_util_spdy3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698