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

Side by Side Diff: net/http/bidirectional_stream_unittest.cc

Issue 2011183002: Fix flaky BidirectionalStreamTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | tools/valgrind/gtest_exclude/net_unittests.gtest-drmemory_win32.txt » ('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 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 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 // single Delegate::OnReadComplete callback. 912 // single Delegate::OnReadComplete callback.
913 timer->Fire(); 913 timer->Fire();
914 base::RunLoop().RunUntilIdle(); 914 base::RunLoop().RunUntilIdle();
915 EXPECT_EQ(1, delegate->on_data_read_count()); 915 EXPECT_EQ(1, delegate->on_data_read_count());
916 EXPECT_EQ(kUploadDataSize * 2, 916 EXPECT_EQ(kUploadDataSize * 2,
917 static_cast<int>(delegate->data_received().size())); 917 static_cast<int>(delegate->data_received().size()));
918 918
919 // Deliver last DATA frame and EOF. There will be an additional 919 // Deliver last DATA frame and EOF. There will be an additional
920 // Delegate::OnReadComplete callback. 920 // Delegate::OnReadComplete callback.
921 sequenced_data_->Resume(); 921 sequenced_data_->Resume();
922 base::RunLoop().RunUntilIdle();
923
922 EXPECT_EQ(2, delegate->on_data_read_count()); 924 EXPECT_EQ(2, delegate->on_data_read_count());
923 EXPECT_EQ(kUploadDataSize * 3, 925 EXPECT_EQ(kUploadDataSize * 3,
924 static_cast<int>(delegate->data_received().size())); 926 static_cast<int>(delegate->data_received().size()));
925 927
926 const SpdyHeaderBlock response_headers = delegate->response_headers(); 928 const SpdyHeaderBlock response_headers = delegate->response_headers();
927 EXPECT_EQ("200", response_headers.find(":status")->second); 929 EXPECT_EQ("200", response_headers.find(":status")->second);
928 EXPECT_EQ("header-value", response_headers.find("header-name")->second); 930 EXPECT_EQ("header-value", response_headers.find("header-name")->second);
929 EXPECT_EQ(0, delegate->on_data_sent_count()); 931 EXPECT_EQ(0, delegate->on_data_sent_count());
930 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); 932 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol());
931 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)), 933 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 base::RunLoop().RunUntilIdle(); 995 base::RunLoop().RunUntilIdle();
994 // This should trigger |more_read_data_pending_| to execute the task at a 996 // This should trigger |more_read_data_pending_| to execute the task at a
995 // later time, and Delegate::OnReadComplete should not have been called. 997 // later time, and Delegate::OnReadComplete should not have been called.
996 EXPECT_TRUE(timer->IsRunning()); 998 EXPECT_TRUE(timer->IsRunning());
997 EXPECT_EQ(0, delegate->on_data_read_count()); 999 EXPECT_EQ(0, delegate->on_data_read_count());
998 1000
999 // Deliver trailers. Remaining read should be completed, since OnClose is 1001 // Deliver trailers. Remaining read should be completed, since OnClose is
1000 // called right after OnTrailersReceived. The three DATA frames should be 1002 // called right after OnTrailersReceived. The three DATA frames should be
1001 // delivered in a single OnReadCompleted callback. 1003 // delivered in a single OnReadCompleted callback.
1002 sequenced_data_->Resume(); 1004 sequenced_data_->Resume();
1005 base::RunLoop().RunUntilIdle();
1006
1003 EXPECT_EQ(1, delegate->on_data_read_count()); 1007 EXPECT_EQ(1, delegate->on_data_read_count());
1004 EXPECT_EQ(kUploadDataSize * 3, 1008 EXPECT_EQ(kUploadDataSize * 3,
1005 static_cast<int>(delegate->data_received().size())); 1009 static_cast<int>(delegate->data_received().size()));
1006 const SpdyHeaderBlock response_headers = delegate->response_headers(); 1010 const SpdyHeaderBlock response_headers = delegate->response_headers();
1007 EXPECT_EQ("200", response_headers.find(":status")->second); 1011 EXPECT_EQ("200", response_headers.find(":status")->second);
1008 EXPECT_EQ("header-value", response_headers.find("header-name")->second); 1012 EXPECT_EQ("header-value", response_headers.find("header-name")->second);
1009 EXPECT_EQ("bar", delegate->trailers().find("foo")->second); 1013 EXPECT_EQ("bar", delegate->trailers().find("foo")->second);
1010 EXPECT_EQ(0, delegate->on_data_sent_count()); 1014 EXPECT_EQ(0, delegate->on_data_sent_count());
1011 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); 1015 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol());
1012 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)), 1016 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)),
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 AlternativeServiceVector alternative_service_vector = 1505 AlternativeServiceVector alternative_service_vector =
1502 http_session_->http_server_properties()->GetAlternativeServices(server); 1506 http_session_->http_server_properties()->GetAlternativeServices(server);
1503 ASSERT_EQ(1u, alternative_service_vector.size()); 1507 ASSERT_EQ(1u, alternative_service_vector.size());
1504 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3), 1508 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3),
1505 alternative_service_vector[0].protocol); 1509 alternative_service_vector[0].protocol);
1506 EXPECT_EQ("www.example.org", alternative_service_vector[0].host); 1510 EXPECT_EQ("www.example.org", alternative_service_vector[0].host);
1507 EXPECT_EQ(443, alternative_service_vector[0].port); 1511 EXPECT_EQ(443, alternative_service_vector[0].port);
1508 } 1512 }
1509 1513
1510 } // namespace net 1514 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/net_unittests.gtest-drmemory_win32.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698