OLD | NEW |
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 the auth token in the path segments. | 19 // Ensure that we have the auth token in the path segments. |
(...skipping 16 matching lines...) Expand all Loading... |
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 { |
38 var request = await httpClient.getUrl(info.serverUri); | 38 var request = await httpClient.getUrl(info.serverUri); |
39 expect(true, true); | 39 expect(true, true); |
40 } catch (e) { | 40 } catch (e) { |
41 expect(true, false); | 41 expect(true, false); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 var tests = [ | 45 var tests = [ |
46 (Isolate isolate) async { | 46 (S.Isolate isolate) async { |
47 await isolate.reload(); | 47 await isolate.reload(); |
48 // Just getting here means that the testee enabled the service protocol | 48 // Just getting here means that the testee enabled the service protocol |
49 // web server. | 49 // web server. |
50 expect(true, true); | 50 expect(true, true); |
51 } | 51 } |
52 ]; | 52 ]; |
53 | 53 |
54 main(args) => runIsolateTests(args, tests, | 54 main(args) => runIsolateTests(args, tests, |
55 testeeBefore: testeeBefore, | 55 testeeBefore: testeeBefore, |
56 // the testee is responsible for starting the | 56 // the testee is responsible for starting the |
57 // web server. | 57 // web server. |
58 testeeControlsServer: true, | 58 testeeControlsServer: true, |
59 useAuthToken: true); | 59 useAuthToken: true); |
OLD | NEW |