| OLD | NEW |
| 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import '../dartino_compiler/run.dart' show | 8 import '../dartino_compiler/run.dart' show |
| 9 export; | 9 export; |
| 10 import 'dart:convert' show | 10 import 'dart:convert' show |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 29 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
| 30 | 30 |
| 31 const String certPath = 'third_party/dart/tests/standalone/io/certificates'; | 31 const String certPath = 'third_party/dart/tests/standalone/io/certificates'; |
| 32 | 32 |
| 33 SecurityContext createContext() { | 33 SecurityContext createContext() { |
| 34 var testDirUri = new Uri.file(testsDir); | 34 var testDirUri = new Uri.file(testsDir); |
| 35 var chain = testDirUri.resolve('../$certPath/server_chain.pem'); | 35 var chain = testDirUri.resolve('../$certPath/server_chain.pem'); |
| 36 var key = testDirUri.resolve('../$certPath/server_key.pem'); | 36 var key = testDirUri.resolve('../$certPath/server_key.pem'); |
| 37 var context = new SecurityContext(); | 37 var context = new SecurityContext(); |
| 38 return context | 38 return context |
| 39 ..useCertificateChain(file: chain.toFilePath()) | 39 ..useCertificateChain(chain.toFilePath()) |
| 40 ..usePrivateKey(key.toFilePath(), password: 'dartdart'); | 40 ..usePrivateKey(key.toFilePath(), password: 'dartdart'); |
| 41 } | 41 } |
| 42 | 42 |
| 43 Future testGoodServer() async { | 43 Future testGoodServer() async { |
| 44 var server = await SecureServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, | 44 var server = await SecureServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, |
| 45 0, | 45 0, |
| 46 createContext()); | 46 createContext()); |
| 47 int received = 0; | 47 int received = 0; |
| 48 server.listen((SecureSocket client) { | 48 server.listen((SecureSocket client) { |
| 49 client | 49 client |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 await stdoutFuture; | 119 await stdoutFuture; |
| 120 await stderrFuture; | 120 await stderrFuture; |
| 121 Expect.equals(connections, 1); | 121 Expect.equals(connections, 1); |
| 122 Expect.equals(result, 0); | 122 Expect.equals(result, 0); |
| 123 } | 123 } |
| 124 | 124 |
| 125 Future testServerClient() async { | 125 Future testServerClient() async { |
| 126 await testGoodServer(); | 126 await testGoodServer(); |
| 127 // await testServerDisconnect(); | 127 // await testServerDisconnect(); |
| 128 } | 128 } |
| OLD | NEW |