import org.chromium.base.CalledByNative;
+import java.io.IOException;
import java.io.InputStream;
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;
}