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

Side by Side Diff: frog/tests/frog/src/FrogServerTest.dart

Issue 9570004: Revert "Rename blahHandler to onBlah throughout dart:io." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | « frog/server/frog_server.dart ('k') | runtime/bin/chunked_stream.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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('FrogServerTest'); 5 #library('FrogServerTest');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 8
9 #import('../../../server/frog_server.dart', prefix: 'frogserver'); 9 #import('../../../server/frog_server.dart', prefix: 'frogserver');
10 10
11 // TODO(jmesserly): more sane way to import JSON on the VM 11 // TODO(jmesserly): more sane way to import JSON on the VM
12 #import('../../../../lib/json/json.dart'); 12 #import('../../../../lib/json/json.dart');
13 13
14 main() { 14 main() {
15 // TODO(jmesserly): This test must be run from 'frog' working directory. 15 // TODO(jmesserly): This test must be run from 'frog' working directory.
16 var homedir = new File('.').fullPathSync(); 16 var homedir = new File('.').fullPathSync();
17 print('test: setting Frog home directory to $homedir'); 17 print('test: setting Frog home directory to $homedir');
18 18
19 // Start the compiler server. 0 causes it to grab any free port. 19 // Start the compiler server. 0 causes it to grab any free port.
20 var host = '127.0.0.1'; 20 var host = '127.0.0.1';
21 var compileSocket = frogserver.startServer(homedir, host, 0); 21 var compileSocket = frogserver.startServer(homedir, host, 0);
22 22
23 // Connect to the compiler 23 // Connect to the compiler
24 var testSocket = new Socket(host, compileSocket.port); 24 var testSocket = new Socket(host, compileSocket.port);
25 25
26 final testId = 'abc' + new Date.now().value; 26 final testId = 'abc' + new Date.now().value;
27 27
28 var bytes = new List<int>(); 28 var bytes = new List<int>();
29 testSocket.onData = () { 29 testSocket.dataHandler = () {
30 var pos = bytes.length; 30 var pos = bytes.length;
31 var len = testSocket.available(); 31 var len = testSocket.available();
32 bytes.insertRange(pos, len); 32 bytes.insertRange(pos, len);
33 testSocket.readList(bytes, pos, len); 33 testSocket.readList(bytes, pos, len);
34 var response = frogserver.tryReadJson(bytes); 34 var response = frogserver.tryReadJson(bytes);
35 if (response == null) return; // wait for more data 35 if (response == null) return; // wait for more data
36 36
37 // Verify ID 37 // Verify ID
38 Expect.equals(testId, response['id']); 38 Expect.equals(testId, response['id']);
39 if (response['kind'] == 'message') { 39 if (response['kind'] == 'message') {
(...skipping 16 matching lines...) Expand all
56 }; 56 };
57 57
58 // Try a hello world compile 58 // Try a hello world compile
59 frogserver.writeJson(testSocket.outputStream, { 59 frogserver.writeJson(testSocket.outputStream, {
60 'command': 'compile', 60 'command': 'compile',
61 'id': testId, 61 'id': testId,
62 'input': 'tests/hello.dart' 62 'input': 'tests/hello.dart'
63 // Note: intentionally don't specify 'output' so nothing is written to disk 63 // Note: intentionally don't specify 'output' so nothing is written to disk
64 }); 64 });
65 } 65 }
OLDNEW
« no previous file with comments | « frog/server/frog_server.dart ('k') | runtime/bin/chunked_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698