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

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

Issue 1319703002: Breaking Change: merge BoringSSL branch into master (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « tests/standalone/io/http_proxy_test.dart ('k') | tests/standalone/io/https_bad_certificate_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/https_bad_certificate_client.dart
diff --git a/tests/standalone/io/https_bad_certificate_client.dart b/tests/standalone/io/https_bad_certificate_client.dart
deleted file mode 100644
index c2f79cdc6f77088c25dc6279b75421c92cbde5df..0000000000000000000000000000000000000000
--- a/tests/standalone/io/https_bad_certificate_client.dart
+++ /dev/null
@@ -1,81 +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 for https_bad_certificate_test, that runs in a subprocess.
-// It verifies that the client bad certificate callback works in HttpClient.
-
-import "dart:async";
-import "dart:io";
-
-class ExpectException implements Exception {
- ExpectException(this.message);
- String toString() => "ExpectException: $message";
- String message;
-}
-
-void expect(condition) {
- if (!condition) {
- throw new ExpectException('');
- }
-}
-
-const HOST_NAME = "localhost";
-
-Future runHttpClient(int port, result) async {
- bool badCertificateCallback(X509Certificate certificate,
- String host,
- int callbackPort) {
- expect(HOST_NAME == host);
- expect(callbackPort == port);
- expect('CN=localhost' == certificate.subject);
- expect('CN=myauthority' == certificate.issuer);
- expect(result != 'exception'); // Throw exception if one is requested.
- if (result == 'true') return true;
- if (result == 'false') return false;
- return result;
- }
-
- HttpClient client = new HttpClient();
-
- await client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
- .then((HttpClientRequest request) {
- expect(result == 'true'); // The session cache may keep the session.
- return request.close();
- }, onError: (e) {
- expect(e is HandshakeException || e is SocketException);
- });
-
- client.badCertificateCallback = badCertificateCallback;
- await client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
- .then((HttpClientRequest request) {
- expect(result == 'true');
- return request.close();
- }, onError: (e) {
- if (result == 'false') expect (e is HandshakeException ||
- e is SocketException);
- else if (result == 'exception') expect (e is ExpectException ||
- e is SocketException);
- else {
- expect (e is ArgumentError || e is SocketException);
- }
- });
-
- client.badCertificateCallback = null;
- await client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
- .then((HttpClientRequest request) {
- expect(result == 'true'); // The session cache may keep the session.
- return request.close();
- }, onError: (e) {
- expect(e is HandshakeException || e is SocketException);
- });
-
- client.close();
-}
-
-void main(List<String> args) {
- SecureSocket.initialize();
- int port = int.parse(args[0]);
- runHttpClient(port, args[1])
- .then((_) => print('SUCCESS'));
-}
« no previous file with comments | « tests/standalone/io/http_proxy_test.dart ('k') | tests/standalone/io/https_bad_certificate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698