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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library pingpong_apptests; 5 library pingpong_apptests;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:mojo_apptest/apptest.dart'; 9 import 'package:mojo_apptest/apptest.dart';
10 import 'package:mojo/application.dart'; 10 import 'package:mojo/application.dart';
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 expect(pongValue, equals(2)); 114 expect(pongValue, equals(2));
115 115
116 targetServiceProxy.ptr.ping(100); 116 targetServiceProxy.ptr.ping(100);
117 pongValue = await pingPongClient.waitForPong(); 117 pongValue = await pingPongClient.waitForPong();
118 expect(pongValue, equals(101)); 118 expect(pongValue, equals(101));
119 119
120 await pingPongClient.stub.close(); 120 await pingPongClient.stub.close();
121 await targetServiceProxy.close(); 121 await targetServiceProxy.close();
122 await pingPongServiceProxy.close(); 122 await pingPongServiceProxy.close();
123 }); 123 });
124
125 // Verify that Dart can implement an interface "request" parameter that
126 // isn't hooked up to an actual service implementation until after some
127 // delay.
128 test('Get Target Service Delayed', () async {
129 var pingPongServiceProxy = new PingPongServiceProxy.unbound();
130 pingPongServiceProxy.errorFuture.then((e) => fail('$e'));
131 application.connectToService(
132 "mojo:dart_pingpong", pingPongServiceProxy);
133
134 var targetServiceProxy = new PingPongServiceProxy.unbound();
135 targetServiceProxy.errorFuture.then((e) => fail('$e'));
136 pingPongServiceProxy.ptr.getPingPongServiceDelayed(targetServiceProxy);
137
138 var pingPongClient = new _TestingPingPongClient.unbound();
139 targetServiceProxy.ptr.setClient(pingPongClient.stub);
140
141 targetServiceProxy.ptr.ping(1);
142 var pongValue = await pingPongClient.waitForPong();
143 expect(pongValue, equals(2));
144
145 targetServiceProxy.ptr.ping(100);
146 pongValue = await pingPongClient.waitForPong();
147 expect(pongValue, equals(101));
148
149 await pingPongClient.stub.close();
150 await targetServiceProxy.close();
151 await pingPongServiceProxy.close();
152 });
124 }); 153 });
125 } 154 }
OLDNEW
« 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