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/quic/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 request_.url = GURL("http://www.google.com/"); | 816 request_.url = GURL("http://www.google.com/"); |
817 | 817 |
818 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, | 818 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, |
819 net_log_, callback_.callback())); | 819 net_log_, callback_.callback())); |
820 | 820 |
821 // Check that priority is highest. | 821 // Check that priority is highest. |
822 QuicReliableClientStream* reliable_stream = | 822 QuicReliableClientStream* reliable_stream = |
823 QuicHttpStreamPeer::GetQuicReliableClientStream(stream_.get()); | 823 QuicHttpStreamPeer::GetQuicReliableClientStream(stream_.get()); |
824 DCHECK(reliable_stream); | 824 DCHECK(reliable_stream); |
825 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 825 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
826 reliable_stream->EffectivePriority()); | 826 reliable_stream->Priority()); |
827 | 827 |
828 EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_, | 828 EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_, |
829 callback_.callback())); | 829 callback_.callback())); |
830 | 830 |
831 // Check that priority has now dropped back to MEDIUM. | 831 // Check that priority has now dropped back to MEDIUM. |
832 DCHECK_EQ(MEDIUM, ConvertQuicPriorityToRequestPriority( | 832 DCHECK_EQ(MEDIUM, ConvertQuicPriorityToRequestPriority( |
833 reliable_stream->EffectivePriority())); | 833 reliable_stream->Priority())); |
834 | 834 |
835 // Ack the request. | 835 // Ack the request. |
836 ProcessPacket(ConstructAckPacket(1, 0, 0)); | 836 ProcessPacket(ConstructAckPacket(1, 0, 0)); |
837 EXPECT_EQ(ERR_IO_PENDING, | 837 EXPECT_EQ(ERR_IO_PENDING, |
838 stream_->ReadResponseHeaders(callback_.callback())); | 838 stream_->ReadResponseHeaders(callback_.callback())); |
839 | 839 |
840 // Send the response with a body. | 840 // Send the response with a body. |
841 SetResponse("404 OK", "hello world!"); | 841 SetResponse("404 OK", "hello world!"); |
842 // In the course of processing this packet, the QuicHttpStream close itself. | 842 // In the course of processing this packet, the QuicHttpStream close itself. |
843 ProcessPacket(ConstructResponseHeadersPacket(2, kFin, nullptr)); | 843 ProcessPacket(ConstructResponseHeadersPacket(2, kFin, nullptr)); |
(...skipping 25 matching lines...) Expand all Loading... |
869 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, | 869 EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, |
870 net_log_, callback_.callback())); | 870 net_log_, callback_.callback())); |
871 | 871 |
872 // Check that priority is highest. | 872 // Check that priority is highest. |
873 QuicReliableClientStream* reliable_stream = | 873 QuicReliableClientStream* reliable_stream = |
874 QuicHttpStreamPeer::GetQuicReliableClientStream(stream_.get()); | 874 QuicHttpStreamPeer::GetQuicReliableClientStream(stream_.get()); |
875 DCHECK(reliable_stream); | 875 DCHECK(reliable_stream); |
876 QuicReliableClientStream::Delegate* delegate = reliable_stream->GetDelegate(); | 876 QuicReliableClientStream::Delegate* delegate = reliable_stream->GetDelegate(); |
877 DCHECK(delegate); | 877 DCHECK(delegate); |
878 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 878 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
879 reliable_stream->EffectivePriority()); | 879 reliable_stream->Priority()); |
880 | 880 |
881 // Set Delegate to nullptr and make sure EffectivePriority returns highest | 881 // Set Delegate to nullptr and make sure Priority returns highest |
882 // priority. | 882 // priority. |
883 reliable_stream->SetDelegate(nullptr); | 883 reliable_stream->SetDelegate(nullptr); |
884 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 884 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
885 reliable_stream->EffectivePriority()); | 885 reliable_stream->Priority()); |
886 reliable_stream->SetDelegate(delegate); | 886 reliable_stream->SetDelegate(delegate); |
887 | 887 |
888 EXPECT_EQ(0, stream_->GetTotalSentBytes()); | 888 EXPECT_EQ(0, stream_->GetTotalSentBytes()); |
889 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 889 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
890 } | 890 } |
891 | 891 |
892 } // namespace test | 892 } // namespace test |
893 } // namespace net | 893 } // namespace net |
OLD | NEW |