| OLD | NEW |
| 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. |
| 11 // *) Importing a library fetched over HTTP. | 11 // *) Importing a library fetched over HTTP. |
| 12 // *) Automatically resolving package_root when script is fetched over HTTP. | 12 // *) Automatically resolving package_root when script is fetched over HTTP. |
| 13 // *) Spawning a URI over HTTP. | 13 // *) Spawning a URI over HTTP. |
| 14 | 14 |
| 15 library http_launch_test; | 15 library http_launch_test; |
| 16 | 16 |
| 17 import 'dart:async'; | 17 import 'dart:async'; |
| 18 import 'dart:io'; | 18 import 'dart:io'; |
| 19 import 'package:expect/expect.dart'; | 19 import 'package:expect/expect.dart'; |
| 20 | 20 |
| 21 String pathToExecutable = new Options().executable; | 21 String pathToExecutable = Platform.executable; |
| 22 String pathOfData = new File(new Options().script).directory.path + | 22 String pathOfData = new File(Platform.script).directory.path + |
| 23 '/http_launch_data'; | 23 '/http_launch_data'; |
| 24 int port; | 24 int port; |
| 25 | 25 |
| 26 _sendNotFound(HttpResponse response) { | 26 _sendNotFound(HttpResponse response) { |
| 27 response.statusCode = HttpStatus.NOT_FOUND; | 27 response.statusCode = HttpStatus.NOT_FOUND; |
| 28 response.close(); | 28 response.close(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 handleRequest(HttpRequest request) { | 31 handleRequest(HttpRequest request) { |
| 32 final String path = request.uri.path; | 32 final String path = request.uri.path; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 Expect.isTrue(stdout.startsWith('hello')); | 81 Expect.isTrue(stdout.startsWith('hello')); |
| 82 // Same output from all three process runs. | 82 // Same output from all three process runs. |
| 83 for (int i = 0; i < results.length; i++) { | 83 for (int i = 0; i < results.length; i++) { |
| 84 Expect.equals(stdout, results[i].stdout); | 84 Expect.equals(stdout, results[i].stdout); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 main() { | 88 main() { |
| 89 HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0).then(serverRunning); | 89 HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0).then(serverRunning); |
| 90 } | 90 } |
| OLD | NEW |