OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 4 |
5 library http_server; | 5 library http_server; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
9 import 'test_suite.dart'; // For TestUtils. | 9 import 'test_suite.dart'; // For TestUtils. |
10 import '../../../pkg/args/lib/args.dart'; | 10 import '../../../pkg/args/lib/args.dart'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 defaultsTo: 'ia32'); | 24 defaultsTo: 'ia32'); |
25 parser.addFlag('help', abbr: 'h', negatable: false, | 25 parser.addFlag('help', abbr: 'h', negatable: false, |
26 help: 'Print this usage information.'); | 26 help: 'Print this usage information.'); |
27 var args = parser.parse(new Options().arguments); | 27 var args = parser.parse(new Options().arguments); |
28 if (args['help']) { | 28 if (args['help']) { |
29 print(parser.getUsage()); | 29 print(parser.getUsage()); |
30 } else { | 30 } else { |
31 // Pretend we're running test.dart so that TestUtils doesn't get confused | 31 // Pretend we're running test.dart so that TestUtils doesn't get confused |
32 // about the "current directory." This is only used if we're trying to run | 32 // about the "current directory." This is only used if we're trying to run |
33 // this file independently for local testing. | 33 // this file independently for local testing. |
34 TestUtils.testScriptPath = new Path.fromNative( | 34 TestUtils.testScriptPath = new Path(new Options().script) |
35 new Options().script).directoryPath.join( | 35 .directoryPath |
36 new Path('../../test.dart')).canonicalize().toNativePath(); | 36 .join(new Path('../../test.dart')) |
| 37 .canonicalize() |
| 38 .toNativePath(); |
37 TestingServerRunner.setPackageRootDir({'mode': args['mode'], | 39 TestingServerRunner.setPackageRootDir({'mode': args['mode'], |
38 'arch': args['arch'], 'system': Platform.operatingSystem, | 40 'arch': args['arch'], 'system': Platform.operatingSystem, |
39 'build_directory': ''}); | 41 'build_directory': ''}); |
40 | 42 |
41 TestingServerRunner.startHttpServer('127.0.0.1', | 43 TestingServerRunner.startHttpServer('127.0.0.1', |
42 port: int.parse(args['port'])); | 44 port: int.parse(args['port'])); |
43 print('Server listening on port ' | 45 print('Server listening on port ' |
44 '${TestingServerRunner.serverList[0].port}.'); | 46 '${TestingServerRunner.serverList[0].port}.'); |
45 TestingServerRunner.startHttpServer('127.0.0.1', | 47 TestingServerRunner.startHttpServer('127.0.0.1', |
46 allowedPort: TestingServerRunner.serverList[0].port, port: | 48 allowedPort: TestingServerRunner.serverList[0].port, port: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 }); | 136 }); |
135 | 137 |
136 httpServer.listen(host, port); | 138 httpServer.listen(host, port); |
137 serverList.add(httpServer); | 139 serverList.add(httpServer); |
138 } | 140 } |
139 | 141 |
140 static terminateHttpServers() { | 142 static terminateHttpServers() { |
141 for (var server in serverList) server.close(); | 143 for (var server in serverList) server.close(); |
142 } | 144 } |
143 } | 145 } |
OLD | NEW |