OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/bidirectional_stream_spdy_impl.h" | 5 #include "net/spdy/bidirectional_stream_spdy_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 EXPECT_EQ(0, delegate->on_data_sent_count()); | 299 EXPECT_EQ(0, delegate->on_data_sent_count()); |
300 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); | 300 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); |
301 // BidirectionalStreamSpdyStreamJob does not count the bytes sent for |rst| | 301 // BidirectionalStreamSpdyStreamJob does not count the bytes sent for |rst| |
302 // because it is sent after SpdyStream::Delegate::OnClose is called. | 302 // because it is sent after SpdyStream::Delegate::OnClose is called. |
303 EXPECT_EQ(CountWriteBytes(writes, 1), delegate->GetTotalSentBytes()); | 303 EXPECT_EQ(CountWriteBytes(writes, 1), delegate->GetTotalSentBytes()); |
304 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)), | 304 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)), |
305 delegate->GetTotalReceivedBytes()); | 305 delegate->GetTotalReceivedBytes()); |
306 } | 306 } |
307 | 307 |
308 TEST_F(BidirectionalStreamSpdyImplTest, SendDataAfterCancelStream) { | 308 TEST_F(BidirectionalStreamSpdyImplTest, SendDataAfterCancelStream) { |
309 BufferedSpdyFramer framer(HTTP2); | 309 BufferedSpdyFramer framer; |
310 | 310 |
311 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( | 311 std::unique_ptr<SpdySerializedFrame> req(spdy_util_.ConstructSpdyPost( |
312 kDefaultUrl, 1, kBodyDataSize * 3, LOWEST, nullptr, 0)); | 312 kDefaultUrl, 1, kBodyDataSize * 3, LOWEST, nullptr, 0)); |
313 std::unique_ptr<SpdySerializedFrame> data_frame( | 313 std::unique_ptr<SpdySerializedFrame> data_frame( |
314 framer.CreateDataFrame(1, kBodyData, kBodyDataSize, DATA_FLAG_NONE)); | 314 framer.CreateDataFrame(1, kBodyData, kBodyDataSize, DATA_FLAG_NONE)); |
315 std::unique_ptr<SpdySerializedFrame> rst( | 315 std::unique_ptr<SpdySerializedFrame> rst( |
316 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 316 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
317 | 317 |
318 MockWrite writes[] = { | 318 MockWrite writes[] = { |
319 CreateMockWrite(*req, 0), CreateMockWrite(*data_frame, 3), | 319 CreateMockWrite(*req, 0), CreateMockWrite(*data_frame, 3), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 EXPECT_FALSE(delegate->on_failed_called()); | 367 EXPECT_FALSE(delegate->on_failed_called()); |
368 | 368 |
369 EXPECT_EQ("200", delegate->response_headers().find(":status")->second); | 369 EXPECT_EQ("200", delegate->response_headers().find(":status")->second); |
370 EXPECT_EQ(0, delegate->on_data_read_count()); | 370 EXPECT_EQ(0, delegate->on_data_read_count()); |
371 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); | 371 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); |
372 EXPECT_EQ(0, delegate->GetTotalSentBytes()); | 372 EXPECT_EQ(0, delegate->GetTotalSentBytes()); |
373 EXPECT_EQ(0, delegate->GetTotalReceivedBytes()); | 373 EXPECT_EQ(0, delegate->GetTotalReceivedBytes()); |
374 } | 374 } |
375 | 375 |
376 } // namespace net | 376 } // namespace net |
OLD | NEW |