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

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

Issue 2980733003: Introduced support for external services registration in the ServiceProtocol (Closed)
Patch Set: Address comments Created 3 years, 5 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
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' as S;
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 no auth token in the path segments. 19 // Ensure that we have no auth token in the path segments.
20 expect(info.serverUri.pathSegments.length, equals(0)); 20 expect(info.serverUri.pathSegments.length, equals(0));
21 21
22 // Try connecting to the server without the auth token, it should succeed. 22 // Try connecting to the server without the auth token, it should succeed.
23 var port = info.serverUri.port; 23 var port = info.serverUri.port;
24 var url = Uri.parse('http://localhost:$port'); 24 var url = Uri.parse('http://localhost:$port');
25 var httpClient = new io.HttpClient(); 25 var httpClient = new io.HttpClient();
26 try { 26 try {
27 await httpClient.getUrl(url); 27 await httpClient.getUrl(url);
28 expect(true, true); 28 expect(true, true);
29 } catch (e) { 29 } catch (e) {
30 expect(true, false); 30 expect(true, false);
31 } 31 }
32 } 32 }
33 33
34 var tests = [ 34 var tests = [
35 (Isolate isolate) async { 35 (S.Isolate isolate) async {
36 await isolate.reload(); 36 await isolate.reload();
37 // Just getting here means that the testee enabled the service protocol 37 // Just getting here means that the testee enabled the service protocol
38 // web server. 38 // web server.
39 expect(true, true); 39 expect(true, true);
40 } 40 }
41 ]; 41 ];
42 42
43 main(args) => runIsolateTests(args, tests, 43 main(args) => runIsolateTests(args, tests,
44 testeeBefore: testeeBefore, 44 testeeBefore: testeeBefore,
45 // the testee is responsible for starting the 45 // the testee is responsible for starting the
46 // web server. 46 // web server.
47 testeeControlsServer: true, 47 testeeControlsServer: true,
48 useAuthToken: false); 48 useAuthToken: false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698