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

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

Issue 1055943004: Process outstanding events before making a new HTTP client request (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 5 years, 8 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 | « sdk/lib/io/http_impl.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
index 35edb696f53f52605cf13f4f90e1d2d8a29b8c0d..c2f79cdc6f77088c25dc6279b75421c92cbde5df 100644
--- a/tests/standalone/io/https_bad_certificate_client.dart
+++ b/tests/standalone/io/https_bad_certificate_client.dart
@@ -22,7 +22,7 @@ void expect(condition) {
const HOST_NAME = "localhost";
-Future runHttpClient(int port, result) {
+Future runHttpClient(int port, result) async {
bool badCertificateCallback(X509Certificate certificate,
String host,
int callbackPort) {
@@ -38,17 +38,16 @@ Future runHttpClient(int port, result) {
HttpClient client = new HttpClient();
- var testFutures = []; // The three async getUrl calls run simultaneously.
- testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
+ 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;
- testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
+ await client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
.then((HttpClientRequest request) {
expect(result == 'true');
return request.close();
@@ -57,19 +56,21 @@ Future runHttpClient(int port, result) {
e is SocketException);
else if (result == 'exception') expect (e is ExpectException ||
e is SocketException);
- else expect (e is ArgumentError || e is SocketException);
- }));
+ else {
+ expect (e is ArgumentError || e is SocketException);
+ }
+ });
client.badCertificateCallback = null;
- testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
+ 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);
- }));
+ });
- return Future.wait(testFutures).then((_) => client.close());
+ client.close();
}
void main(List<String> args) {
« no previous file with comments | « sdk/lib/io/http_impl.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