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

Side by Side Diff: tests/standalone/io/secure_socket_bad_certificate_test.dart

Issue 11770004: Rename Date to DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and keep Backwards-compatibility class Date. Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // The --short_socket_write option does not work with external server 7 // The --short_socket_write option does not work with external server
8 // www.google.dk. Add this to the test when we have secure server sockets. 8 // www.google.dk. Add this to the test when we have secure server sockets.
9 // See TODO below. 9 // See TODO below.
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 secure.onConnect = () { 46 secure.onConnect = () {
47 Expect.isTrue(acceptCertificate); 47 Expect.isTrue(acceptCertificate);
48 WriteAndClose(secure, "GET / HTTP/1.0\r\nHost: $host\r\n\r\n"); 48 WriteAndClose(secure, "GET / HTTP/1.0\r\nHost: $host\r\n\r\n");
49 }; 49 };
50 secure.onBadCertificate = (_) { }; 50 secure.onBadCertificate = (_) { };
51 secure.onBadCertificate = null; 51 secure.onBadCertificate = null;
52 Expect.throws(() => secure.onBadCertificate = 7, 52 Expect.throws(() => secure.onBadCertificate = 7,
53 (e) => e is TypeError || e is SocketIOException); 53 (e) => e is TypeError || e is SocketIOException);
54 secure.onBadCertificate = (X509Certificate certificate) { 54 secure.onBadCertificate = (X509Certificate certificate) {
55 Expect.isTrue(certificate.subject.contains("O=Google Inc")); 55 Expect.isTrue(certificate.subject.contains("O=Google Inc"));
56 Expect.isTrue(certificate.startValidity < new Date.now()); 56 Expect.isTrue(certificate.startValidity < new DateTime.now());
57 Expect.isTrue(certificate.endValidity > new Date.now()); 57 Expect.isTrue(certificate.endValidity > new DateTime.now());
58 return acceptCertificate; 58 return acceptCertificate;
59 }; 59 };
60 secure.onData = () { 60 secure.onData = () {
61 Expect.isTrue(acceptCertificate); 61 Expect.isTrue(acceptCertificate);
62 chunks.add(new String.fromCharCodes(secure.read())); 62 chunks.add(new String.fromCharCodes(secure.read()));
63 }; 63 };
64 secure.onClosed = () { 64 secure.onClosed = () {
65 Expect.isTrue(acceptCertificate); 65 Expect.isTrue(acceptCertificate);
66 String fullPage = Strings.concatAll(chunks); 66 String fullPage = Strings.concatAll(chunks);
67 Expect.isTrue(fullPage.contains('</body></html>')); 67 Expect.isTrue(fullPage.contains('</body></html>'));
68 completer.complete(null); 68 completer.complete(null);
69 }; 69 };
70 secure.onError = (e) { 70 secure.onError = (e) {
71 Expect.isFalse(acceptCertificate); 71 Expect.isFalse(acceptCertificate);
72 completer.complete(null); 72 completer.complete(null);
73 }; 73 };
74 return completer.future; 74 return completer.future;
75 } 75 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_headers_test.dart ('k') | tests/standalone/io/skipping_dart2js_compilations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698