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

Unified Diff: mojo/dart/apptests/dart_apptests/lib/src/pingpong_apptests.dart

Issue 1948003003: Dart: Wait to handle events on a Stub until it makes sense to do it. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add test Created 4 years, 7 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 | « no previous file | mojo/dart/apptests/test_apps/interfaces/pingpong_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/apptests/dart_apptests/lib/src/pingpong_apptests.dart
diff --git a/mojo/dart/apptests/dart_apptests/lib/src/pingpong_apptests.dart b/mojo/dart/apptests/dart_apptests/lib/src/pingpong_apptests.dart
index a608d77f3da9bcb766fb45e0dd7ca5df642ae3b8..bc278e246fec9b33a894009a8f845636d011b06d 100644
--- a/mojo/dart/apptests/dart_apptests/lib/src/pingpong_apptests.dart
+++ b/mojo/dart/apptests/dart_apptests/lib/src/pingpong_apptests.dart
@@ -121,5 +121,34 @@ pingpongApptests(Application application, String url) {
await targetServiceProxy.close();
await pingPongServiceProxy.close();
});
+
+ // Verify that Dart can implement an interface "request" parameter that
+ // isn't hooked up to an actual service implementation until after some
+ // delay.
+ test('Get Target Service Delayed', () async {
+ var pingPongServiceProxy = new PingPongServiceProxy.unbound();
+ pingPongServiceProxy.errorFuture.then((e) => fail('$e'));
+ application.connectToService(
+ "mojo:dart_pingpong", pingPongServiceProxy);
+
+ var targetServiceProxy = new PingPongServiceProxy.unbound();
+ targetServiceProxy.errorFuture.then((e) => fail('$e'));
+ pingPongServiceProxy.ptr.getPingPongServiceDelayed(targetServiceProxy);
+
+ var pingPongClient = new _TestingPingPongClient.unbound();
+ targetServiceProxy.ptr.setClient(pingPongClient.stub);
+
+ targetServiceProxy.ptr.ping(1);
+ var pongValue = await pingPongClient.waitForPong();
+ expect(pongValue, equals(2));
+
+ targetServiceProxy.ptr.ping(100);
+ pongValue = await pingPongClient.waitForPong();
+ expect(pongValue, equals(101));
+
+ await pingPongClient.stub.close();
+ await targetServiceProxy.close();
+ await pingPongServiceProxy.close();
+ });
});
}
« no previous file with comments | « no previous file | mojo/dart/apptests/test_apps/interfaces/pingpong_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698