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

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

Issue 1061853002: Emit session-level WINDOW_UPDATEs less frequently. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: comments in #5. Created 5 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
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_stream.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_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 } 1534 }
1535 1535
1536 TEST_P(SpdySessionTest, SendInitialDataOnNewSession) { 1536 TEST_P(SpdySessionTest, SendInitialDataOnNewSession) {
1537 session_deps_.host_resolver->set_synchronous_mode(true); 1537 session_deps_.host_resolver->set_synchronous_mode(true);
1538 1538
1539 MockRead reads[] = { 1539 MockRead reads[] = {
1540 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. 1540 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
1541 }; 1541 };
1542 1542
1543 SettingsMap settings; 1543 SettingsMap settings;
1544 const SpdySettingsIds kSpdySettingsIds1 = SETTINGS_MAX_CONCURRENT_STREAMS; 1544 settings[SETTINGS_MAX_CONCURRENT_STREAMS] =
1545 const SpdySettingsIds kSpdySettingsIds2 = SETTINGS_INITIAL_WINDOW_SIZE;
1546 const uint32 kInitialRecvWindowSize = 10 * 1024 * 1024;
1547 settings[kSpdySettingsIds1] =
1548 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); 1545 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams);
1549 if (spdy_util_.spdy_version() >= SPDY3) {
1550 settings[kSpdySettingsIds2] =
1551 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize);
1552 }
1553 MockConnect connect_data(SYNCHRONOUS, OK); 1546 MockConnect connect_data(SYNCHRONOUS, OK);
1554 scoped_ptr<SpdyFrame> settings_frame( 1547 scoped_ptr<SpdyFrame> settings_frame(
1555 spdy_util_.ConstructSpdySettings(settings)); 1548 spdy_util_.ConstructSpdySettings(settings));
1556 scoped_ptr<SpdyFrame> initial_window_update(
1557 spdy_util_.ConstructSpdyWindowUpdate(
1558 kSessionFlowControlStreamId,
1559 kDefaultInitialRecvWindowSize -
1560 SpdySession::GetInitialWindowSize(GetParam())));
1561 std::vector<MockWrite> writes; 1549 std::vector<MockWrite> writes;
1562 if ((GetParam() >= kProtoSPDY4MinimumVersion) && 1550 if ((GetParam() >= kProtoSPDY4MinimumVersion) &&
1563 (GetParam() <= kProtoSPDY4MaximumVersion)) { 1551 (GetParam() <= kProtoSPDY4MaximumVersion)) {
1564 writes.push_back( 1552 writes.push_back(
1565 MockWrite(ASYNC, 1553 MockWrite(ASYNC,
1566 kHttp2ConnectionHeaderPrefix, 1554 kHttp2ConnectionHeaderPrefix,
1567 kHttp2ConnectionHeaderPrefixSize)); 1555 kHttp2ConnectionHeaderPrefixSize));
1568 } 1556 }
1569 writes.push_back(CreateMockWrite(*settings_frame)); 1557 writes.push_back(CreateMockWrite(*settings_frame));
1570 if (GetParam() >= kProtoSPDY31) {
1571 writes.push_back(CreateMockWrite(*initial_window_update));
1572 };
1573 1558
1574 SettingsMap server_settings; 1559 SettingsMap server_settings;
1575 const uint32 initial_max_concurrent_streams = 1; 1560 const uint32 initial_max_concurrent_streams = 1;
1576 server_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = 1561 server_settings[SETTINGS_MAX_CONCURRENT_STREAMS] =
1577 SettingsFlagsAndValue(SETTINGS_FLAG_PERSISTED, 1562 SettingsFlagsAndValue(SETTINGS_FLAG_PERSISTED,
1578 initial_max_concurrent_streams); 1563 initial_max_concurrent_streams);
1579 scoped_ptr<SpdyFrame> server_settings_frame( 1564 scoped_ptr<SpdyFrame> server_settings_frame(
1580 spdy_util_.ConstructSpdySettings(server_settings)); 1565 spdy_util_.ConstructSpdySettings(server_settings));
1581 if (GetParam() <= kProtoSPDY31) { 1566 if (GetParam() <= kProtoSPDY31) {
1582 writes.push_back(CreateMockWrite(*server_settings_frame)); 1567 writes.push_back(CreateMockWrite(*server_settings_frame));
1583 } 1568 }
1584 1569
1585 session_deps_.stream_initial_recv_window_size = kInitialRecvWindowSize;
1586
1587 StaticSocketDataProvider data(reads, arraysize(reads), 1570 StaticSocketDataProvider data(reads, arraysize(reads),
1588 vector_as_array(&writes), writes.size()); 1571 vector_as_array(&writes), writes.size());
1589 data.set_connect_data(connect_data); 1572 data.set_connect_data(connect_data);
1590 session_deps_.socket_factory->AddSocketDataProvider(&data); 1573 session_deps_.socket_factory->AddSocketDataProvider(&data);
1591 1574
1592 CreateNetworkSession(); 1575 CreateNetworkSession();
1593 1576
1594 spdy_session_pool_->http_server_properties()->SetSpdySetting( 1577 spdy_session_pool_->http_server_properties()->SetSpdySetting(
1595 test_host_port_pair_, 1578 test_host_port_pair_,
1596 SETTINGS_MAX_CONCURRENT_STREAMS, 1579 SETTINGS_MAX_CONCURRENT_STREAMS,
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 5147 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
5165 "spdy_pooling.pem"); 5148 "spdy_pooling.pem");
5166 ssl_info.is_issued_by_known_root = true; 5149 ssl_info.is_issued_by_known_root = true;
5167 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 5150 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
5168 5151
5169 EXPECT_TRUE(SpdySession::CanPool( 5152 EXPECT_TRUE(SpdySession::CanPool(
5170 &tss, ssl_info, "www.example.org", "mail.example.org")); 5153 &tss, ssl_info, "www.example.org", "mail.example.org"));
5171 } 5154 }
5172 5155
5173 } // namespace net 5156 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698