blob: 9e7bfcd4aefaf091158ef187253be0aa3581e802 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:isolate';
import 'dart:mojo_core' as core;
main() {
var pipe = new core.MojoMessagePipe();
assert(pipe != null);
var endpoint = pipe.endpoints[0];
assert(endpoint.handle.isValid);
var handle = new core.MojoHandle(endpoint.handle);
var completer = new Completer();
int numEvents = 0;
handle.enableWriteEvents();
handle.listen((_) {
numEvents++;
handle.close();
}, onDone: () {
completer.complete(numEvents);
});
completer.future.then((int numEvents) {
assert(numEvents ==1);
});
}