Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: net/quic/quic_http_stream_test.cc

Issue 1776423004: Only MarkTrailersConsumed when actually sending trailers notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add internal changes and fix tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_chromium_client_stream_test.cc ('k') | net/quic/quic_spdy_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string_number_conversions.h"
12 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
13 #include "net/base/chunked_upload_data_stream.h" 14 #include "net/base/chunked_upload_data_stream.h"
14 #include "net/base/elements_upload_data_stream.h" 15 #include "net/base/elements_upload_data_stream.h"
15 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
16 #include "net/base/socket_performance_watcher.h" 17 #include "net/base/socket_performance_watcher.h"
17 #include "net/base/test_completion_callback.h" 18 #include "net/base/test_completion_callback.h"
18 #include "net/base/test_data_directory.h" 19 #include "net/base/test_data_directory.h"
19 #include "net/base/upload_bytes_element_reader.h" 20 #include "net/base/upload_bytes_element_reader.h"
20 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
21 #include "net/http/transport_security_state.h" 22 #include "net/http/transport_security_state.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 EXPECT_FALSE(response_.response_time.is_null()); 564 EXPECT_FALSE(response_.response_time.is_null());
564 EXPECT_FALSE(response_.request_time.is_null()); 565 EXPECT_FALSE(response_.request_time.is_null());
565 566
566 // Send the response body. 567 // Send the response body.
567 const char kResponseBody[] = "Hello world!"; 568 const char kResponseBody[] = "Hello world!";
568 ProcessPacket( 569 ProcessPacket(
569 ConstructDataPacket(3, false, !kFin, /*offset=*/0, kResponseBody)); 570 ConstructDataPacket(3, false, !kFin, /*offset=*/0, kResponseBody));
570 SpdyHeaderBlock trailers; 571 SpdyHeaderBlock trailers;
571 size_t spdy_trailers_frame_length; 572 size_t spdy_trailers_frame_length;
572 trailers["foo"] = "bar"; 573 trailers["foo"] = "bar";
574 trailers[kFinalOffsetHeaderKey] = base::IntToString(strlen(kResponseBody));
573 ProcessPacket(ConstructResponseTrailersPacket( 575 ProcessPacket(ConstructResponseTrailersPacket(
574 4, kFin, trailers, &spdy_trailers_frame_length, &offset)); 576 4, kFin, trailers, &spdy_trailers_frame_length, &offset));
575 577
576 // Make sure trailers are processed. 578 // Make sure trailers are processed.
577 base::MessageLoop::current()->RunUntilIdle(); 579 base::MessageLoop::current()->RunUntilIdle();
578 580
579 EXPECT_EQ(static_cast<int>(strlen(kResponseBody)), 581 EXPECT_EQ(static_cast<int>(strlen(kResponseBody)),
580 stream_->ReadResponseBody(read_buffer_.get(), read_buffer_->size(), 582 stream_->ReadResponseBody(read_buffer_.get(), read_buffer_->size(),
581 callback_.callback())); 583 callback_.callback()));
582 EXPECT_TRUE(stream_->IsResponseBodyComplete()); 584 EXPECT_TRUE(stream_->IsResponseBodyComplete());
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the 1626 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
1625 // headers and payload. 1627 // headers and payload.
1626 EXPECT_EQ(static_cast<int64_t>(spdy_request_header_frame_length), 1628 EXPECT_EQ(static_cast<int64_t>(spdy_request_header_frame_length),
1627 promised_stream_->GetTotalSentBytes()); 1629 promised_stream_->GetTotalSentBytes());
1628 EXPECT_EQ(static_cast<int64_t>(spdy_response_header_frame_length), 1630 EXPECT_EQ(static_cast<int64_t>(spdy_response_header_frame_length),
1629 promised_stream_->GetTotalReceivedBytes()); 1631 promised_stream_->GetTotalReceivedBytes());
1630 } 1632 }
1631 1633
1632 } // namespace test 1634 } // namespace test
1633 } // namespace net 1635 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_stream_test.cc ('k') | net/quic/quic_spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698