Chromium Code Reviews| Index: tests/standalone/vmservice/websocket_client_test.dart |
| diff --git a/tests/standalone/vmservice/websocket_client_test.dart b/tests/standalone/vmservice/websocket_client_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e37cd3252027c82ddc932ede648cf60e88bd83e7 |
| --- /dev/null |
| +++ b/tests/standalone/vmservice/websocket_client_test.dart |
| @@ -0,0 +1,44 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +library unknown_command_test; |
| + |
| +import 'test_helper.dart'; |
| +import 'package:expect/expect.dart'; |
| + |
| +class ClientsRequestTest extends ServiceWebSocketRequestHelper { |
| + ClientsRequestTest(port) : super('ws://127.0.0.1:$port/ws'); |
| + int _count = 0; |
| + |
| + onResponse(var seq, Map response) { |
| + if (seq == 'cli') { |
| + Expect.equals('ClientList', response['type']); |
| + Expect.equals(1, response['members'].length); |
| + _count++; |
| + } else if (seq == 'iso') { |
| + Expect.equals('IsolateList', response['type']); |
| + _count++; |
| + } |
| + if (_count == 2) { |
| + complete(); |
| + } |
| + } |
| + |
| + runTest() { |
|
turnidge
2013/12/11 17:56:07
Could use a high-level comment somewhere in the te
Cutch
2013/12/12 22:37:42
Done.
|
| + sendMessage('cli', ['clients']); |
| + sendMessage('iso', ['isolates']); |
| + } |
| +} |
| + |
| +main() { |
| + var process = new TestLauncher('unknown_command_script.dart'); |
| + process.launch().then((port) { |
| + new ClientsRequestTest(port).connect().then((test) { |
| + test.completed.then((_) { |
| + process.requestExit(); |
| + }); |
| + test.runTest(); |
| + }); |
| + }); |
| +} |