| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'mojo:application'; | 6 import 'mojo:application'; |
| 7 import 'mojo:bindings'; | 7 import 'mojo:bindings'; |
| 8 import 'mojo:core'; | 8 import 'mojo:core'; |
| 9 | 9 |
| 10 import 'package:apptest/apptest.dart'; | 10 import 'package:apptest/apptest.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 pingpongApptests(Application application, String url) { | 32 pingpongApptests(Application application, String url) { |
| 33 group('Ping-Pong Service Apptests', () { | 33 group('Ping-Pong Service Apptests', () { |
| 34 // Verify that "pingpong.dart" implements the PingPongService interface | 34 // Verify that "pingpong.dart" implements the PingPongService interface |
| 35 // and sends responses to our client. | 35 // and sends responses to our client. |
| 36 test('Ping Service To Pong Client', () async { | 36 test('Ping Service To Pong Client', () async { |
| 37 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); | 37 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); |
| 38 application.connectToService("mojo:dart_pingpong", pingPongServiceProxy); | 38 application.connectToService("mojo:dart_pingpong", pingPongServiceProxy); |
| 39 | 39 |
| 40 var pingPongClient = new _TestingPingPongClient.unbound(); | 40 var pingPongClient = new _TestingPingPongClient.unbound(); |
| 41 pingPongServiceProxy.ptr.setClient(pingPongClient.stub); | 41 pingPongServiceProxy.ptr.setClient(pingPongClient.stub); |
| 42 pingPongClient.stub.listen(); | |
| 43 | 42 |
| 44 pingPongServiceProxy.ptr.ping(1); | 43 pingPongServiceProxy.ptr.ping(1); |
| 45 var pongValue = await pingPongClient.waitForPong(); | 44 var pongValue = await pingPongClient.waitForPong(); |
| 46 expect(pongValue, equals(2)); | 45 expect(pongValue, equals(2)); |
| 47 | 46 |
| 48 pingPongServiceProxy.ptr.ping(100); | 47 pingPongServiceProxy.ptr.ping(100); |
| 49 pongValue = await pingPongClient.waitForPong(); | 48 pongValue = await pingPongClient.waitForPong(); |
| 50 expect(pongValue, equals(101)); | 49 expect(pongValue, equals(101)); |
| 51 | 50 |
| 52 pingPongClient.stub.close(); | 51 pingPongClient.stub.close(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Verify that Dart can implement an interface "request" parameter. | 89 // Verify that Dart can implement an interface "request" parameter. |
| 91 test('Get Target Service', () async { | 90 test('Get Target Service', () async { |
| 92 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); | 91 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); |
| 93 application.connectToService("mojo:dart_pingpong", pingPongServiceProxy); | 92 application.connectToService("mojo:dart_pingpong", pingPongServiceProxy); |
| 94 | 93 |
| 95 var targetServiceProxy = new PingPongServiceProxy.unbound(); | 94 var targetServiceProxy = new PingPongServiceProxy.unbound(); |
| 96 pingPongServiceProxy.ptr.getPingPongService(targetServiceProxy); | 95 pingPongServiceProxy.ptr.getPingPongService(targetServiceProxy); |
| 97 | 96 |
| 98 var pingPongClient = new _TestingPingPongClient.unbound(); | 97 var pingPongClient = new _TestingPingPongClient.unbound(); |
| 99 targetServiceProxy.ptr.setClient(pingPongClient.stub); | 98 targetServiceProxy.ptr.setClient(pingPongClient.stub); |
| 100 pingPongClient.stub.listen(); | |
| 101 | 99 |
| 102 targetServiceProxy.ptr.ping(1); | 100 targetServiceProxy.ptr.ping(1); |
| 103 var pongValue = await pingPongClient.waitForPong(); | 101 var pongValue = await pingPongClient.waitForPong(); |
| 104 expect(pongValue, equals(2)); | 102 expect(pongValue, equals(2)); |
| 105 | 103 |
| 106 targetServiceProxy.ptr.ping(100); | 104 targetServiceProxy.ptr.ping(100); |
| 107 pongValue = await pingPongClient.waitForPong(); | 105 pongValue = await pingPongClient.waitForPong(); |
| 108 expect(pongValue, equals(101)); | 106 expect(pongValue, equals(101)); |
| 109 | 107 |
| 110 pingPongClient.stub.close(); | 108 pingPongClient.stub.close(); |
| 111 targetServiceProxy.close(); | 109 targetServiceProxy.close(); |
| 112 pingPongServiceProxy.close(); | 110 pingPongServiceProxy.close(); |
| 113 }); | 111 }); |
| 114 }); | 112 }); |
| 115 } | 113 } |
| OLD | NEW |