| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library unknown_command_test; | 5 library unknown_command_test; |
| 6 | 6 |
| 7 import 'test_helper.dart'; | 7 import 'test_helper.dart'; |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 | 9 |
| 10 class ClientsRequestTest extends ServiceWebSocketRequestHelper { | 10 class ClientsRequestTest extends ServiceWebSocketRequestHelper { |
| 11 ClientsRequestTest(port) : super('ws://127.0.0.1:$port/ws'); | 11 ClientsRequestTest(port) : super('ws://127.0.0.1:$port/ws'); |
| 12 int _count = 0; | 12 int _count = 0; |
| 13 | 13 |
| 14 onResponse(var seq, Map response) { | 14 onResponse(var seq, Map response) { |
| 15 if (seq == null) { |
| 16 // Ignore push events. |
| 17 return; |
| 18 } |
| 15 if (seq == 'cli') { | 19 if (seq == 'cli') { |
| 16 // Verify response is correct for 'cli' sequence id. | 20 // Verify response is correct for 'cli' sequence id. |
| 17 Expect.equals('ClientList', response['type']); | 21 Expect.equals('ClientList', response['type']); |
| 18 Expect.equals(1, response['members'].length); | 22 Expect.equals(1, response['members'].length); |
| 19 _count++; | 23 _count++; |
| 20 } else if (seq == 'vm') { | 24 } else if (seq == 'vm') { |
| 21 // Verify response is correct for 'vm' sequence id. | 25 // Verify response is correct for 'vm' sequence id. |
| 22 Expect.equals('VM', response['type']); | 26 Expect.equals('VM', response['type']); |
| 23 _count++; | 27 _count++; |
| 24 } else { | 28 } else { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 var process = new TestLauncher('unknown_command_script.dart'); | 46 var process = new TestLauncher('unknown_command_script.dart'); |
| 43 process.launch().then((port) { | 47 process.launch().then((port) { |
| 44 new ClientsRequestTest(port).connect().then((test) { | 48 new ClientsRequestTest(port).connect().then((test) { |
| 45 test.completed.then((_) { | 49 test.completed.then((_) { |
| 46 process.requestExit(); | 50 process.requestExit(); |
| 47 }); | 51 }); |
| 48 test.runTest(); | 52 test.runTest(); |
| 49 }); | 53 }); |
| 50 }); | 54 }); |
| 51 } | 55 } |
| OLD | NEW |