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

Unified Diff: mojo/dart/test/handle_watcher_test.dart

Issue 1027603002: Dart: Removes all but native calls and the handle watcher from the snapshot. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Hoist application interface dependence Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/dart/test/handle_finalizer_test.dart ('k') | mojo/dart/test/import_mojo.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « mojo/dart/test/handle_finalizer_test.dart ('k') | mojo/dart/test/import_mojo.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698