OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/http/bidirectional_stream.h" | 5 #include "net/http/bidirectional_stream.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 base::WeakPtr<SpdySession> session_; | 438 base::WeakPtr<SpdySession> session_; |
439 }; | 439 }; |
440 | 440 |
441 TEST_F(BidirectionalStreamTest, CreateInsecureStream) { | 441 TEST_F(BidirectionalStreamTest, CreateInsecureStream) { |
442 std::unique_ptr<BidirectionalStreamRequestInfo> request_info( | 442 std::unique_ptr<BidirectionalStreamRequestInfo> request_info( |
443 new BidirectionalStreamRequestInfo); | 443 new BidirectionalStreamRequestInfo); |
444 request_info->method = "GET"; | 444 request_info->method = "GET"; |
445 request_info->url = GURL("http://www.example.org/"); | 445 request_info->url = GURL("http://www.example.org/"); |
446 | 446 |
447 TestDelegateBase delegate(nullptr, 0); | 447 TestDelegateBase delegate(nullptr, 0); |
448 HttpNetworkSession::Params params = | 448 std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession( |
449 SpdySessionDependencies::CreateSessionParams(&session_deps_); | 449 SpdySessionDependencies::CreateSessionParams(&session_deps_), |
450 std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession(params)); | 450 SpdySessionDependencies::CreateSessionContext(&session_deps_))); |
451 delegate.SetRunUntilCompletion(true); | 451 delegate.SetRunUntilCompletion(true); |
452 delegate.Start(std::move(request_info), session.get()); | 452 delegate.Start(std::move(request_info), session.get()); |
453 | 453 |
454 EXPECT_THAT(delegate.error(), IsError(ERR_DISALLOWED_URL_SCHEME)); | 454 EXPECT_THAT(delegate.error(), IsError(ERR_DISALLOWED_URL_SCHEME)); |
455 } | 455 } |
456 | 456 |
457 TEST_F(BidirectionalStreamTest, SimplePostRequest) { | 457 TEST_F(BidirectionalStreamTest, SimplePostRequest) { |
458 SpdySerializedFrame req(spdy_util_.ConstructSpdyPost( | 458 SpdySerializedFrame req(spdy_util_.ConstructSpdyPost( |
459 kDefaultUrl, 1, kBodyDataSize, LOW, nullptr, 0)); | 459 kDefaultUrl, 1, kBodyDataSize, LOW, nullptr, 0)); |
460 SpdySerializedFrame data_frame(spdy_util_.ConstructSpdyDataFrame( | 460 SpdySerializedFrame data_frame(spdy_util_.ConstructSpdyDataFrame( |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 // Creates a BidirectionalStream with an insecure scheme. Destroy the stream | 559 // Creates a BidirectionalStream with an insecure scheme. Destroy the stream |
560 // without waiting for the OnFailed task to be executed. | 560 // without waiting for the OnFailed task to be executed. |
561 TEST_F(BidirectionalStreamTest, | 561 TEST_F(BidirectionalStreamTest, |
562 CreateInsecureStreamAndDestroyStreamRightAfter) { | 562 CreateInsecureStreamAndDestroyStreamRightAfter) { |
563 std::unique_ptr<BidirectionalStreamRequestInfo> request_info( | 563 std::unique_ptr<BidirectionalStreamRequestInfo> request_info( |
564 new BidirectionalStreamRequestInfo); | 564 new BidirectionalStreamRequestInfo); |
565 request_info->method = "GET"; | 565 request_info->method = "GET"; |
566 request_info->url = GURL("http://www.example.org/"); | 566 request_info->url = GURL("http://www.example.org/"); |
567 | 567 |
568 std::unique_ptr<TestDelegateBase> delegate(new TestDelegateBase(nullptr, 0)); | 568 std::unique_ptr<TestDelegateBase> delegate(new TestDelegateBase(nullptr, 0)); |
569 HttpNetworkSession::Params params = | 569 std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession( |
570 SpdySessionDependencies::CreateSessionParams(&session_deps_); | 570 SpdySessionDependencies::CreateSessionParams(&session_deps_), |
571 std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession(params)); | 571 SpdySessionDependencies::CreateSessionContext(&session_deps_))); |
572 delegate->Start(std::move(request_info), session.get()); | 572 delegate->Start(std::move(request_info), session.get()); |
573 // Reset stream right before the OnFailed task is executed. | 573 // Reset stream right before the OnFailed task is executed. |
574 delegate.reset(); | 574 delegate.reset(); |
575 | 575 |
576 base::RunLoop().RunUntilIdle(); | 576 base::RunLoop().RunUntilIdle(); |
577 } | 577 } |
578 | 578 |
579 // Simulates user calling ReadData after END_STREAM has been received in | 579 // Simulates user calling ReadData after END_STREAM has been received in |
580 // BidirectionalStreamSpdyImpl. | 580 // BidirectionalStreamSpdyImpl. |
581 TEST_F(BidirectionalStreamTest, TestReadDataAfterClose) { | 581 TEST_F(BidirectionalStreamTest, TestReadDataAfterClose) { |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 AlternativeServiceInfoVector alternative_service_info_vector = | 1657 AlternativeServiceInfoVector alternative_service_info_vector = |
1658 http_session_->http_server_properties()->GetAlternativeServiceInfos( | 1658 http_session_->http_server_properties()->GetAlternativeServiceInfos( |
1659 url::SchemeHostPort(default_url_)); | 1659 url::SchemeHostPort(default_url_)); |
1660 ASSERT_EQ(1u, alternative_service_info_vector.size()); | 1660 ASSERT_EQ(1u, alternative_service_info_vector.size()); |
1661 AlternativeService alternative_service(kProtoQUIC, "www.example.org", 443); | 1661 AlternativeService alternative_service(kProtoQUIC, "www.example.org", 443); |
1662 EXPECT_EQ(alternative_service, | 1662 EXPECT_EQ(alternative_service, |
1663 alternative_service_info_vector[0].alternative_service); | 1663 alternative_service_info_vector[0].alternative_service); |
1664 } | 1664 } |
1665 | 1665 |
1666 } // namespace net | 1666 } // namespace net |
OLD | NEW |