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

Unified Diff: android_webview/native/input_stream_unittest.cc

Issue 24082006: [Android WebView] Make InputStreamImpl::Read fill the IOBuffer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed tests Created 7 years, 3 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 | « android_webview/native/input_stream_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/input_stream_unittest.cc
diff --git a/android_webview/native/input_stream_unittest.cc b/android_webview/native/input_stream_unittest.cc
index 87b3fe33d48793533d27e15a6e7fd076238a7385..76ca8232a65c949f37aa69ab985c5dcc1435360b 100644
--- a/android_webview/native/input_stream_unittest.cc
+++ b/android_webview/native/input_stream_unittest.cc
@@ -89,10 +89,10 @@ TEST_F(InputStreamTest, ReadStreamCompletely) {
}
TEST_F(InputStreamTest, TryReadMoreThanBuffer) {
- const int bytes_requested = 3 * InputStreamImpl::kBufferSize;
+ const int buffer_size = 3 * InputStreamImpl::kBufferSize;
int bytes_read = 0;
- DoReadCountedStreamTest(bytes_requested, bytes_requested, &bytes_read);
- EXPECT_EQ(InputStreamImpl::kBufferSize, bytes_read);
+ DoReadCountedStreamTest(buffer_size, buffer_size * 2, &bytes_read);
+ EXPECT_EQ(buffer_size, bytes_read);
}
TEST_F(InputStreamTest, CheckContentsReadCorrectly) {
@@ -105,3 +105,17 @@ TEST_F(InputStreamTest, CheckContentsReadCorrectly) {
EXPECT_EQ(i, (unsigned char)buffer->data()[i]);
}
}
+
+TEST_F(InputStreamTest, ReadLargeStreamPartial) {
+ const int bytes_requested = 3 * InputStreamImpl::kBufferSize;
+ int bytes_read = 0;
+ DoReadCountedStreamTest(bytes_requested + 32, bytes_requested, &bytes_read);
+ EXPECT_EQ(bytes_requested, bytes_read);
+}
+
+TEST_F(InputStreamTest, ReadLargeStreamCompletely) {
+ const int bytes_requested = 3 * InputStreamImpl::kBufferSize;
+ int bytes_read = 0;
+ DoReadCountedStreamTest(bytes_requested, bytes_requested, &bytes_read);
+ EXPECT_EQ(bytes_requested, bytes_read);
+}
« no previous file with comments | « android_webview/native/input_stream_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698