| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |