Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1308)

Unified Diff: tests/standalone/io/certificate_test_client.dart

Issue 22887014: Remove the certificate management methods from dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/standalone/io/certificate_test_client.dart
diff --git a/tests/standalone/io/certificate_test_client.dart b/tests/standalone/io/certificate_test_client.dart
deleted file mode 100644
index 4e3262d6de09314a69729eedc2488c19174ab198..0000000000000000000000000000000000000000
--- a/tests/standalone/io/certificate_test_client.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-//
-// Client that tests that a certificate authority certificate loaded
-// at runtime can be used to verify a certificate chain. The server it
-// connects to uses localhost_cert, signed by myauthority_cert, to connect
-// securely.
-
-import 'dart:io';
-
-void main() {
- int port = int.parse(new Options().arguments[0]);
- String certificate = new Options().arguments[1];
- SecureSocket.initialize();
- var mycert = new File(certificate).readAsBytesSync();
- bool threw = false;
- try {
- SecureSocket.addCertificate("I am not a cert".codeUnits,
- SecureSocket.TRUST_ISSUE_SERVER_CERTIFICATES);
- } on CertificateException catch (e) {
- threw = true;
- }
- if (!threw) throw "Expected bad certificate to throw";
-
- threw = false;
- try {
- SecureSocket.addCertificate(mycert, "Trust me, I'm a string");
- } on CertificateException catch (e) {
- threw = true;
- }
- if (!threw) throw "Expected bad trust string to throw";
-
- SecureSocket.addCertificate(mycert,
- SecureSocket.TRUST_ISSUE_SERVER_CERTIFICATES);
-
- SecureSocket.connect('localhost', port).then((SecureSocket socket) {
- socket.writeln('hello world');
- socket.listen((data) { });
- return socket.close();
- }).then((_) {
- SecureSocket.changeTrust('myauthority_cert', ',,');
- return SecureSocket.connect('localhost', port);
- }).then((_) {
- throw "Expected untrusted authority to stop connection";
- }, onError: (e) {
- if (e is! CertificateException) throw e;
- }).then((_) {
- SecureSocket.changeTrust('myauthority_cert', 'C,,');
- return SecureSocket.connect('localhost', port);
- }).then((SecureSocket socket) {
- socket.writeln('hello world');
- socket.listen((data) { });
- return socket.close();
- }).then((_) {
- SecureSocket.removeCertificate('myauthority_cert');
- return SecureSocket.connect('localhost', port);
- }).then((_) {
- throw "Expected untrusted root to stop connection";
- }, onError: (e) {
- if (e is! CertificateException) throw e;
- }).then((_) {
- print('SUCCESS'); // Checked by parent process.
- });
-}
« no previous file with comments | « tests/standalone/io/certificate_test.dart ('k') | tests/standalone/io/certificate_test_client_database.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698