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

Unified Diff: mojo/dart/apptests/test_apps/pingpong/lib/main.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 6 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
Index: mojo/dart/apptests/test_apps/pingpong/lib/main.dart
diff --git a/mojo/dart/apptests/test_apps/pingpong/lib/main.dart b/mojo/dart/apptests/test_apps/pingpong/lib/main.dart
index 296838f2a190f3e01184c55fb977c30c694ed4ad..2287ba5d1730718c9b5d0dd2e0740a9fc4db49c3 100644
--- a/mojo/dart/apptests/test_apps/pingpong/lib/main.dart
+++ b/mojo/dart/apptests/test_apps/pingpong/lib/main.dart
@@ -47,10 +47,10 @@ class PingPongServiceImpl implements PingPongService {
}
}
- Future pingTargetUrl(String url, int count,
- [Function responseFactory]) async {
+ void pingTargetUrl(String url, int count, void callback(bool ok)) {
if (_application == null) {
- return responseFactory(false);
+ callback(false);
+ return;
}
var completer = new Completer();
var pingPongService = new PingPongServiceInterfaceRequest();
@@ -62,14 +62,14 @@ class PingPongServiceImpl implements PingPongService {
for (var i = 0; i < count; i++) {
pingPongService.ping(i);
}
- await completer.future;
- await pingPongService.close();
-
- return responseFactory(true);
+ completer.future.then((_) {
+ callback(true);
+ pingPongService.close();
+ });
}
- Future pingTargetService(PingPongServiceInterface service, int count,
- [Function responseFactory]) async {
+ void pingTargetService(
+ PingPongServiceInterface service, int count, void callback(bool ok)) {
var pingPongService = service;
var completer = new Completer();
var client = new PingPongClientImpl(count, completer);
@@ -78,10 +78,10 @@ class PingPongServiceImpl implements PingPongService {
for (var i = 0; i < count; i++) {
pingPongService.ping(i);
}
- await completer.future;
- await pingPongService.close();
-
- return responseFactory(true);
+ completer.future.then((_) {
+ callback(true);
+ pingPongService.close();
+ });
}
getPingPongService(PingPongServiceInterfaceRequest service) {
« no previous file with comments | « mojo/dart/apptests/test_apps/echo/lib/main.dart ('k') | mojo/dart/apptests/test_apps/pingpong_target/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698