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

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

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 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
« no previous file with comments | « net/spdy/spdy_session_spdy2_unittest.cc ('k') | net/spdy/spdy_stream.cc » ('j') | 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) 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 // Give the session a SPDY3 framer. 414 // Give the session a SPDY3 framer.
415 session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(SPDY3, false)); 415 session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(SPDY3, false));
416 416
417 // Create the associated stream and add to active streams. 417 // Create the associated stream and add to active streams.
418 scoped_ptr<SpdyHeaderBlock> request_headers(new SpdyHeaderBlock); 418 scoped_ptr<SpdyHeaderBlock> request_headers(new SpdyHeaderBlock);
419 (*request_headers)[":scheme"] = "http"; 419 (*request_headers)[":scheme"] = "http";
420 (*request_headers)[":host"] = "www.google.com"; 420 (*request_headers)[":host"] = "www.google.com";
421 (*request_headers)[":path"] = "/"; 421 (*request_headers)[":path"] = "/";
422 422
423 scoped_ptr<SpdyStream> stream( 423 scoped_ptr<SpdyStream> stream(new SpdyStream(SPDY_REQUEST_RESPONSE_STREAM,
424 new SpdyStream( 424 session.get(),
425 SPDY_REQUEST_RESPONSE_STREAM, 425 std::string(),
426 session, std::string(), DEFAULT_PRIORITY, 426 DEFAULT_PRIORITY,
427 kSpdyStreamInitialWindowSize, 427 kSpdyStreamInitialWindowSize,
428 kSpdyStreamInitialWindowSize, 428 kSpdyStreamInitialWindowSize,
429 session->net_log_)); 429 session->net_log_));
430 stream->SendRequestHeaders(request_headers.Pass(), NO_MORE_DATA_TO_SEND); 430 stream->SendRequestHeaders(request_headers.Pass(), NO_MORE_DATA_TO_SEND);
431 SpdyStream* stream_ptr = stream.get(); 431 SpdyStream* stream_ptr = stream.get();
432 session->InsertCreatedStream(stream.Pass()); 432 session->InsertCreatedStream(stream.Pass());
433 stream = session->ActivateCreatedStream(stream_ptr); 433 stream = session->ActivateCreatedStream(stream_ptr);
434 session->InsertActivatedStream(stream.Pass()); 434 session->InsertActivatedStream(stream.Pass());
435 435
436 SpdyHeaderBlock headers; 436 SpdyHeaderBlock headers;
437 headers[":scheme"] = "http"; 437 headers[":scheme"] = "http";
438 headers[":host"] = "www.google.com"; 438 headers[":host"] = "www.google.com";
439 headers[":path"] = "/a.dat"; 439 headers[":path"] = "/a.dat";
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 HostPortPair test_host_port_pair(test_hosts[0].name, kTestPort); 1016 HostPortPair test_host_port_pair(test_hosts[0].name, kTestPort);
1017 1017
1018 // Initialize session for the first host. 1018 // Initialize session for the first host.
1019 scoped_refptr<TransportSocketParams> transport_params( 1019 scoped_refptr<TransportSocketParams> transport_params(
1020 new TransportSocketParams(test_host_port_pair, 1020 new TransportSocketParams(test_host_port_pair,
1021 MEDIUM, 1021 MEDIUM,
1022 false, 1022 false,
1023 false, 1023 false,
1024 OnHostResolutionCallback())); 1024 OnHostResolutionCallback()));
1025 IPPoolingInitializedSession(test_host_port_pair.ToString(), 1025 IPPoolingInitializedSession(test_host_port_pair.ToString(),
1026 transport_params, http_session, session); 1026 transport_params,
1027 http_session.get(),
1028 session.get());
1027 1029
1028 // TODO(rtenneti): MockClientSocket::GetPeerAddress return's 0 as the port 1030 // TODO(rtenneti): MockClientSocket::GetPeerAddress return's 0 as the port
1029 // number. Fix it to return port 80 and then use GetPeerAddress to AddAlias. 1031 // number. Fix it to return port 80 and then use GetPeerAddress to AddAlias.
1030 SpdySessionPoolPeer pool_peer(spdy_session_pool); 1032 SpdySessionPoolPeer pool_peer(spdy_session_pool);
1031 pool_peer.AddAlias(test_hosts[0].addresses.front(), test_hosts[0].key); 1033 pool_peer.AddAlias(test_hosts[0].addresses.front(), test_hosts[0].key);
1032 1034
1033 // Flush the SpdySession::OnReadComplete() task. 1035 // Flush the SpdySession::OnReadComplete() task.
1034 base::MessageLoop::current()->RunUntilIdle(); 1036 base::MessageLoop::current()->RunUntilIdle();
1035 1037
1036 // The third host has no overlap with the first, so it can't pool IPs. 1038 // The third host has no overlap with the first, so it can't pool IPs.
(...skipping 16 matching lines...) Expand all
1053 spdy_session_pool->Get(test_hosts[2].key, BoundNetLog()); 1055 spdy_session_pool->Get(test_hosts[2].key, BoundNetLog());
1054 1056
1055 // Verify that we have sessions for everything. 1057 // Verify that we have sessions for everything.
1056 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[0].key)); 1058 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[0].key));
1057 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].key)); 1059 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].key));
1058 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[2].key)); 1060 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[2].key));
1059 1061
1060 // Initialize session for host 2. 1062 // Initialize session for host 2.
1061 session_deps.socket_factory->AddSocketDataProvider(&data); 1063 session_deps.socket_factory->AddSocketDataProvider(&data);
1062 IPPoolingInitializedSession(test_hosts[2].key.host_port_pair().ToString(), 1064 IPPoolingInitializedSession(test_hosts[2].key.host_port_pair().ToString(),
1063 transport_params, http_session, session2); 1065 transport_params,
1066 http_session.get(),
1067 session2.get());
1064 1068
1065 // Grab the session to host 1 and verify that it is the same session 1069 // Grab the session to host 1 and verify that it is the same session
1066 // we got with host 0, and that is a different than host 2's session. 1070 // we got with host 0, and that is a different than host 2's session.
1067 scoped_refptr<SpdySession> session1 = 1071 scoped_refptr<SpdySession> session1 =
1068 spdy_session_pool->Get(test_hosts[1].key, BoundNetLog()); 1072 spdy_session_pool->Get(test_hosts[1].key, BoundNetLog());
1069 EXPECT_EQ(session.get(), session1.get()); 1073 EXPECT_EQ(session.get(), session1.get());
1070 EXPECT_NE(session2.get(), session1.get()); 1074 EXPECT_NE(session2.get(), session1.get());
1071 1075
1072 // Initialize session for host 1. 1076 // Initialize session for host 1.
1073 session_deps.socket_factory->AddSocketDataProvider(&data); 1077 session_deps.socket_factory->AddSocketDataProvider(&data);
1074 IPPoolingInitializedSession(test_hosts[2].key.host_port_pair().ToString(), 1078 IPPoolingInitializedSession(test_hosts[2].key.host_port_pair().ToString(),
1075 transport_params, http_session, session2); 1079 transport_params,
1080 http_session.get(),
1081 session2.get());
1076 1082
1077 // Remove the aliases and observe that we still have a session for host1. 1083 // Remove the aliases and observe that we still have a session for host1.
1078 pool_peer.RemoveAliases(test_hosts[0].key); 1084 pool_peer.RemoveAliases(test_hosts[0].key);
1079 pool_peer.RemoveAliases(test_hosts[1].key); 1085 pool_peer.RemoveAliases(test_hosts[1].key);
1080 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].key)); 1086 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].key));
1081 1087
1082 // Expire the host cache 1088 // Expire the host cache
1083 session_deps.host_resolver->GetHostCache()->clear(); 1089 session_deps.host_resolver->GetHostCache()->clear();
1084 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].key)); 1090 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[1].key));
1085 1091
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 EXPECT_FALSE(stream->HasUrl()); 3025 EXPECT_FALSE(stream->HasUrl());
3020 EXPECT_FALSE(stream->send_stalled_by_flow_control()); 3026 EXPECT_FALSE(stream->send_stalled_by_flow_control());
3021 3027
3022 scoped_ptr<SpdyHeaderBlock> headers( 3028 scoped_ptr<SpdyHeaderBlock> headers(
3023 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize)); 3029 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize));
3024 EXPECT_EQ(ERR_IO_PENDING, 3030 EXPECT_EQ(ERR_IO_PENDING,
3025 stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND)); 3031 stream->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND));
3026 EXPECT_TRUE(stream->HasUrl()); 3032 EXPECT_TRUE(stream->HasUrl());
3027 EXPECT_EQ(kStreamUrl, stream->GetUrl().spec()); 3033 EXPECT_EQ(kStreamUrl, stream->GetUrl().spec());
3028 3034
3029 stall_fn.Run(session, stream); 3035 stall_fn.Run(session.get(), stream);
3030 3036
3031 data.RunFor(2); 3037 data.RunFor(2);
3032 3038
3033 EXPECT_TRUE(stream->send_stalled_by_flow_control()); 3039 EXPECT_TRUE(stream->send_stalled_by_flow_control());
3034 3040
3035 unstall_function.Run(session, stream, kBodyDataSize); 3041 unstall_function.Run(session.get(), stream, kBodyDataSize);
3036 3042
3037 EXPECT_FALSE(stream->send_stalled_by_flow_control()); 3043 EXPECT_FALSE(stream->send_stalled_by_flow_control());
3038 3044
3039 data.RunFor(3); 3045 data.RunFor(3);
3040 3046
3041 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); 3047 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose());
3042 3048
3043 EXPECT_TRUE(delegate.send_headers_completed()); 3049 EXPECT_TRUE(delegate.send_headers_completed());
3044 EXPECT_EQ("200", delegate.GetResponseHeaderValue(":status")); 3050 EXPECT_EQ("200", delegate.GetResponseHeaderValue(":status"));
3045 EXPECT_EQ("HTTP/1.1", delegate.GetResponseHeaderValue(":version")); 3051 EXPECT_EQ("HTTP/1.1", delegate.GetResponseHeaderValue(":version"));
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3172 ASSERT_TRUE(stream2.get() != NULL); 3178 ASSERT_TRUE(stream2.get() != NULL);
3173 3179
3174 test::StreamDelegateWithBody delegate2(stream2, kBodyDataStringPiece); 3180 test::StreamDelegateWithBody delegate2(stream2, kBodyDataStringPiece);
3175 stream2->SetDelegate(&delegate2); 3181 stream2->SetDelegate(&delegate2);
3176 3182
3177 EXPECT_FALSE(stream2->HasUrl()); 3183 EXPECT_FALSE(stream2->HasUrl());
3178 3184
3179 EXPECT_FALSE(stream1->send_stalled_by_flow_control()); 3185 EXPECT_FALSE(stream1->send_stalled_by_flow_control());
3180 EXPECT_FALSE(stream2->send_stalled_by_flow_control()); 3186 EXPECT_FALSE(stream2->send_stalled_by_flow_control());
3181 3187
3182 StallSessionSend(session); 3188 StallSessionSend(session.get());
3183 3189
3184 scoped_ptr<SpdyHeaderBlock> headers1( 3190 scoped_ptr<SpdyHeaderBlock> headers1(
3185 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize)); 3191 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize));
3186 EXPECT_EQ(ERR_IO_PENDING, 3192 EXPECT_EQ(ERR_IO_PENDING,
3187 stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND)); 3193 stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND));
3188 EXPECT_TRUE(stream1->HasUrl()); 3194 EXPECT_TRUE(stream1->HasUrl());
3189 EXPECT_EQ(kStreamUrl, stream1->GetUrl().spec()); 3195 EXPECT_EQ(kStreamUrl, stream1->GetUrl().spec());
3190 3196
3191 data.RunFor(2); 3197 data.RunFor(2);
3192 EXPECT_EQ(1u, stream1->stream_id()); 3198 EXPECT_EQ(1u, stream1->stream_id());
3193 EXPECT_TRUE(stream1->send_stalled_by_flow_control()); 3199 EXPECT_TRUE(stream1->send_stalled_by_flow_control());
3194 3200
3195 scoped_ptr<SpdyHeaderBlock> headers2( 3201 scoped_ptr<SpdyHeaderBlock> headers2(
3196 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize)); 3202 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize));
3197 EXPECT_EQ(ERR_IO_PENDING, 3203 EXPECT_EQ(ERR_IO_PENDING,
3198 stream2->SendRequestHeaders(headers2.Pass(), MORE_DATA_TO_SEND)); 3204 stream2->SendRequestHeaders(headers2.Pass(), MORE_DATA_TO_SEND));
3199 EXPECT_TRUE(stream2->HasUrl()); 3205 EXPECT_TRUE(stream2->HasUrl());
3200 EXPECT_EQ(kStreamUrl, stream2->GetUrl().spec()); 3206 EXPECT_EQ(kStreamUrl, stream2->GetUrl().spec());
3201 3207
3202 data.RunFor(1); 3208 data.RunFor(1);
3203 EXPECT_EQ(3u, stream2->stream_id()); 3209 EXPECT_EQ(3u, stream2->stream_id());
3204 EXPECT_TRUE(stream2->send_stalled_by_flow_control()); 3210 EXPECT_TRUE(stream2->send_stalled_by_flow_control());
3205 3211
3206 // This should unstall only stream2. 3212 // This should unstall only stream2.
3207 UnstallSessionSend(session, kBodyDataSize); 3213 UnstallSessionSend(session.get(), kBodyDataSize);
3208 3214
3209 EXPECT_TRUE(stream1->send_stalled_by_flow_control()); 3215 EXPECT_TRUE(stream1->send_stalled_by_flow_control());
3210 EXPECT_FALSE(stream2->send_stalled_by_flow_control()); 3216 EXPECT_FALSE(stream2->send_stalled_by_flow_control());
3211 3217
3212 data.RunFor(1); 3218 data.RunFor(1);
3213 3219
3214 EXPECT_TRUE(stream1->send_stalled_by_flow_control()); 3220 EXPECT_TRUE(stream1->send_stalled_by_flow_control());
3215 EXPECT_FALSE(stream2->send_stalled_by_flow_control()); 3221 EXPECT_FALSE(stream2->send_stalled_by_flow_control());
3216 3222
3217 // This should then unstall stream1. 3223 // This should then unstall stream1.
3218 UnstallSessionSend(session, kBodyDataSize); 3224 UnstallSessionSend(session.get(), kBodyDataSize);
3219 3225
3220 EXPECT_FALSE(stream1->send_stalled_by_flow_control()); 3226 EXPECT_FALSE(stream1->send_stalled_by_flow_control());
3221 EXPECT_FALSE(stream2->send_stalled_by_flow_control()); 3227 EXPECT_FALSE(stream2->send_stalled_by_flow_control());
3222 3228
3223 data.RunFor(4); 3229 data.RunFor(4);
3224 3230
3225 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate1.WaitForClose()); 3231 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate1.WaitForClose());
3226 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate2.WaitForClose()); 3232 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate2.WaitForClose());
3227 3233
3228 EXPECT_TRUE(delegate1.send_headers_completed()); 3234 EXPECT_TRUE(delegate1.send_headers_completed());
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 3345
3340 test::StreamDelegateWithBody delegate3(stream3, kBodyDataStringPiece); 3346 test::StreamDelegateWithBody delegate3(stream3, kBodyDataStringPiece);
3341 stream3->SetDelegate(&delegate3); 3347 stream3->SetDelegate(&delegate3);
3342 3348
3343 EXPECT_FALSE(stream3->HasUrl()); 3349 EXPECT_FALSE(stream3->HasUrl());
3344 3350
3345 EXPECT_FALSE(stream1->send_stalled_by_flow_control()); 3351 EXPECT_FALSE(stream1->send_stalled_by_flow_control());
3346 EXPECT_FALSE(stream2->send_stalled_by_flow_control()); 3352 EXPECT_FALSE(stream2->send_stalled_by_flow_control());
3347 EXPECT_FALSE(stream3->send_stalled_by_flow_control()); 3353 EXPECT_FALSE(stream3->send_stalled_by_flow_control());
3348 3354
3349 StallSessionSend(session); 3355 StallSessionSend(session.get());
3350 3356
3351 scoped_ptr<SpdyHeaderBlock> headers1( 3357 scoped_ptr<SpdyHeaderBlock> headers1(
3352 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize)); 3358 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize));
3353 EXPECT_EQ(ERR_IO_PENDING, 3359 EXPECT_EQ(ERR_IO_PENDING,
3354 stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND)); 3360 stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND));
3355 EXPECT_TRUE(stream1->HasUrl()); 3361 EXPECT_TRUE(stream1->HasUrl());
3356 EXPECT_EQ(kStreamUrl, stream1->GetUrl().spec()); 3362 EXPECT_EQ(kStreamUrl, stream1->GetUrl().spec());
3357 3363
3358 data.RunFor(2); 3364 data.RunFor(2);
3359 EXPECT_EQ(1u, stream1->stream_id()); 3365 EXPECT_EQ(1u, stream1->stream_id());
(...skipping 28 matching lines...) Expand all
3388 // Close stream1 preemptively. 3394 // Close stream1 preemptively.
3389 session->CloseActiveStream(stream_id1, ERR_CONNECTION_CLOSED); 3395 session->CloseActiveStream(stream_id1, ERR_CONNECTION_CLOSED);
3390 EXPECT_EQ(NULL, stream1.get()); 3396 EXPECT_EQ(NULL, stream1.get());
3391 3397
3392 EXPECT_FALSE(session->IsStreamActive(stream_id1)); 3398 EXPECT_FALSE(session->IsStreamActive(stream_id1));
3393 EXPECT_TRUE(session->IsStreamActive(stream_id2)); 3399 EXPECT_TRUE(session->IsStreamActive(stream_id2));
3394 EXPECT_TRUE(session->IsStreamActive(stream_id3)); 3400 EXPECT_TRUE(session->IsStreamActive(stream_id3));
3395 3401
3396 // Unstall stream2, which should then close stream3. 3402 // Unstall stream2, which should then close stream3.
3397 delegate2.set_stream_to_close(stream3); 3403 delegate2.set_stream_to_close(stream3);
3398 UnstallSessionSend(session, kBodyDataSize); 3404 UnstallSessionSend(session.get(), kBodyDataSize);
3399 3405
3400 data.RunFor(1); 3406 data.RunFor(1);
3401 EXPECT_EQ(NULL, stream3.get()); 3407 EXPECT_EQ(NULL, stream3.get());
3402 3408
3403 EXPECT_FALSE(stream2->send_stalled_by_flow_control()); 3409 EXPECT_FALSE(stream2->send_stalled_by_flow_control());
3404 EXPECT_FALSE(session->IsStreamActive(stream_id1)); 3410 EXPECT_FALSE(session->IsStreamActive(stream_id1));
3405 EXPECT_TRUE(session->IsStreamActive(stream_id2)); 3411 EXPECT_TRUE(session->IsStreamActive(stream_id2));
3406 EXPECT_FALSE(session->IsStreamActive(stream_id3)); 3412 EXPECT_FALSE(session->IsStreamActive(stream_id3));
3407 3413
3408 data.RunFor(2); 3414 data.RunFor(2);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3486 ASSERT_TRUE(stream2.get() != NULL); 3492 ASSERT_TRUE(stream2.get() != NULL);
3487 3493
3488 test::StreamDelegateWithBody delegate2(stream2, kBodyDataStringPiece); 3494 test::StreamDelegateWithBody delegate2(stream2, kBodyDataStringPiece);
3489 stream2->SetDelegate(&delegate2); 3495 stream2->SetDelegate(&delegate2);
3490 3496
3491 EXPECT_FALSE(stream2->HasUrl()); 3497 EXPECT_FALSE(stream2->HasUrl());
3492 3498
3493 EXPECT_FALSE(stream1->send_stalled_by_flow_control()); 3499 EXPECT_FALSE(stream1->send_stalled_by_flow_control());
3494 EXPECT_FALSE(stream2->send_stalled_by_flow_control()); 3500 EXPECT_FALSE(stream2->send_stalled_by_flow_control());
3495 3501
3496 StallSessionSend(session); 3502 StallSessionSend(session.get());
3497 3503
3498 scoped_ptr<SpdyHeaderBlock> headers1( 3504 scoped_ptr<SpdyHeaderBlock> headers1(
3499 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize)); 3505 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize));
3500 EXPECT_EQ(ERR_IO_PENDING, 3506 EXPECT_EQ(ERR_IO_PENDING,
3501 stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND)); 3507 stream1->SendRequestHeaders(headers1.Pass(), MORE_DATA_TO_SEND));
3502 EXPECT_TRUE(stream1->HasUrl()); 3508 EXPECT_TRUE(stream1->HasUrl());
3503 EXPECT_EQ(kStreamUrl, stream1->GetUrl().spec()); 3509 EXPECT_EQ(kStreamUrl, stream1->GetUrl().spec());
3504 3510
3505 data.RunFor(2); 3511 data.RunFor(2);
3506 EXPECT_EQ(1u, stream1->stream_id()); 3512 EXPECT_EQ(1u, stream1->stream_id());
3507 EXPECT_TRUE(stream1->send_stalled_by_flow_control()); 3513 EXPECT_TRUE(stream1->send_stalled_by_flow_control());
3508 3514
3509 scoped_ptr<SpdyHeaderBlock> headers2( 3515 scoped_ptr<SpdyHeaderBlock> headers2(
3510 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize)); 3516 spdy_util_.ConstructPostHeaderBlock(kStreamUrl, kBodyDataSize));
3511 EXPECT_EQ(ERR_IO_PENDING, 3517 EXPECT_EQ(ERR_IO_PENDING,
3512 stream2->SendRequestHeaders(headers2.Pass(), MORE_DATA_TO_SEND)); 3518 stream2->SendRequestHeaders(headers2.Pass(), MORE_DATA_TO_SEND));
3513 EXPECT_TRUE(stream2->HasUrl()); 3519 EXPECT_TRUE(stream2->HasUrl());
3514 EXPECT_EQ(kStreamUrl, stream2->GetUrl().spec()); 3520 EXPECT_EQ(kStreamUrl, stream2->GetUrl().spec());
3515 3521
3516 data.RunFor(1); 3522 data.RunFor(1);
3517 EXPECT_EQ(3u, stream2->stream_id()); 3523 EXPECT_EQ(3u, stream2->stream_id());
3518 EXPECT_TRUE(stream2->send_stalled_by_flow_control()); 3524 EXPECT_TRUE(stream2->send_stalled_by_flow_control());
3519 3525
3520 EXPECT_TRUE(spdy_session_pool_->HasSession(key_)); 3526 EXPECT_TRUE(spdy_session_pool_->HasSession(key_));
3521 3527
3522 // Unstall stream1. 3528 // Unstall stream1.
3523 UnstallSessionSend(session, kBodyDataSize); 3529 UnstallSessionSend(session.get(), kBodyDataSize);
3524 3530
3525 // Close the session (since we can't do it from within the delegate 3531 // Close the session (since we can't do it from within the delegate
3526 // method, since it's in the stream's loop). 3532 // method, since it's in the stream's loop).
3527 session->CloseSessionOnError(ERR_CONNECTION_CLOSED, true, "Closing session"); 3533 session->CloseSessionOnError(ERR_CONNECTION_CLOSED, true, "Closing session");
3528 session = NULL; 3534 session = NULL;
3529 3535
3530 EXPECT_FALSE(spdy_session_pool_->HasSession(key_)); 3536 EXPECT_FALSE(spdy_session_pool_->HasSession(key_));
3531 3537
3532 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate1.WaitForClose()); 3538 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate1.WaitForClose());
3533 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate2.WaitForClose()); 3539 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate2.WaitForClose());
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
3865 spdy_session_pool_->Remove(session_privacy_enabled); 3871 spdy_session_pool_->Remove(session_privacy_enabled);
3866 EXPECT_FALSE(spdy_session_pool_->HasSession(key_privacy_enabled)); 3872 EXPECT_FALSE(spdy_session_pool_->HasSession(key_privacy_enabled));
3867 EXPECT_TRUE(spdy_session_pool_->HasSession(key_privacy_disabled)); 3873 EXPECT_TRUE(spdy_session_pool_->HasSession(key_privacy_disabled));
3868 3874
3869 spdy_session_pool_->Remove(session_privacy_disabled); 3875 spdy_session_pool_->Remove(session_privacy_disabled);
3870 EXPECT_FALSE(spdy_session_pool_->HasSession(key_privacy_enabled)); 3876 EXPECT_FALSE(spdy_session_pool_->HasSession(key_privacy_enabled));
3871 EXPECT_FALSE(spdy_session_pool_->HasSession(key_privacy_disabled)); 3877 EXPECT_FALSE(spdy_session_pool_->HasSession(key_privacy_disabled));
3872 } 3878 }
3873 3879
3874 } // namespace net 3880 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_spdy2_unittest.cc ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698