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

Side by Side Diff: runtime/observatory/tests/service/auth_token_test.dart

Issue 2515023002: Allow binding the vm service to IPv6 addresses. (Closed)
Patch Set: . Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:developer'; 7 import 'dart:developer';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 import 'package:observatory/service_io.dart'; 9 import 'package:observatory/service_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 import 'test_helper.dart'; 11 import 'test_helper.dart';
12 12
13 Future<Null> testeeBefore() async { 13 Future<Null> testeeBefore() async {
14 print('testee before'); 14 print('testee before');
15 print(await Service.getInfo()); 15 print(await Service.getInfo());
16 // Start the web server. 16 // Start the web server.
17 ServiceProtocolInfo info = await Service.controlWebServer(enable: true); 17 ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
18 expect(info.serverUri, isNotNull); 18 expect(info.serverUri, isNotNull);
19 // Ensure that we have the auth token in the path segments. 19 // Ensure that we have the auth token in the path segments.
20 expect(info.serverUri.pathSegments.length, greaterThan(1)); 20 expect(info.serverUri.pathSegments.length, greaterThan(1));
21 // Sanity check the length of the auth token. 21 // Sanity check the length of the auth token.
22 expect(info.serverUri.pathSegments[0].length, greaterThan(8)); 22 expect(info.serverUri.pathSegments[0].length, greaterThan(8));
23 23
24 // Try connecting to the server without the auth token, it should throw 24 // Try connecting to the server without the auth token, it should throw
25 // an exception. 25 // an exception.
26 var port = info.serverUri.port; 26 var port = info.serverUri.port;
27 var url = Uri.parse('http://127.0.0.1:$port'); 27 var url = Uri.parse('http://localhost:$port');
28 var httpClient = new io.HttpClient(); 28 var httpClient = new io.HttpClient();
29 try { 29 try {
30 var request = await httpClient.getUrl(url); 30 var request = await httpClient.getUrl(url);
31 expect(true, false); 31 expect(true, false);
32 } catch (e) { 32 } catch (e) {
33 expect(true, true); 33 expect(true, true);
34 } 34 }
35 35
36 // Try connecting to the server with the auth token, it should succeed. 36 // Try connecting to the server with the auth token, it should succeed.
37 try { 37 try {
(...skipping 13 matching lines...) Expand all
51 } 51 }
52 ]; 52 ];
53 53
54 main(args) => runIsolateTests(args, 54 main(args) => runIsolateTests(args,
55 tests, 55 tests,
56 testeeBefore: testeeBefore, 56 testeeBefore: testeeBefore,
57 // the testee is responsible for starting the 57 // the testee is responsible for starting the
58 // web server. 58 // web server.
59 testeeControlsServer: true, 59 testeeControlsServer: true,
60 useAuthToken: true); 60 useAuthToken: true);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/auth_token1_test.dart ('k') | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698