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

Side by Side Diff: tests/standalone/vmservice/websocket_client_test.dart

Issue 652833005: Add additional check to vmservice/websocket_client test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/apps/update_homebrew/bin/update_homebrew.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 == 'cli') { 15 if (seq == 'cli') {
16 // Verify response is correct for 'cli' sequence id. 16 // Verify response is correct for 'cli' sequence id.
17 Expect.equals('ClientList', response['type']); 17 Expect.equals('ClientList', response['type']);
18 Expect.equals(1, response['members'].length); 18 Expect.equals(1, response['members'].length);
19 _count++; 19 _count++;
20 } else if (seq == 'vm') { 20 } else if (seq == 'vm') {
21 // Verify response is correct for 'vm' sequence id. 21 // Verify response is correct for 'vm' sequence id.
22 Expect.equals('VM', response['type']); 22 Expect.equals('VM', response['type']);
23 _count++; 23 _count++;
24 } else {
25 Expect.fail('Unexpected response from $seq: $response');
24 } 26 }
25 if (_count == 2) { 27 if (_count == 2) {
26 // After receiving both responses, the test is complete. 28 // After receiving both responses, the test is complete.
27 complete(); 29 complete();
28 } 30 }
29 } 31 }
30 32
31 runTest() { 33 runTest() {
32 // Send a request for clients with 'cli' sequence id. 34 // Send a request for clients with 'cli' sequence id.
33 sendMessage('cli', 'clients'); 35 sendMessage('cli', 'clients');
34 // Send a request for vm info with 'vm' sequence id. 36 // Send a request for vm info with 'vm' sequence id.
35 sendMessage('vm', 'vm'); 37 sendMessage('vm', 'vm');
36 } 38 }
37 } 39 }
38 40
39 main() { 41 main() {
40 var process = new TestLauncher('unknown_command_script.dart'); 42 var process = new TestLauncher('unknown_command_script.dart');
41 process.launch().then((port) { 43 process.launch().then((port) {
42 new ClientsRequestTest(port).connect().then((test) { 44 new ClientsRequestTest(port).connect().then((test) {
43 test.completed.then((_) { 45 test.completed.then((_) {
44 process.requestExit(); 46 process.requestExit();
45 }); 47 });
46 test.runTest(); 48 test.runTest();
47 }); 49 });
48 }); 50 });
49 } 51 }
OLDNEW
« no previous file with comments | « no previous file | tools/apps/update_homebrew/bin/update_homebrew.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698