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

Unified Diff: android_webview/native/input_stream_unittest.cc

Issue 430443003: Use unchecked InputStream methods in the android_webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove old InputStream jni Created 6 years, 5 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') | android_webview/native/webview_native.gyp » ('j') | 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 76ca8232a65c949f37aa69ab985c5dcc1435360b..ec4faf692665108159462359dc99ea7c8aaaa9d6 100644
--- a/android_webview/native/input_stream_unittest.cc
+++ b/android_webview/native/input_stream_unittest.cc
@@ -119,3 +119,27 @@ TEST_F(InputStreamTest, ReadLargeStreamCompletely) {
DoReadCountedStreamTest(bytes_requested, bytes_requested, &bytes_read);
EXPECT_EQ(bytes_requested, bytes_read);
}
+
+TEST_F(InputStreamTest, DoesNotCrashWhenExceptionThrown) {
+ ScopedJavaLocalRef<jobject> throw_jstream =
+ Java_InputStreamUnittest_getThrowingStream(env_);
+ EXPECT_FALSE(throw_jstream.is_null());
+
+ scoped_ptr<InputStream> input_stream(new InputStreamImpl(throw_jstream));
+
+ int64_t bytes_skipped;
+ EXPECT_FALSE(input_stream->Skip(10, &bytes_skipped));
+
+ int bytes_available;
+ EXPECT_FALSE(input_stream->BytesAvailable(&bytes_available));
+
+
+ const int bytes_requested = 10;
+ int bytes_read = 0;
+ scoped_refptr<IOBuffer> buffer = new IOBuffer(bytes_requested);
+ EXPECT_FALSE(input_stream->Read(buffer.get(), bytes_requested, &bytes_read));
+ EXPECT_EQ(0, bytes_read);
+
+ // This closes the stream.
+ input_stream.reset(NULL);
+}
« no previous file with comments | « android_webview/native/input_stream_impl.cc ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698