Index: mojo/dart/test/handle_watcher_test.dart |
diff --git a/mojo/dart/test/handle_watcher_test.dart b/mojo/dart/test/handle_watcher_test.dart |
index 7bc0d2fad3651388374a02abf9068a9b08e73bab..ad6860c5b2c4aa20bb27327f112c700175e0b8ee 100644 |
--- a/mojo/dart/test/handle_watcher_test.dart |
+++ b/mojo/dart/test/handle_watcher_test.dart |
@@ -5,9 +5,9 @@ |
import 'dart:async'; |
import 'dart:isolate'; |
import 'dart:typed_data'; |
-import 'dart:mojo.core'; |
import 'package:mojo/dart/testing/expect.dart'; |
+import 'package:mojo/public/dart/core.dart'; |
void simpleTest() { |
var pipe = new MojoMessagePipe(); |
@@ -33,7 +33,6 @@ void simpleTest() { |
}); |
} |
- |
Future simpleAsyncAwaitTest() async { |
var pipe = new MojoMessagePipe(); |
Expect.isNotNull(pipe); |
@@ -52,19 +51,16 @@ Future simpleAsyncAwaitTest() async { |
Expect.equals(1, numEvents); |
} |
- |
ByteData byteDataOfString(String s) { |
return new ByteData.view((new Uint8List.fromList(s.codeUnits)).buffer); |
} |
- |
String stringOfByteData(ByteData bytes) { |
return new String.fromCharCodes(bytes.buffer.asUint8List().toList()); |
} |
- |
-void expectStringFromEndpoint(String expected, |
- MojoMessagePipeEndpoint endpoint) { |
+void expectStringFromEndpoint( |
+ String expected, MojoMessagePipeEndpoint endpoint) { |
// Query how many bytes are available. |
var result = endpoint.query(); |
Expect.isNotNull(result); |
@@ -82,7 +78,6 @@ void expectStringFromEndpoint(String expected, |
Expect.equals(expected, msg); |
} |
- |
Future pingPongIsolate(MojoMessagePipeEndpoint endpoint) async { |
int pings = 0; |
int pongs = 0; |
@@ -107,13 +102,12 @@ Future pingPongIsolate(MojoMessagePipeEndpoint endpoint) async { |
Expect.equals(10, pongs); |
} |
- |
Future pingPongTest() async { |
var pipe = new MojoMessagePipe(); |
var isolate = await Isolate.spawn(pingPongIsolate, pipe.endpoints[0]); |
var endpoint = pipe.endpoints[1]; |
var eventStream = |
- new MojoEventStream(endpoint.handle, MojoHandleSignals.READWRITE); |
+ new MojoEventStream(endpoint.handle, MojoHandleSignals.READWRITE); |
int pings = 0; |
int pongs = 0; |
@@ -128,20 +122,19 @@ Future pingPongTest() async { |
if (pongs == 10) { |
eventStream.close(); |
} |
- eventStream.enableWriteEvents(); // Now it is our turn to send. |
+ eventStream.enableWriteEvents(); // Now it is our turn to send. |
} else if (mojoSignals.isWritable) { |
if (pings < 10) { |
endpoint.write(byteDataOfString("Ping")); |
pings++; |
} |
- eventStream.enableReadEvents(); // Don't send while waiting for reply. |
+ eventStream.enableReadEvents(); // Don't send while waiting for reply. |
} |
} |
Expect.equals(10, pings); |
Expect.equals(10, pongs); |
} |
- |
main() async { |
simpleTest(); |
await simpleAsyncAwaitTest(); |