OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_pool.h" | 5 #include "net/spdy/spdy_session_pool.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "net/dns/host_cache.h" | 13 #include "net/dns/host_cache.h" |
13 #include "net/http/http_network_session.h" | 14 #include "net/http/http_network_session.h" |
14 #include "net/socket/client_socket_handle.h" | 15 #include "net/socket/client_socket_handle.h" |
15 #include "net/socket/transport_client_socket_pool.h" | 16 #include "net/socket/transport_client_socket_pool.h" |
16 #include "net/spdy/spdy_session.h" | 17 #include "net/spdy/spdy_session.h" |
17 #include "net/spdy/spdy_stream_test_util.h" | 18 #include "net/spdy/spdy_stream_test_util.h" |
18 #include "net/spdy/spdy_test_util_common.h" | 19 #include "net/spdy/spdy_test_util_common.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 CreateInsecureSpdySession(http_session_.get(), keyA, BoundNetLog()); | 549 CreateInsecureSpdySession(http_session_.get(), keyA, BoundNetLog()); |
549 | 550 |
550 GURL urlA(kTestHostA); | 551 GURL urlA(kTestHostA); |
551 base::WeakPtr<SpdyStream> spdy_streamA = CreateStreamSynchronously( | 552 base::WeakPtr<SpdyStream> spdy_streamA = CreateStreamSynchronously( |
552 SPDY_BIDIRECTIONAL_STREAM, sessionA, urlA, MEDIUM, BoundNetLog()); | 553 SPDY_BIDIRECTIONAL_STREAM, sessionA, urlA, MEDIUM, BoundNetLog()); |
553 test::StreamDelegateDoNothing delegateA(spdy_streamA); | 554 test::StreamDelegateDoNothing delegateA(spdy_streamA); |
554 spdy_streamA->SetDelegate(&delegateA); | 555 spdy_streamA->SetDelegate(&delegateA); |
555 | 556 |
556 scoped_ptr<SpdyHeaderBlock> headers( | 557 scoped_ptr<SpdyHeaderBlock> headers( |
557 spdy_util.ConstructGetHeaderBlock(urlA.spec())); | 558 spdy_util.ConstructGetHeaderBlock(urlA.spec())); |
558 spdy_streamA->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); | 559 spdy_streamA->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND); |
559 EXPECT_TRUE(spdy_streamA->HasUrlFromHeaders()); | 560 EXPECT_TRUE(spdy_streamA->HasUrlFromHeaders()); |
560 | 561 |
561 base::MessageLoop::current()->RunUntilIdle(); // Allow headers to write. | 562 base::MessageLoop::current()->RunUntilIdle(); // Allow headers to write. |
562 EXPECT_TRUE(delegateA.send_headers_completed()); | 563 EXPECT_TRUE(delegateA.send_headers_completed()); |
563 | 564 |
564 sessionA->MakeUnavailable(); | 565 sessionA->MakeUnavailable(); |
565 EXPECT_TRUE(sessionA->IsGoingAway()); | 566 EXPECT_TRUE(sessionA->IsGoingAway()); |
566 EXPECT_FALSE(delegateA.StreamIsClosed()); | 567 EXPECT_FALSE(delegateA.StreamIsClosed()); |
567 | 568 |
568 // Set up session B: Available, with a created stream. | 569 // Set up session B: Available, with a created stream. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // Both streams were closed with an error. | 627 // Both streams were closed with an error. |
627 EXPECT_TRUE(delegateA.StreamIsClosed()); | 628 EXPECT_TRUE(delegateA.StreamIsClosed()); |
628 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose()); | 629 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose()); |
629 EXPECT_TRUE(delegateB.StreamIsClosed()); | 630 EXPECT_TRUE(delegateB.StreamIsClosed()); |
630 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose()); | 631 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose()); |
631 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) | 632 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) |
632 SpdySession::SetPriorityDependencyDefaultForTesting(false); | 633 SpdySession::SetPriorityDependencyDefaultForTesting(false); |
633 } | 634 } |
634 | 635 |
635 } // namespace net | 636 } // namespace net |
OLD | NEW |