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 // TODO(efortuna): Rewrite to not use the args library and simply take an | 10 // TODO(efortuna): Rewrite to not use the args library and simply take an |
(...skipping 27 matching lines...) Expand all Loading... | |
38 TestUtils.testScriptPath = new Path(new Options().script) | 38 TestUtils.testScriptPath = new Path(new Options().script) |
39 .directoryPath | 39 .directoryPath |
40 .join(new Path('../../test.dart')) | 40 .join(new Path('../../test.dart')) |
41 .canonicalize() | 41 .canonicalize() |
42 .toNativePath(); | 42 .toNativePath(); |
43 // Note: args['package-root'] is always the build directory. We have the | 43 // Note: args['package-root'] is always the build directory. We have the |
44 // implicit assumption that it contains the 'packages' subdirectory. | 44 // implicit assumption that it contains the 'packages' subdirectory. |
45 // TODO: We should probably rename 'package-root' to 'build-directory'. | 45 // TODO: We should probably rename 'package-root' to 'build-directory'. |
46 TestingServerRunner._packageRootDir = new Path(args['package-root']); | 46 TestingServerRunner._packageRootDir = new Path(args['package-root']); |
47 TestingServerRunner._buildDirectory = new Path(args['package-root']); | 47 TestingServerRunner._buildDirectory = new Path(args['package-root']); |
48 TestingServerRunner.startHttpServer('127.0.0.1', | 48 TestingServerRunner.startHttpServer('0.0.0.0', |
Emily Fortuna
2013/02/08 20:45:17
Can we put this in a separate CL that has Martin o
blois
2013/02/08 21:05:10
D'oh! thanks for catching. needed that for local t
| |
49 port: int.parse(args['port'])); | 49 port: int.parse(args['port'])); |
50 print('Server listening on port ' | 50 print('Server listening on port ' |
51 '${TestingServerRunner.serverList[0].port}.'); | 51 '${TestingServerRunner.serverList[0].port}.'); |
52 TestingServerRunner.startHttpServer('127.0.0.1', | 52 TestingServerRunner.startHttpServer('0.0.0.0', |
53 allowedPort: TestingServerRunner.serverList[0].port, port: | 53 allowedPort: TestingServerRunner.serverList[0].port, port: |
54 int.parse(args['crossOriginPort'])); | 54 int.parse(args['crossOriginPort'])); |
55 print( | 55 print( |
56 'Server listening on port ${TestingServerRunner.serverList[1].port}.'); | 56 'Server listening on port ${TestingServerRunner.serverList[1].port}.'); |
57 } | 57 } |
58 } | 58 } |
59 /** | 59 /** |
60 * Runs a set of servers that are initialized specifically for the needs of our | 60 * Runs a set of servers that are initialized specifically for the needs of our |
61 * test framework, such as dealing with package-root. | 61 * test framework, such as dealing with package-root. |
62 */ | 62 */ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 }); | 156 }); |
157 | 157 |
158 httpServer.listen(host, port); | 158 httpServer.listen(host, port); |
159 serverList.add(httpServer); | 159 serverList.add(httpServer); |
160 } | 160 } |
161 | 161 |
162 static terminateHttpServers() { | 162 static terminateHttpServers() { |
163 for (var server in serverList) server.close(); | 163 for (var server in serverList) server.close(); |
164 } | 164 } |
165 } | 165 } |
OLD | NEW |