| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 SpdyStream* stream_ptr = stream.get(); | 914 SpdyStream* stream_ptr = stream.get(); |
| 915 session->InsertCreatedStream(stream.Pass()); | 915 session->InsertCreatedStream(stream.Pass()); |
| 916 stream = session->ActivateCreatedStream(stream_ptr); | 916 stream = session->ActivateCreatedStream(stream_ptr); |
| 917 session->InsertActivatedStream(stream.Pass()); | 917 session->InsertActivatedStream(stream.Pass()); |
| 918 | 918 |
| 919 SpdyHeaderBlock headers; | 919 SpdyHeaderBlock headers; |
| 920 spdy_util_.AddUrlToHeaderBlock("http://www.google.com/a.dat", &headers); | 920 spdy_util_.AddUrlToHeaderBlock("http://www.google.com/a.dat", &headers); |
| 921 | 921 |
| 922 // OnSynStream() expects |in_io_loop_| to be true. | 922 // OnSynStream() expects |in_io_loop_| to be true. |
| 923 session->in_io_loop_ = true; | 923 session->in_io_loop_ = true; |
| 924 session->OnSynStream(2, 1, 0, 0, true, false, headers); | 924 session->OnSynStream(2, 1, 0, true, false, headers); |
| 925 session->in_io_loop_ = false; | 925 session->in_io_loop_ = false; |
| 926 | 926 |
| 927 // Verify that there is one unclaimed push stream. | 927 // Verify that there is one unclaimed push stream. |
| 928 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams()); | 928 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams()); |
| 929 SpdySession::PushedStreamMap::iterator iter = | 929 SpdySession::PushedStreamMap::iterator iter = |
| 930 session->unclaimed_pushed_streams_.find( | 930 session->unclaimed_pushed_streams_.find( |
| 931 GURL("http://www.google.com/a.dat")); | 931 GURL("http://www.google.com/a.dat")); |
| 932 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter); | 932 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter); |
| 933 | 933 |
| 934 // Shift time to expire the push stream. | 934 // Shift time to expire the push stream. |
| 935 g_time_delta = base::TimeDelta::FromSeconds(301); | 935 g_time_delta = base::TimeDelta::FromSeconds(301); |
| 936 | 936 |
| 937 spdy_util_.AddUrlToHeaderBlock("http://www.google.com/b.dat", &headers); | 937 spdy_util_.AddUrlToHeaderBlock("http://www.google.com/b.dat", &headers); |
| 938 session->in_io_loop_ = true; | 938 session->in_io_loop_ = true; |
| 939 session->OnSynStream(4, 1, 0, 0, true, false, headers); | 939 session->OnSynStream(4, 1, 0, true, false, headers); |
| 940 session->in_io_loop_ = false; | 940 session->in_io_loop_ = false; |
| 941 | 941 |
| 942 // Verify that the second pushed stream evicted the first pushed stream. | 942 // Verify that the second pushed stream evicted the first pushed stream. |
| 943 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams()); | 943 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams()); |
| 944 iter = session->unclaimed_pushed_streams_.find( | 944 iter = session->unclaimed_pushed_streams_.find( |
| 945 GURL("http://www.google.com/b.dat")); | 945 GURL("http://www.google.com/b.dat")); |
| 946 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter); | 946 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter); |
| 947 } | 947 } |
| 948 | 948 |
| 949 TEST_P(SpdySessionTest, FailedPing) { | 949 TEST_P(SpdySessionTest, FailedPing) { |
| (...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4156 TEST(MapRstStreamStatusToProtocolError, MapsValues) { | 4156 TEST(MapRstStreamStatusToProtocolError, MapsValues) { |
| 4157 CHECK_EQ(STATUS_CODE_PROTOCOL_ERROR, | 4157 CHECK_EQ(STATUS_CODE_PROTOCOL_ERROR, |
| 4158 MapRstStreamStatusToProtocolError( | 4158 MapRstStreamStatusToProtocolError( |
| 4159 RST_STREAM_PROTOCOL_ERROR)); | 4159 RST_STREAM_PROTOCOL_ERROR)); |
| 4160 CHECK_EQ(STATUS_CODE_FRAME_TOO_LARGE, | 4160 CHECK_EQ(STATUS_CODE_FRAME_TOO_LARGE, |
| 4161 MapRstStreamStatusToProtocolError( | 4161 MapRstStreamStatusToProtocolError( |
| 4162 RST_STREAM_FRAME_TOO_LARGE)); | 4162 RST_STREAM_FRAME_TOO_LARGE)); |
| 4163 } | 4163 } |
| 4164 | 4164 |
| 4165 } // namespace net | 4165 } // namespace net |
| OLD | NEW |