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

Unified Diff: net/http/bidirectional_stream_unittest.cc

Issue 2044583002: Improve NetLog logging in net::BidirectionalStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/bidirectional_stream.cc ('k') | net/log/net_log_event_type_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/bidirectional_stream_unittest.cc
diff --git a/net/http/bidirectional_stream_unittest.cc b/net/http/bidirectional_stream_unittest.cc
index e96f54c4ac8c8a7e7401b56cbd82364bd28298c6..09aaaee60288fba65febe9f2e2b1e2db116daa25 100644
--- a/net/http/bidirectional_stream_unittest.cc
+++ b/net/http/bidirectional_stream_unittest.cc
@@ -597,6 +597,7 @@ TEST_F(BidirectionalStreamTest, TestNetLogContainEntries) {
delegate.reset();
TestNetLogEntry::List entries;
net_log_.GetEntries(&entries);
+
size_t index = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_BIDIRECTIONAL_STREAM_ALIVE, NetLog::PHASE_BEGIN);
// HTTP_STREAM_REQUEST is nested inside in BIDIRECTIONAL_STREAM_ALIVE.
@@ -809,6 +810,37 @@ TEST_F(BidirectionalStreamTest, TestCoalesceSmallDataBuffers) {
delegate->GetTotalSentBytes());
EXPECT_EQ(CountReadBytes(reads, arraysize(reads)),
delegate->GetTotalReceivedBytes());
+
+ TestNetLogEntry::List entries;
+ net_log_.GetEntries(&entries);
+ size_t index = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_SENT_COALESCED,
+ NetLog::PHASE_BEGIN);
+ TestNetLogEntry entry = entries[index];
+ int num_buffers_coalesced = 0;
+ EXPECT_TRUE(entry.params->GetInteger("num_buffers_coalesced",
+ &num_buffers_coalesced));
+ EXPECT_EQ(2, num_buffers_coalesced);
+
+ index = ExpectLogContainsSomewhereAfter(
+ entries, index, NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_SENT,
+ NetLog::PHASE_NONE);
+ entry = entries[index];
+ int byte_count = 0;
+ EXPECT_TRUE(entry.params->GetInteger("byte_count", &byte_count));
+ EXPECT_EQ(buf->size(), byte_count);
+
+ index = ExpectLogContainsSomewhereAfter(
+ entries, index + 1, NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_SENT,
+ NetLog::PHASE_NONE);
+ entry = entries[index];
+ byte_count = 0;
+ EXPECT_TRUE(entry.params->GetInteger("byte_count", &byte_count));
+ EXPECT_EQ(buf2->size(), byte_count);
+
+ ExpectLogContainsSomewhere(
+ entries, index, NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_SENT_COALESCED,
+ NetLog::PHASE_END);
}
// Tests that BidirectionalStreamSpdyImpl::OnClose will complete any remaining
@@ -1225,6 +1257,25 @@ TEST_F(BidirectionalStreamTest, PropagateProtocolError) {
EXPECT_EQ(CountWriteBytes(writes, 1), delegate->GetTotalSentBytes());
EXPECT_EQ(CountReadBytes(reads, arraysize(reads)),
delegate->GetTotalReceivedBytes());
+
+ TestNetLogEntry::List entries;
+ net_log_.GetEntries(&entries);
+
+ size_t index = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_BIDIRECTIONAL_STREAM_READY, NetLog::PHASE_NONE);
+ TestNetLogEntry entry = entries[index];
+ bool request_headers_sent = false;
+ EXPECT_TRUE(
+ entry.params->GetBoolean("request_headers_sent", &request_headers_sent));
+ EXPECT_TRUE(request_headers_sent);
+
+ index = ExpectLogContainsSomewhere(entries, index,
+ NetLog::TYPE_BIDIRECTIONAL_STREAM_FAILED,
+ NetLog::PHASE_NONE);
+ entry = entries[index];
+ int net_error = OK;
+ EXPECT_TRUE(entry.params->GetInteger("net_error", &net_error));
+ EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, net_error);
}
INSTANTIATE_TEST_CASE_P(CancelOrDeleteTests,
« no previous file with comments | « net/http/bidirectional_stream.cc ('k') | net/log/net_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698