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

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

Issue 710713002: Remove SPDY2 and SPDY/3.0 from tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 scoped_refptr<HttpNetworkSession> http_session_; 174 scoped_refptr<HttpNetworkSession> http_session_;
175 SpdySessionPool* spdy_session_pool_; 175 SpdySessionPool* spdy_session_pool_;
176 GURL test_url_; 176 GURL test_url_;
177 HostPortPair test_host_port_pair_; 177 HostPortPair test_host_port_pair_;
178 SpdySessionKey key_; 178 SpdySessionKey key_;
179 }; 179 };
180 180
181 INSTANTIATE_TEST_CASE_P( 181 INSTANTIATE_TEST_CASE_P(
182 NextProto, 182 NextProto,
183 SpdySessionTest, 183 SpdySessionTest,
184 testing::Values(kProtoDeprecatedSPDY2, 184 testing::Values(kProtoSPDY31, kProtoSPDY4));
185 kProtoSPDY3, kProtoSPDY31, kProtoSPDY4));
186 185
187 // Try to create a SPDY session that will fail during 186 // Try to create a SPDY session that will fail during
188 // initialization. Nothing should blow up. 187 // initialization. Nothing should blow up.
189 TEST_P(SpdySessionTest, InitialReadError) { 188 TEST_P(SpdySessionTest, InitialReadError) {
190 CreateDeterministicNetworkSession(); 189 CreateDeterministicNetworkSession();
191 190
192 base::WeakPtr<SpdySession> session = TryCreateFakeSpdySessionExpectingFailure( 191 base::WeakPtr<SpdySession> session = TryCreateFakeSpdySessionExpectingFailure(
193 spdy_session_pool_, key_, ERR_CONNECTION_CLOSED); 192 spdy_session_pool_, key_, ERR_CONNECTION_CLOSED);
194 EXPECT_TRUE(session); 193 EXPECT_TRUE(session);
195 // Flush the read. 194 // Flush the read.
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 spdy_util_.ConstructGetHeaderBlock(url.spec())); 1789 spdy_util_.ConstructGetHeaderBlock(url.spec()));
1791 spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); 1790 spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND);
1792 EXPECT_TRUE(spdy_stream->HasUrlFromHeaders()); 1791 EXPECT_TRUE(spdy_stream->HasUrlFromHeaders());
1793 1792
1794 // Write request headers & capture resulting histogram update. 1793 // Write request headers & capture resulting histogram update.
1795 base::HistogramTester histogram_tester; 1794 base::HistogramTester histogram_tester;
1796 1795
1797 data.RunFor(1); 1796 data.RunFor(1);
1798 // Regression test of compression performance under the request fixture. 1797 // Regression test of compression performance under the request fixture.
1799 switch (spdy_util_.spdy_version()) { 1798 switch (spdy_util_.spdy_version()) {
1800 case SPDY2:
1801 histogram_tester.ExpectBucketCount(
1802 "Net.SpdySynStreamCompressionPercentage", 0, 1);
1803 break;
1804 case SPDY3: 1799 case SPDY3:
1805 histogram_tester.ExpectBucketCount( 1800 histogram_tester.ExpectBucketCount(
1806 "Net.SpdySynStreamCompressionPercentage", 30, 1); 1801 "Net.SpdySynStreamCompressionPercentage", 30, 1);
1807 break; 1802 break;
1808 case SPDY4: 1803 case SPDY4:
1809 histogram_tester.ExpectBucketCount( 1804 histogram_tester.ExpectBucketCount(
1810 "Net.SpdySynStreamCompressionPercentage", 82, 1); 1805 "Net.SpdySynStreamCompressionPercentage", 82, 1);
1811 break; 1806 break;
1812 case SPDY5: 1807 case SPDY5:
1813 histogram_tester.ExpectBucketCount( 1808 histogram_tester.ExpectBucketCount(
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); 3071 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0);
3077 data.set_connect_data(connect_data); 3072 data.set_connect_data(connect_data);
3078 session_deps_.socket_factory->AddSocketDataProvider(&data); 3073 session_deps_.socket_factory->AddSocketDataProvider(&data);
3079 3074
3080 CreateNetworkSession(); 3075 CreateNetworkSession();
3081 base::WeakPtr<SpdySession> session = 3076 base::WeakPtr<SpdySession> session =
3082 CreateFakeSpdySession(spdy_session_pool_, key_); 3077 CreateFakeSpdySession(spdy_session_pool_, key_);
3083 3078
3084 EXPECT_EQ(spdy_util_.spdy_version(), 3079 EXPECT_EQ(spdy_util_.spdy_version(),
3085 session->buffered_spdy_framer_->protocol_version()); 3080 session->buffered_spdy_framer_->protocol_version());
3086 if (GetParam() == kProtoDeprecatedSPDY2) { 3081 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION,
3087 EXPECT_EQ(SpdySession::FLOW_CONTROL_NONE, session->flow_control_state()); 3082 session->flow_control_state());
3088 EXPECT_EQ(0, session->session_send_window_size_); 3083 EXPECT_EQ(kSpdySessionInitialWindowSize,
3089 EXPECT_EQ(0, session->session_recv_window_size_); 3084 session->session_send_window_size_);
3090 } else if (GetParam() == kProtoSPDY3) { 3085 EXPECT_EQ(kSpdySessionInitialWindowSize,
3091 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM, session->flow_control_state()); 3086 session->session_recv_window_size_);
3092 EXPECT_EQ(0, session->session_send_window_size_);
3093 EXPECT_EQ(0, session->session_recv_window_size_);
3094 } else {
3095 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION,
3096 session->flow_control_state());
3097 EXPECT_EQ(kSpdySessionInitialWindowSize,
3098 session->session_send_window_size_);
3099 EXPECT_EQ(kSpdySessionInitialWindowSize,
3100 session->session_recv_window_size_);
3101 }
3102 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_); 3087 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
3103 } 3088 }
3104 3089
3105 // Tests the case of a non-SPDY request closing an idle SPDY session when no 3090 // Tests the case of a non-SPDY request closing an idle SPDY session when no
3106 // pointers to the idle session are currently held. 3091 // pointers to the idle session are currently held.
3107 TEST_P(SpdySessionTest, CloseOneIdleConnection) { 3092 TEST_P(SpdySessionTest, CloseOneIdleConnection) {
3108 ClientSocketPoolManager::set_max_sockets_per_group( 3093 ClientSocketPoolManager::set_max_sockets_per_group(
3109 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); 3094 HttpNetworkSession::NORMAL_SOCKET_POOL, 1);
3110 ClientSocketPoolManager::set_max_sockets_per_pool( 3095 ClientSocketPoolManager::set_max_sockets_per_pool(
3111 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); 3096 HttpNetworkSession::NORMAL_SOCKET_POOL, 1);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3447 3432
3448 EXPECT_EQ(NULL, spdy_stream.get()); 3433 EXPECT_EQ(NULL, spdy_stream.get());
3449 EXPECT_TRUE(delegate.StreamIsClosed()); 3434 EXPECT_TRUE(delegate.StreamIsClosed());
3450 EXPECT_EQ(0u, session->num_active_streams()); 3435 EXPECT_EQ(0u, session->num_active_streams());
3451 EXPECT_EQ(1u, session->num_created_streams()); 3436 EXPECT_EQ(1u, session->num_created_streams());
3452 } 3437 }
3453 3438
3454 // The tests below are only for SPDY/3 and above. 3439 // The tests below are only for SPDY/3 and above.
3455 3440
3456 TEST_P(SpdySessionTest, UpdateStreamsSendWindowSize) { 3441 TEST_P(SpdySessionTest, UpdateStreamsSendWindowSize) {
3457 if (GetParam() < kProtoSPDY3)
3458 return;
3459
3460 // Set SETTINGS_INITIAL_WINDOW_SIZE to a small number so that WINDOW_UPDATE 3442 // Set SETTINGS_INITIAL_WINDOW_SIZE to a small number so that WINDOW_UPDATE
3461 // gets sent. 3443 // gets sent.
3462 SettingsMap new_settings; 3444 SettingsMap new_settings;
3463 int32 window_size = 1; 3445 int32 window_size = 1;
3464 new_settings[SETTINGS_INITIAL_WINDOW_SIZE] = 3446 new_settings[SETTINGS_INITIAL_WINDOW_SIZE] =
3465 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, window_size); 3447 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, window_size);
3466 3448
3467 // Set up the socket so we read a SETTINGS frame that sets 3449 // Set up the socket so we read a SETTINGS frame that sets
3468 // INITIAL_WINDOW_SIZE. 3450 // INITIAL_WINDOW_SIZE.
3469 MockConnect connect_data(SYNCHRONOUS, OK); 3451 MockConnect connect_data(SYNCHRONOUS, OK);
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
5133 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 5115 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
5134 "spdy_pooling.pem"); 5116 "spdy_pooling.pem");
5135 ssl_info.is_issued_by_known_root = true; 5117 ssl_info.is_issued_by_known_root = true;
5136 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 5118 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
5137 5119
5138 EXPECT_TRUE(SpdySession::CanPool( 5120 EXPECT_TRUE(SpdySession::CanPool(
5139 &tss, ssl_info, "www.example.org", "mail.example.org")); 5121 &tss, ssl_info, "www.example.org", "mail.example.org"));
5140 } 5122 }
5141 5123
5142 } // namespace net 5124 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698