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

Unified Diff: content/browser/byte_stream_unittest.cc

Issue 22908008: Limit the total memory usage for Stream instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: kinuko's comment and rebase Created 7 years, 4 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
Index: content/browser/byte_stream_unittest.cc
diff --git a/content/browser/byte_stream_unittest.cc b/content/browser/byte_stream_unittest.cc
index 04c5ae3753306b721a80dd7575309955b3156001..3d902bb7afd9a1fa0806fb791725ac4dd18b13e0 100644
--- a/content/browser/byte_stream_unittest.cc
+++ b/content/browser/byte_stream_unittest.cc
@@ -116,7 +116,10 @@ TEST_F(ByteStreamTest, ByteStream_PushBack) {
EXPECT_FALSE(Write(byte_stream_input.get(), 1024));
// Flush
byte_stream_input->Close(0);
+ EXPECT_EQ(4 * 1024U + 1U, byte_stream_input->GetTotalBufferedBytes());
message_loop_.RunUntilIdle();
+ // Data already sent to reader is also counted in.
+ EXPECT_EQ(4 * 1024U + 1U, byte_stream_input->GetTotalBufferedBytes());
// Pull the IO buffers out; do we get the same buffers and do they
// have the same contents?
@@ -144,6 +147,10 @@ TEST_F(ByteStreamTest, ByteStream_PushBack) {
EXPECT_EQ(ByteStreamReader::STREAM_COMPLETE,
byte_stream_output->Read(&output_io_buffer, &output_length));
+
+ message_loop_.RunUntilIdle();
+ // Reader now knows that all data is read out.
+ EXPECT_EQ(1024U, byte_stream_input->GetTotalBufferedBytes());
}
// Confirm that Flush() method makes the writer to send written contents to

Powered by Google App Engine
This is Rietveld 408576698