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

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

Issue 10479014: Increase Chrome SPDY/3 stream receive window to 10MB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix raman's comments Created 8 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_session.cc ('k') | net/spdy/spdy_test_util_spdy3.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 "net/base/host_cache.h" 7 #include "net/base/host_cache.h"
8 #include "net/base/ip_endpoint.h" 8 #include "net/base/ip_endpoint.h"
9 #include "net/base/net_log_unittest.h" 9 #include "net/base/net_log_unittest.h"
10 #include "net/spdy/spdy_io_buffer.h" 10 #include "net/spdy/spdy_io_buffer.h"
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 spdy_stream1->Cancel(); 656 spdy_stream1->Cancel();
657 spdy_stream1 = NULL; 657 spdy_stream1 = NULL;
658 658
659 session->CancelPendingCreateStreams(&spdy_stream2); 659 session->CancelPendingCreateStreams(&spdy_stream2);
660 callback.reset(); 660 callback.reset();
661 661
662 // Should not crash when running the pending callback. 662 // Should not crash when running the pending callback.
663 MessageLoop::current()->RunAllPending(); 663 MessageLoop::current()->RunAllPending();
664 } 664 }
665 665
666 TEST_F(SpdySessionSpdy3Test, SendInitialWindowSizeSettingsOnNewSession) {
667 SpdySessionDependencies session_deps;
668 session_deps.host_resolver->set_synchronous_mode(true);
669
670 MockRead reads[] = {
671 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
672 };
673
674 SettingsMap settings;
675 const SpdySettingsIds kSpdySettingsIds1 = SETTINGS_INITIAL_WINDOW_SIZE;
676 const uint32 kInitialRecvWindowSize = 10 * 1024 * 1024;
677 settings[kSpdySettingsIds1] =
678 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize);
679 MockConnect connect_data(SYNCHRONOUS, OK);
680 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings));
681 MockWrite writes[] = {
682 CreateMockWrite(*settings_frame),
683 };
684 SpdySession::set_default_initial_recv_window_size(kInitialRecvWindowSize);
685
686 StaticSocketDataProvider data(
687 reads, arraysize(reads), writes, arraysize(writes));
688 data.set_connect_data(connect_data);
689 session_deps.socket_factory->AddSocketDataProvider(&data);
690
691 SSLSocketDataProvider ssl(SYNCHRONOUS, OK);
692 session_deps.socket_factory->AddSSLSocketDataProvider(&ssl);
693
694 scoped_refptr<HttpNetworkSession> http_session(
695 SpdySessionDependencies::SpdyCreateSession(&session_deps));
696
697 static const char kStreamUrl[] = "http://www.google.com/";
698 GURL url(kStreamUrl);
699
700 const std::string kTestHost("www.google.com");
701 const int kTestPort = 80;
702 HostPortPair test_host_port_pair(kTestHost, kTestPort);
703 HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct());
704
705 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool());
706 EXPECT_FALSE(spdy_session_pool->HasSession(pair));
707 scoped_refptr<SpdySession> session =
708 spdy_session_pool->Get(pair, BoundNetLog());
709 EXPECT_TRUE(spdy_session_pool->HasSession(pair));
710
711 scoped_refptr<TransportSocketParams> transport_params(
712 new TransportSocketParams(test_host_port_pair,
713 MEDIUM,
714 false,
715 false));
716 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
717 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(),
718 transport_params, MEDIUM, CompletionCallback(),
719 http_session->GetTransportSocketPool(
720 HttpNetworkSession::NORMAL_SOCKET_POOL),
721 BoundNetLog()));
722 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK));
723 MessageLoop::current()->RunAllPending();
724 EXPECT_TRUE(data.at_write_eof());
725 }
726
666 TEST_F(SpdySessionSpdy3Test, SendSettingsOnNewSession) { 727 TEST_F(SpdySessionSpdy3Test, SendSettingsOnNewSession) {
667 SpdySessionDependencies session_deps; 728 SpdySessionDependencies session_deps;
668 session_deps.host_resolver->set_synchronous_mode(true); 729 session_deps.host_resolver->set_synchronous_mode(true);
669 730
670 MockRead reads[] = { 731 MockRead reads[] = {
671 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. 732 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
672 }; 733 };
673 734
674 // Create the bogus setting that we want to verify is sent out. 735 // Create the bogus setting that we want to verify is sent out.
675 // Note that it will be marked as SETTINGS_FLAG_PERSISTED when sent out. But 736 // Note that it will be marked as SETTINGS_FLAG_PERSISTED when sent out. But
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 EXPECT_EQ(3u, spdy_stream2->stream_id()); 1349 EXPECT_EQ(3u, spdy_stream2->stream_id());
1289 1350
1290 spdy_stream1->Cancel(); 1351 spdy_stream1->Cancel();
1291 spdy_stream1 = NULL; 1352 spdy_stream1 = NULL;
1292 1353
1293 spdy_stream2->Cancel(); 1354 spdy_stream2->Cancel();
1294 spdy_stream2 = NULL; 1355 spdy_stream2 = NULL;
1295 } 1356 }
1296 1357
1297 } // namespace net 1358 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_test_util_spdy3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698