summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-04-15 14:26:42 -0700
committerJesse Wilson <jessewilson@google.com>2010-04-15 14:26:42 -0700
commit6ed11ae92a4eb5f37427f006c3405653fb09b882 (patch)
tree7b888f082572c30b6ceece93da217ceb762ceec6 /luni
parent602fd595b44ec05fb15867810b2e636668df7eeb (diff)
parent2e08f88b2ad30bb0f3ae170a4447084c839e76c4 (diff)
downloadlibcore-6ed11ae92a4eb5f37427f006c3405653fb09b882.zip
libcore-6ed11ae92a4eb5f37427f006c3405653fb09b882.tar.gz
libcore-6ed11ae92a4eb5f37427f006c3405653fb09b882.tar.bz2
Merge commit 'da18d995' into manualmerge
Conflicts: libcore/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java
Diffstat (limited to 'luni')
-rw-r--r--luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java b/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java
index b423659..a5dcc34 100644
--- a/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java
+++ b/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java
@@ -22,6 +22,8 @@ import java.io.PipedOutputStream;
public class PipedInputStreamTest extends junit.framework.TestCase {
+ private final int BUFFER_SIZE = 1024;
+
static class PWriter implements Runnable {
PipedOutputStream pos;
@@ -121,13 +123,12 @@ public class PipedInputStreamTest extends junit.framework.TestCase {
PipedInputStream pin = new PipedInputStream();
PipedOutputStream pout = new PipedOutputStream(pin);
- // We know the PipedInputStream buffer size is 1024.
// Writing another byte would cause the write to wait
// for a read before returning
- for (int i = 0; i < 1024; i++) {
+ for (int i = 0; i < BUFFER_SIZE; i++) {
pout.write(i);
}
- assertEquals("Incorrect available count", 1024 , pin.available());
+ assertEquals("Incorrect available count", BUFFER_SIZE , pin.available());
}
/**
@@ -280,8 +281,9 @@ public class PipedInputStreamTest extends junit.framework.TestCase {
;
}
try {
- // should throw exception since reader thread
- // is now dead
+ pos.write(new byte[BUFFER_SIZE]);
+ // should throw exception since buffer is full and
+ // reader thread is now dead
pos.write(1);
} catch (IOException e) {
pass = true;