| 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_test_util_common.h" | 5 #include "net/spdy/spdy_test_util_common.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 net_log); | 533 net_log); |
| 534 } | 534 } |
| 535 | 535 |
| 536 if (rv == ERR_IO_PENDING) | 536 if (rv == ERR_IO_PENDING) |
| 537 rv = callback.WaitForResult(); | 537 rv = callback.WaitForResult(); |
| 538 | 538 |
| 539 EXPECT_THAT(rv, IsOk()); | 539 EXPECT_THAT(rv, IsOk()); |
| 540 | 540 |
| 541 base::WeakPtr<SpdySession> spdy_session = | 541 base::WeakPtr<SpdySession> spdy_session = |
| 542 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket( | 542 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket( |
| 543 key, std::move(connection), net_log, OK, is_secure); | 543 key, std::move(connection), net_log, is_secure); |
| 544 // Failure is reported asynchronously. | 544 // Failure is reported asynchronously. |
| 545 EXPECT_TRUE(spdy_session); | 545 EXPECT_TRUE(spdy_session); |
| 546 EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key)); | 546 EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key)); |
| 547 return spdy_session; | 547 return spdy_session; |
| 548 } | 548 } |
| 549 | 549 |
| 550 } // namespace | 550 } // namespace |
| 551 | 551 |
| 552 base::WeakPtr<SpdySession> CreateInsecureSpdySession( | 552 base::WeakPtr<SpdySession> CreateInsecureSpdySession( |
| 553 HttpNetworkSession* http_session, | 553 HttpNetworkSession* http_session, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 const SpdySessionKey& key, | 636 const SpdySessionKey& key, |
| 637 Error expected_status) { | 637 Error expected_status) { |
| 638 EXPECT_NE(expected_status, ERR_IO_PENDING); | 638 EXPECT_NE(expected_status, ERR_IO_PENDING); |
| 639 EXPECT_FALSE(HasSpdySession(pool, key)); | 639 EXPECT_FALSE(HasSpdySession(pool, key)); |
| 640 std::unique_ptr<ClientSocketHandle> handle(new ClientSocketHandle()); | 640 std::unique_ptr<ClientSocketHandle> handle(new ClientSocketHandle()); |
| 641 handle->SetSocket( | 641 handle->SetSocket( |
| 642 std::unique_ptr<StreamSocket>(new FakeSpdySessionClientSocket( | 642 std::unique_ptr<StreamSocket>(new FakeSpdySessionClientSocket( |
| 643 expected_status == OK ? ERR_IO_PENDING : expected_status))); | 643 expected_status == OK ? ERR_IO_PENDING : expected_status))); |
| 644 base::WeakPtr<SpdySession> spdy_session = | 644 base::WeakPtr<SpdySession> spdy_session = |
| 645 pool->CreateAvailableSessionFromSocket( | 645 pool->CreateAvailableSessionFromSocket( |
| 646 key, std::move(handle), NetLogWithSource(), OK, true /* is_secure */); | 646 key, std::move(handle), NetLogWithSource(), true /* is_secure */); |
| 647 // Failure is reported asynchronously. | 647 // Failure is reported asynchronously. |
| 648 EXPECT_TRUE(spdy_session); | 648 EXPECT_TRUE(spdy_session); |
| 649 EXPECT_TRUE(HasSpdySession(pool, key)); | 649 EXPECT_TRUE(HasSpdySession(pool, key)); |
| 650 return spdy_session; | 650 return spdy_session; |
| 651 } | 651 } |
| 652 | 652 |
| 653 } // namespace | 653 } // namespace |
| 654 | 654 |
| 655 base::WeakPtr<SpdySession> CreateFakeSpdySession(SpdySessionPool* pool, | 655 base::WeakPtr<SpdySession> CreateFakeSpdySession(SpdySessionPool* pool, |
| 656 const SpdySessionKey& key) { | 656 const SpdySessionKey& key) { |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 headers[GetSchemeKey()] = scheme.c_str(); | 1139 headers[GetSchemeKey()] = scheme.c_str(); |
| 1140 headers[GetPathKey()] = path.c_str(); | 1140 headers[GetPathKey()] = path.c_str(); |
| 1141 if (content_length) { | 1141 if (content_length) { |
| 1142 std::string length_str = base::Int64ToString(*content_length); | 1142 std::string length_str = base::Int64ToString(*content_length); |
| 1143 headers["content-length"] = length_str; | 1143 headers["content-length"] = length_str; |
| 1144 } | 1144 } |
| 1145 return headers; | 1145 return headers; |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 } // namespace net | 1148 } // namespace net |
| OLD | NEW |