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

Side by Side Diff: tests/standalone/http_launch_test.dart

Issue 16758008: Add 'Server' and 'User-Agent' default header fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions= 4 // VMOptions=
5 // VMOptions=--short_socket_read 5 // VMOptions=--short_socket_read
6 // VMOptions=--short_socket_write 6 // VMOptions=--short_socket_write
7 // VMOptions=--short_socket_read --short_socket_write 7 // VMOptions=--short_socket_read --short_socket_write
8 // 8 //
9 // Test: 9 // Test:
10 // *) Launching a script fetched over HTTP. 10 // *) Launching a script fetched over HTTP.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 Future<ProcessResult> http_pkg_root_run = 54 Future<ProcessResult> http_pkg_root_run =
55 Process.run(pathToExecutable, 55 Process.run(pathToExecutable,
56 ['--package-root=http://127.0.0.1:$port/packages/', 56 ['--package-root=http://127.0.0.1:$port/packages/',
57 'http://127.0.0.1:$port/http_launch_main.dart']); 57 'http://127.0.0.1:$port/http_launch_main.dart']);
58 Future<ProcessResult> isolate_run = 58 Future<ProcessResult> isolate_run =
59 Process.run(pathToExecutable, 59 Process.run(pathToExecutable,
60 ['http://127.0.0.1:$port/http_spawn_main.dart', '$port']); 60 ['http://127.0.0.1:$port/http_spawn_main.dart', '$port']);
61 Future<List<ProcessResult>> results = Future.wait([no_http_run, http_run, 61 Future<List<ProcessResult>> results = Future.wait([no_http_run, http_run,
62 http_pkg_root_run, 62 http_pkg_root_run,
63 isolate_run]); 63 isolate_run]);
64 results.then((results) { 64 results.then((results) {
Søren Gjesse 2013/06/11 11:02:00 Debug code.
Anders Johnsen 2013/06/11 11:37:55 Done.
65 results.forEach((result) => print(result.stdout));
66 results.forEach((result) => print(result.stderr));
65 // Close server. 67 // Close server.
66 server.close(); 68 server.close();
67 // Check results. 69 // Check results.
68 checkResults(results); 70 checkResults(results);
69 }); 71 });
70 } 72 }
71 73
72 checkResults(List<ProcessResult> results) { 74 checkResults(List<ProcessResult> results) {
73 Expect.equals(4, results.length); 75 Expect.equals(4, results.length);
74 // Exited cleanly. 76 // Exited cleanly.
75 for (int i = 0; i < results.length; i++) { 77 for (int i = 0; i < results.length; i++) {
76 ProcessResult result = results[i]; 78 ProcessResult result = results[i];
77 Expect.equals(0, result.exitCode); 79 Expect.equals(0, result.exitCode);
78 } 80 }
79 String stdout = results[0].stdout; 81 String stdout = results[0].stdout;
80 // Output is the string 'hello'. Use startsWith to avoid new line differences. 82 // Output is the string 'hello'. Use startsWith to avoid new line differences.
81 Expect.isTrue(stdout.startsWith('hello')); 83 Expect.isTrue(stdout.startsWith('hello'));
82 // Same output from all three process runs. 84 // Same output from all three process runs.
83 for (int i = 0; i < results.length; i++) { 85 for (int i = 0; i < results.length; i++) {
84 Expect.equals(stdout, results[i].stdout); 86 Expect.equals(stdout, results[i].stdout);
85 } 87 }
86 } 88 }
87 89
88 main() { 90 main() {
89 HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0).then(serverRunning); 91 HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0).then(serverRunning);
90 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698