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

Unified Diff: tests/standalone/src/ProcessStdoutTest.dart

Issue 8365032: Process tests work across platforms. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More line endings. Created 9 years, 1 month 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 | « tests/standalone/src/ProcessStderrTest.dart ('k') | tests/standalone/src/ProcessTestUtil.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/ProcessStdoutTest.dart
diff --git a/tests/standalone/src/ProcessStdoutTest.dart b/tests/standalone/src/ProcessStdoutTest.dart
index 56abe30c9cc5bf8793e58b7e56b73144641ea851..20a10e967a9c35e13cabfaa88b0c0fabf293443b 100644
--- a/tests/standalone/src/ProcessStdoutTest.dart
+++ b/tests/standalone/src/ProcessStdoutTest.dart
@@ -9,11 +9,13 @@
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
+#source("ProcessTestUtil.dart");
+
class ProcessStdoutTest {
- static void testStdout() {
- Process process = new Process("out/Debug_ia32//process_test",
- const ["0", "1", "99", "0"]);
+ static void testExit() {
+ Process process = new Process(getProcessTestFileName(),
+ const ["0", "1", "99", "0"]);
final int BUFFERSIZE = 10;
final int STARTCHAR = 65;
List<int> data = new List<int>(BUFFERSIZE);
@@ -28,18 +30,30 @@ class ProcessStdoutTest {
process.start();
int received = 0;
+ List<int> buffer = [];
void readData() {
- List<int> buffer = input.read();
- for (int i = 0; i < buffer.length; i++) {
- Expect.equals(data[received + i], buffer[i]);
+ buffer.addAll(input.read());
+ for (int i = received; i < Math.min(data.length, buffer.length) - 1; i++) {
+ Expect.equals(data[i], buffer[i]);
+ }
+ received = buffer.length;
+ if (received >= BUFFERSIZE) {
+ // We expect an extra character on windows due to carriage return.
+ if (13 === buffer[BUFFERSIZE - 1] && BUFFERSIZE + 1 === received) {
+ Expect.equals(13, buffer[BUFFERSIZE - 1]);
+ Expect.equals(10, buffer[BUFFERSIZE]);
+ buffer.removeLast();
+ process.close();
+ } else if (received === BUFFERSIZE) {
+ Expect.equals(10, buffer[BUFFERSIZE - 1]);
+ process.close();
+ }
}
- received += buffer.length;
}
void streamClosed() {
Expect.equals(BUFFERSIZE, received);
- process.close();
}
output.write(data);
@@ -49,10 +63,10 @@ class ProcessStdoutTest {
}
static void testMain() {
- testStdout();
+ testExit();
}
}
main() {
- ProcessStdoutTest.testStdout();
+ ProcessStdoutTest.testMain();
}
« no previous file with comments | « tests/standalone/src/ProcessStderrTest.dart ('k') | tests/standalone/src/ProcessTestUtil.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698