| OLD | NEW |
| 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 base::TimeDelta::FromSeconds(-1)); | 878 base::TimeDelta::FromSeconds(-1)); |
| 879 session->set_hung_interval(base::TimeDelta::FromMilliseconds(50)); | 879 session->set_hung_interval(base::TimeDelta::FromMilliseconds(50)); |
| 880 | 880 |
| 881 session->SendPrefacePingIfNoneInFlight(); | 881 session->SendPrefacePingIfNoneInFlight(); |
| 882 | 882 |
| 883 data.RunFor(2); | 883 data.RunFor(2); |
| 884 | 884 |
| 885 session->CheckPingStatus(before_ping_time); | 885 session->CheckPingStatus(before_ping_time); |
| 886 | 886 |
| 887 EXPECT_EQ(0, session->pings_in_flight()); | 887 EXPECT_EQ(0, session->pings_in_flight()); |
| 888 EXPECT_GE(session->next_ping_id(), static_cast<uint32>(1)); | 888 EXPECT_GE(session->next_ping_id(), 1U); |
| 889 EXPECT_FALSE(session->check_ping_status_pending()); | 889 EXPECT_FALSE(session->check_ping_status_pending()); |
| 890 EXPECT_GE(session->last_activity_time(), before_ping_time); | 890 EXPECT_GE(session->last_activity_time(), before_ping_time); |
| 891 | 891 |
| 892 data.RunFor(1); | 892 data.RunFor(1); |
| 893 | 893 |
| 894 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); | 894 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); |
| 895 | 895 |
| 896 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_)); | 896 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_)); |
| 897 EXPECT_TRUE(session == NULL); | 897 EXPECT_TRUE(session == NULL); |
| 898 } | 898 } |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 ASSERT_TRUE(spdy_stream1.get() != NULL); | 1295 ASSERT_TRUE(spdy_stream1.get() != NULL); |
| 1296 test::StreamDelegateSendImmediate delegate(spdy_stream1, NULL); | 1296 test::StreamDelegateSendImmediate delegate(spdy_stream1, NULL); |
| 1297 spdy_stream1->SetDelegate(&delegate); | 1297 spdy_stream1->SetDelegate(&delegate); |
| 1298 | 1298 |
| 1299 session->set_connection_at_risk_of_loss_time(base::TimeDelta::FromSeconds(0)); | 1299 session->set_connection_at_risk_of_loss_time(base::TimeDelta::FromSeconds(0)); |
| 1300 session->set_hung_interval(base::TimeDelta::FromSeconds(0)); | 1300 session->set_hung_interval(base::TimeDelta::FromSeconds(0)); |
| 1301 | 1301 |
| 1302 // Send a PING frame. | 1302 // Send a PING frame. |
| 1303 session->WritePingFrame(1, false); | 1303 session->WritePingFrame(1, false); |
| 1304 EXPECT_LT(0, session->pings_in_flight()); | 1304 EXPECT_LT(0, session->pings_in_flight()); |
| 1305 EXPECT_GE(session->next_ping_id(), static_cast<uint32>(1)); | 1305 EXPECT_GE(session->next_ping_id(), 1U); |
| 1306 EXPECT_TRUE(session->check_ping_status_pending()); | 1306 EXPECT_TRUE(session->check_ping_status_pending()); |
| 1307 | 1307 |
| 1308 // Assert session is not closed. | 1308 // Assert session is not closed. |
| 1309 EXPECT_TRUE(session->IsAvailable()); | 1309 EXPECT_TRUE(session->IsAvailable()); |
| 1310 EXPECT_LT(0u, session->num_active_streams() + session->num_created_streams()); | 1310 EXPECT_LT(0u, session->num_active_streams() + session->num_created_streams()); |
| 1311 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, key_)); | 1311 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, key_)); |
| 1312 | 1312 |
| 1313 // We set last time we have received any data in 1 sec less than now. | 1313 // We set last time we have received any data in 1 sec less than now. |
| 1314 // CheckPingStatus will trigger timeout because hung interval is zero. | 1314 // CheckPingStatus will trigger timeout because hung interval is zero. |
| 1315 base::TimeTicks now = base::TimeTicks::Now(); | 1315 base::TimeTicks now = base::TimeTicks::Now(); |
| (...skipping 3819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5135 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5135 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
| 5136 "spdy_pooling.pem"); | 5136 "spdy_pooling.pem"); |
| 5137 ssl_info.is_issued_by_known_root = true; | 5137 ssl_info.is_issued_by_known_root = true; |
| 5138 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5138 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
| 5139 | 5139 |
| 5140 EXPECT_TRUE(SpdySession::CanPool( | 5140 EXPECT_TRUE(SpdySession::CanPool( |
| 5141 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5141 &tss, ssl_info, "www.example.org", "mail.example.org")); |
| 5142 } | 5142 } |
| 5143 | 5143 |
| 5144 } // namespace net | 5144 } // namespace net |
| OLD | NEW |