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

Unified Diff: runtime/tests/vm/dart/hello_fuchsia_test.dart

Issue 2519133005: Enable SecureSocket on Fuchsia using BoringSSL (Closed)
Patch Set: . Created 4 years, 1 month 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: runtime/tests/vm/dart/hello_fuchsia_test.dart
diff --git a/runtime/tests/vm/dart/hello_fuchsia_test.dart b/runtime/tests/vm/dart/hello_fuchsia_test.dart
index e29fb3ed9060d80a1e1da5afec5beb055197e1e6..e2ac092ea7ae6acb967475220e53605d7d976afc 100644
--- a/runtime/tests/vm/dart/hello_fuchsia_test.dart
+++ b/runtime/tests/vm/dart/hello_fuchsia_test.dart
@@ -331,7 +331,31 @@ testSimpleReadWriteShutdown({bool dropReads}) async {
}
}
-Future testGoogleUrl(SecurityContext context, String outcome) async {
+Future testGoogleHttp(SecurityContext context, String outcome) async {
Cutch 2016/11/23 19:31:19 how can this test fail outside of checked mode?
+ var client = new HttpClient(context: context);
+ try {
+ // First, check if the lookup works.
+ var address = await InternetAddress.lookup('www.google.com');
+ print(address);
+ var request = await client.getUrl(Uri.parse('http://www.google.com/'));
+ request.followRedirects = false;
+ var response = await request.close();
+ assert('pass' == outcome);
Cutch 2016/11/23 19:31:19 this should be an expect so that non-checked mode
+ try { await response.drain(); } catch (e) {
+ print('drain failed: $e');
+ }
+ } catch (e) {
+ // Lookup failed or connection failed. Don't report a failure.
+ print("SocketException: $e");
+ } finally {
+ client.close();
+ }
+}
+
+Future testGoogleHttps(SecurityContext context, String outcome) async {
+ // If this isn't reasonable, the certificate will be rejected.
+ print(new DateTime.now());
+
var client = new HttpClient(context: context);
// We need to use an external server that is backed by a
// built-in root certificate authority.
@@ -339,7 +363,7 @@ Future testGoogleUrl(SecurityContext context, String outcome) async {
// First, check if the lookup works.
var address = await InternetAddress.lookup('www.google.com');
print(address);
- var request = await client.getUrl(Uri.parse('http://www.google.com/'));
+ var request = await client.getUrl(Uri.parse('https://www.google.com/'));
request.followRedirects = false;
var response = await request.close();
assert('pass' == outcome);
@@ -378,9 +402,14 @@ main() async {
// await testSimpleReadWriteShutdown(dropReads: false);
// print("testSimpleReadWriteShutdown done");
- print("testGoogleUrl");
- await testGoogleUrl(null, 'pass');
- print("testGoogleUrl done");
+ print("testGoogleHttp");
+ await testGoogleHttp(null, 'pass');
+ print("testGoogleHttp done");
+
+ // TODO(US-96)
+ // print("testGoogleHttps");
+ // await testGoogleHttps(null, 'pass');
+ // print("testGoogleHttps done");
print("Goodbyte, Fuchsia!");
}

Powered by Google App Engine
This is Rietveld 408576698