blob: 86d1c9ff32ff3be7ed2bee83dd0dc558a7393c21 [file] [log] [blame]
/*
* Copyright (c) 2017, the Dart project authors. Please see the AUTHORS
* file for details. All rights reserved. Use of this source code is governed
* by a BSD-style license that can be found in the LICENSE file.
*/
/**
* @assertion void resume(
* Capability resumeCapability
* )
* Resumes a paused isolate.
* Sends a message to an isolate requesting that it ends a pause that was
* requested using the resumeCapability.
*
* @description Check that event queue is processed after call to resume()
*
* @author a.semenov@unipro.ru
*/
import "dart:isolate";
import "../../../Utils/expect.dart";
import "IsolateUtil.dart";
test() async {
ReceivePort receivePort = new ReceivePort();
EchoServer server = await EchoServer.spawn(receivePort.sendPort);
Expect.equals("hello", await server.ping("hello"));
Capability resumeCapability = server.isolate.pause();
Expect.equals("timeout", await server.ping("paused", ONE_SECOND, "timeout"));
server.isolate.resume(resumeCapability);
Expect.equals("server", await server.ping("server"));
await server.stop();
receivePort.close();
asyncEnd();
}
main() {
asyncStart();
test();
}