Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / android_webview / unittestjava / src / org / chromium / android_webview / unittest / InputStreamUnittest.java
index 7610942..42f6346 100644 (file)
@@ -6,6 +6,7 @@ package org.chromium.android_webview.unittest;
 
 import org.chromium.base.CalledByNative;
 
+import java.io.IOException;
 import java.io.InputStream;
 
 class InputStreamUnittest {
@@ -23,14 +24,39 @@ class InputStreamUnittest {
     }
 
     @CalledByNative
+    static InputStream getThrowingStream() {
+        return new InputStream() {
+            @Override
+            public int available() throws IOException {
+                throw new IOException();
+            }
+
+            @Override
+            public void close() throws IOException {
+                throw new IOException();
+            }
+
+            @Override
+            public long skip(long n) throws IOException {
+                throw new IOException();
+            }
+
+            @Override
+            public int read() throws IOException {
+                throw new IOException();
+            }
+        };
+    }
+
+    @CalledByNative
     static InputStream getCountingStream(final int size) {
         return new InputStream() {
-            private int count = 0;
+            private int mCount = 0;
 
             @Override
             public int read() {
-                if (count < size)
-                    return count++ % 256;
+                if (mCount < size)
+                    return mCount++ % 256;
                 else
                     return -1;
             }