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

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: Actually incease the window size. *sigh* 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
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
695
696 scoped_refptr<HttpNetworkSession> http_session(
697 SpdySessionDependencies::SpdyCreateSession(&session_deps));
698
699 static const char kStreamUrl[] = "http://www.google.com/";
700 GURL url(kStreamUrl);
701
702 const std::string kTestHost("www.google.com");
703 const int kTestPort = 80;
704 HostPortPair test_host_port_pair(kTestHost, kTestPort);
705 HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct());
706
707 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool());
708 EXPECT_FALSE(spdy_session_pool->HasSession(pair));
709 scoped_refptr<SpdySession> session =
710 spdy_session_pool->Get(pair, BoundNetLog());
711 EXPECT_TRUE(spdy_session_pool->HasSession(pair));
712
713 scoped_refptr<TransportSocketParams> transport_params(
714 new TransportSocketParams(test_host_port_pair,
715 MEDIUM,
716 false,
717 false));
718 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
719 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(),
720 transport_params, MEDIUM, CompletionCallback(),
721 http_session->GetTransportSocketPool(
722 HttpNetworkSession::NORMAL_SOCKET_POOL),
723 BoundNetLog()));
724 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK));
725 MessageLoop::current()->RunAllPending();
726 EXPECT_TRUE(data.at_write_eof());
727 }
728
666 TEST_F(SpdySessionSpdy3Test, SendSettingsOnNewSession) { 729 TEST_F(SpdySessionSpdy3Test, SendSettingsOnNewSession) {
667 SpdySessionDependencies session_deps; 730 SpdySessionDependencies session_deps;
668 session_deps.host_resolver->set_synchronous_mode(true); 731 session_deps.host_resolver->set_synchronous_mode(true);
669 732
670 MockRead reads[] = { 733 MockRead reads[] = {
671 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. 734 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
672 }; 735 };
673 736
674 // Create the bogus setting that we want to verify is sent out. 737 // 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 738 // 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()); 1351 EXPECT_EQ(3u, spdy_stream2->stream_id());
1289 1352
1290 spdy_stream1->Cancel(); 1353 spdy_stream1->Cancel();
1291 spdy_stream1 = NULL; 1354 spdy_stream1 = NULL;
1292 1355
1293 spdy_stream2->Cancel(); 1356 spdy_stream2->Cancel();
1294 spdy_stream2 = NULL; 1357 spdy_stream2 = NULL;
1295 } 1358 }
1296 1359
1297 } // namespace net 1360 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698