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

Unified Diff: content/browser/byte_stream_unittest.cc

Issue 21839002: Clean up on byte_stream (mainly style and includes) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rdsmith's comments 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
« no previous file with comments | « content/browser/byte_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/byte_stream_unittest.cc
diff --git a/content/browser/byte_stream_unittest.cc b/content/browser/byte_stream_unittest.cc
index 925467c06ae762fb094430320311faabf14d9a06..04c5ae3753306b721a80dd7575309955b3156001 100644
--- a/content/browser/byte_stream_unittest.cc
+++ b/content/browser/byte_stream_unittest.cc
@@ -541,4 +541,42 @@ TEST_F(ByteStreamTest, ByteStream_ZeroCallback) {
EXPECT_EQ(1, num_callbacks);
}
+TEST_F(ByteStreamTest, ByteStream_CloseWithoutAnyWrite) {
+ scoped_ptr<ByteStreamWriter> byte_stream_input;
+ scoped_ptr<ByteStreamReader> byte_stream_output;
+ CreateByteStream(
+ message_loop_.message_loop_proxy(), message_loop_.message_loop_proxy(),
+ 3 * 1024, &byte_stream_input, &byte_stream_output);
+
+ byte_stream_input->Close(0);
+ message_loop_.RunUntilIdle();
+
+ scoped_refptr<net::IOBuffer> output_io_buffer;
+ size_t output_length;
+ EXPECT_EQ(ByteStreamReader::STREAM_COMPLETE,
+ byte_stream_output->Read(&output_io_buffer, &output_length));
+}
+
+TEST_F(ByteStreamTest, ByteStream_FlushWithoutAnyWrite) {
+ scoped_ptr<ByteStreamWriter> byte_stream_input;
+ scoped_ptr<ByteStreamReader> byte_stream_output;
+ CreateByteStream(
+ message_loop_.message_loop_proxy(), message_loop_.message_loop_proxy(),
+ 3 * 1024, &byte_stream_input, &byte_stream_output);
+
+ byte_stream_input->Flush();
+ message_loop_.RunUntilIdle();
+
+ scoped_refptr<net::IOBuffer> output_io_buffer;
+ size_t output_length;
+ EXPECT_EQ(ByteStreamReader::STREAM_EMPTY,
+ byte_stream_output->Read(&output_io_buffer, &output_length));
+
+ byte_stream_input->Close(0);
+ message_loop_.RunUntilIdle();
+
+ EXPECT_EQ(ByteStreamReader::STREAM_COMPLETE,
+ byte_stream_output->Read(&output_io_buffer, &output_length));
+}
+
} // namespace content
« no previous file with comments | « content/browser/byte_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698