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

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

Issue 11308271: Add built-in root certificates to dart:io SecureSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add crash to Windows status (issue 7102) Created 8 years 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/secure_no_builtin_roots_test.dart
diff --git a/tests/standalone/io/secure_no_builtin_roots_test.dart b/tests/standalone/io/secure_no_builtin_roots_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..596ab5e051a23021e900ba3348ce1928464a6980
--- /dev/null
+++ b/tests/standalone/io/secure_no_builtin_roots_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2012, 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.
+
+import "dart:io";
+import "dart:uri";
+import "dart:isolate";
+
+void testGoogleUrl() {
+ ReceivePort keepalivePort = new ReceivePort();
+ HttpClient client = new HttpClient();
+
+ void testUrl(String url) {
+ var requestUri = new Uri.fromString(url);
+ var conn = client.getUrl(requestUri);
+
+ conn.onRequest = (HttpClientRequest request) {
+ request.outputStream.close();
+ };
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.fail("Https connection unexpectedly succeeded");
+ };
+ conn.onError = (error) {
+ Expect.isTrue(error is SocketIOException);
+ keepalivePort.close();
+ };
+ }
+
+ testUrl('https://www.google.com');
+}
+
+void InitializeSSL() {
+ // If the built-in root certificates aren't loaded, the connection
+ // should signal an error.
+ SecureSocket.initialize(useBuiltinRoots: false);
+}
+
+void main() {
+ InitializeSSL();
+ testGoogleUrl();
+}
« no previous file with comments | « tests/standalone/io/secure_builtin_roots_test.dart ('k') | tests/standalone/io/secure_server_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698