| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Test: | 5 // Test: |
| 6 // *) Compiling a script fetched over HTTP. | 6 // *) Compiling a script fetched over HTTP. |
| 7 // *) Importing a library fetched over HTTP. | 7 // *) Importing a library fetched over HTTP. |
| 8 // *) Automatically resolving package_root when script is fetched over HTTP. | 8 // *) Automatically resolving package_root when script is fetched over HTTP. |
| 9 | 9 |
| 10 library http_launch_test; | 10 library http_launch_test; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 void check(ProcessResult result) { | 44 void check(ProcessResult result) { |
| 45 Expect.equals(0, result.exitCode); | 45 Expect.equals(0, result.exitCode); |
| 46 File outFile = new File(outFilePath); | 46 File outFile = new File(outFilePath); |
| 47 Expect.isTrue(outFile.existsSync()); | 47 Expect.isTrue(outFile.existsSync()); |
| 48 Expect.isTrue(outFile.readAsStringSync().contains("hello http tester")); | 48 Expect.isTrue(outFile.readAsStringSync().contains("hello http tester")); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void checkNotFound(ProcessResult result, String filename) { | 51 void checkNotFound(ProcessResult result, String filename) { |
| 52 Expect.notEquals(0, result.exitCode); | 52 Expect.notEquals(0, result.exitCode); |
| 53 File outFile = new File(outFilePath); | |
| 54 Expect.isTrue(result.stdout.contains("404")); | 53 Expect.isTrue(result.stdout.contains("404")); |
| 55 Expect.isTrue(result.stdout.contains(filename)); | 54 Expect.isTrue(result.stdout.contains(filename)); |
| 56 } | 55 } |
| 57 | 56 |
| 58 cleanup() { | 57 cleanup() { |
| 59 File outFile = new File(outFilePath); | 58 File outFile = new File(outFilePath); |
| 60 if (outFile.existsSync()) { | 59 if (outFile.existsSync()) { |
| 61 outFile.deleteSync(); | 60 outFile.deleteSync(); |
| 62 } | 61 } |
| 63 } | 62 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 156 |
| 158 Future testHttp() { | 157 Future testHttp() { |
| 159 return HttpServer | 158 return HttpServer |
| 160 .bind(InternetAddress.LOOPBACK_IP_V4, 0) | 159 .bind(InternetAddress.LOOPBACK_IP_V4, 0) |
| 161 .then((HttpServer server) => serverRunning(server, "http")); | 160 .then((HttpServer server) => serverRunning(server, "http")); |
| 162 } | 161 } |
| 163 | 162 |
| 164 void initializeSSL() { | 163 void initializeSSL() { |
| 165 Uri pathOfPkcert = pathOfData.resolve('pkcert'); | 164 Uri pathOfPkcert = pathOfData.resolve('pkcert'); |
| 166 String testPkcertDatabase = pathOfPkcert.toFilePath(); | 165 String testPkcertDatabase = pathOfPkcert.toFilePath(); |
| 166 // Issue 29926. |
| 167 // ignore: UNDEFINED_METHOD |
| 167 SecureSocket.initialize(database: testPkcertDatabase, password: 'dartdart'); | 168 SecureSocket.initialize(database: testPkcertDatabase, password: 'dartdart'); |
| 168 } | 169 } |
| 169 | 170 |
| 170 Future testHttps() { | 171 Future testHttps() { |
| 171 initializeSSL(); | 172 initializeSSL(); |
| 172 return HttpServer | 173 return HttpServer |
| 174 // Issue 29926. |
| 175 // ignore: NOT_ENOUGH_REQUIRED_ARGUMENTS |
| 173 .bindSecure(InternetAddress.LOOPBACK_IP_V4, 0, | 176 .bindSecure(InternetAddress.LOOPBACK_IP_V4, 0, |
| 177 // Issue 29926. |
| 178 // ignore: UNDEFINED_NAMED_PARAMETER |
| 174 certificateName: 'localhost_cert') | 179 certificateName: 'localhost_cert') |
| 175 .then((HttpServer server) => serverRunning(server, "https")); | 180 .then((HttpServer server) => serverRunning(server, "https")); |
| 176 } | 181 } |
| 177 | 182 |
| 178 main() { | 183 main() { |
| 179 asyncStart(); | 184 asyncStart(); |
| 180 testHttp().then((_) => testHttps).whenComplete(asyncEnd); | 185 testHttp().then((_) => testHttps).whenComplete(asyncEnd); |
| 181 } | 186 } |
| OLD | NEW |