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

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

Issue 8497063: Send preface-PING message once in 10 secs and send PING (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/spdy/spdy_io_buffer.h" 8 #include "net/spdy/spdy_io_buffer.h"
9 #include "net/spdy/spdy_session_pool.h" 9 #include "net/spdy/spdy_session_pool.h"
10 #include "net/spdy/spdy_stream.h" 10 #include "net/spdy/spdy_stream.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 BoundNetLog(), 232 BoundNetLog(),
233 &callback1)); 233 &callback1));
234 scoped_ptr<TestSpdyStreamDelegate> delegate( 234 scoped_ptr<TestSpdyStreamDelegate> delegate(
235 new TestSpdyStreamDelegate(&callback1)); 235 new TestSpdyStreamDelegate(&callback1));
236 spdy_stream1->SetDelegate(delegate.get()); 236 spdy_stream1->SetDelegate(delegate.get());
237 237
238 base::TimeTicks before_ping_time = base::TimeTicks::Now(); 238 base::TimeTicks before_ping_time = base::TimeTicks::Now();
239 239
240 // Enable sending of PING. 240 // Enable sending of PING.
241 SpdySession::set_enable_ping_based_connection_checking(true); 241 SpdySession::set_enable_ping_based_connection_checking(true);
242 SpdySession::set_connection_at_risk_of_loss_ms(0); 242 SpdySession::set_connection_at_risk_of_loss_seconds(0);
243 SpdySession::set_trailing_ping_delay_time_ms(0); 243 SpdySession::set_trailing_ping_delay_time_ms(0);
244 SpdySession::set_hung_interval_ms(50); 244 SpdySession::set_hung_interval_ms(50);
245 245
246 session->SendPrefacePingIfNoneInFlight(); 246 session->SendPrefacePingIfNoneInFlight();
247 247
248 EXPECT_EQ(OK, callback1.WaitForResult()); 248 EXPECT_EQ(OK, callback1.WaitForResult());
249 249
250 session->CheckPingStatus(before_ping_time); 250 session->CheckPingStatus(before_ping_time);
251 251
252 EXPECT_EQ(0, session->pings_in_flight()); 252 EXPECT_EQ(0, session->pings_in_flight());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 MEDIUM, 322 MEDIUM,
323 &spdy_stream1, 323 &spdy_stream1,
324 BoundNetLog(), 324 BoundNetLog(),
325 &callback1)); 325 &callback1));
326 scoped_ptr<TestSpdyStreamDelegate> delegate( 326 scoped_ptr<TestSpdyStreamDelegate> delegate(
327 new TestSpdyStreamDelegate(&callback1)); 327 new TestSpdyStreamDelegate(&callback1));
328 spdy_stream1->SetDelegate(delegate.get()); 328 spdy_stream1->SetDelegate(delegate.get());
329 329
330 // Enable sending of PING. 330 // Enable sending of PING.
331 SpdySession::set_enable_ping_based_connection_checking(true); 331 SpdySession::set_enable_ping_based_connection_checking(true);
332 SpdySession::set_connection_at_risk_of_loss_ms(0); 332 SpdySession::set_connection_at_risk_of_loss_seconds(0);
333 SpdySession::set_trailing_ping_delay_time_ms(0); 333 SpdySession::set_trailing_ping_delay_time_ms(0);
334 SpdySession::set_hung_interval_ms(0); 334 SpdySession::set_hung_interval_ms(0);
335 335
336 // Send a PING frame. 336 // Send a PING frame.
337 session->WritePingFrame(1); 337 session->WritePingFrame(1);
338 EXPECT_LT(0, session->pings_in_flight()); 338 EXPECT_LT(0, session->pings_in_flight());
339 EXPECT_GT(session->next_ping_id(), static_cast<uint32>(1)); 339 EXPECT_GT(session->next_ping_id(), static_cast<uint32>(1));
340 EXPECT_TRUE(session->check_ping_status_pending()); 340 EXPECT_TRUE(session->check_ping_status_pending());
341 341
342 // Assert session is not closed. 342 // Assert session is not closed.
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 spdy::SpdySettings test_settings; 914 spdy::SpdySettings test_settings;
915 test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams)); 915 test_settings.push_back(spdy::SpdySetting(id, max_concurrent_streams));
916 916
917 test_settings_storage->Set(test_host_port_pair, test_settings); 917 test_settings_storage->Set(test_host_port_pair, test_settings);
918 EXPECT_NE(0u, test_settings_storage->Get(test_host_port_pair).size()); 918 EXPECT_NE(0u, test_settings_storage->Get(test_host_port_pair).size());
919 spdy_session_pool->OnIPAddressChanged(); 919 spdy_session_pool->OnIPAddressChanged();
920 EXPECT_EQ(0u, test_settings_storage->Get(test_host_port_pair).size()); 920 EXPECT_EQ(0u, test_settings_storage->Get(test_host_port_pair).size());
921 } 921 }
922 922
923 } // namespace net 923 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698