| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:test/test.dart'; | 7 import 'package:test/test.dart'; |
| 8 import 'package:vm_service_client/vm_service_client.dart'; | 8 import 'package:vm_service_client/vm_service_client.dart'; |
| 9 import 'package:web_socket_channel/web_socket_channel.dart'; | 9 import 'package:web_socket_channel/web_socket_channel.dart'; |
| 10 | 10 |
| 11 import 'utils.dart'; | 11 import 'utils.dart'; |
| 12 | 12 |
| 13 VMServiceClient client; | 13 VMServiceClient client; |
| 14 | 14 |
| 15 void main() { | 15 void main() { |
| 16 tearDown(() { | 16 tearDown(() { |
| 17 if (client != null) client.close(); | 17 if (client != null) client.close(); |
| 18 }); | 18 }); |
| 19 | 19 |
| 20 test("returns the VM service version", () async { | 20 test("returns the VM service version", () async { |
| 21 client = await runAndConnect(); | 21 client = await runAndConnect(); |
| 22 var version = await client.getVersion(); | 22 var version = await client.getVersion(); |
| 23 expect(version.major, equals(3)); | 23 expect(version.major, equals(3)); |
| 24 expect(version.minor, new isInstanceOf<int>()); | 24 expect(version.minor, greaterThanOrEqualTo(4)); |
| 25 }); | 25 }); |
| 26 | 26 |
| 27 test("considers the VM service version valid", () async { | 27 test("considers the VM service version valid", () async { |
| 28 client = await runAndConnect(); | 28 client = await runAndConnect(); |
| 29 await client.validateVersion(); | 29 await client.validateVersion(); |
| 30 }); | 30 }); |
| 31 | 31 |
| 32 test("validateVersion() respects a custom timeout", () async { | 32 test("validateVersion() respects a custom timeout", () async { |
| 33 client = await runAndConnect(); | 33 client = await runAndConnect(); |
| 34 expect(client.validateVersion(timeout: Duration.ZERO), | 34 expect(client.validateVersion(timeout: Duration.ZERO), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 isolate = await isolate.loadRunnable(); | 66 isolate = await isolate.loadRunnable(); |
| 67 expect(isolate.pauseEvent, new isInstanceOf<VMPauseStartEvent>()); | 67 expect(isolate.pauseEvent, new isInstanceOf<VMPauseStartEvent>()); |
| 68 expect(isolate.error, isNull); | 68 expect(isolate.error, isNull); |
| 69 }); | 69 }); |
| 70 | 70 |
| 71 test("with an invalid URL", () { | 71 test("with an invalid URL", () { |
| 72 var client = new VMServiceClient.connect("ws://example.org/not-a-ws"); | 72 var client = new VMServiceClient.connect("ws://example.org/not-a-ws"); |
| 73 expect(client.done, throwsA(new isInstanceOf<WebSocketChannelException>())); | 73 expect(client.done, throwsA(new isInstanceOf<WebSocketChannelException>())); |
| 74 }); | 74 }); |
| 75 } | 75 } |
| OLD | NEW |