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

Side by Side Diff: services/dart/dart_apptests/lib/src/pingpong_apptests.dart

Issue 1311803002: Dart: Removes dartzip (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Readme fixes Created 5 years, 3 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
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:apptest/apptest.dart'; 9 import 'package:apptest/apptest.dart';
10 import 'package:mojom/dart/test/pingpong_service.mojom.dart'; 10 import 'package:mojom/dart/test/pingpong_service.mojom.dart';
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 } 32 }
33 33
34 pingpongApptests(Application application, String url) { 34 pingpongApptests(Application application, String url) {
35 group('Ping-Pong Service Apptests', () { 35 group('Ping-Pong Service Apptests', () {
36 // Verify that "pingpong.dart" implements the PingPongService interface 36 // Verify that "pingpong.dart" implements the PingPongService interface
37 // and sends responses to our client. 37 // and sends responses to our client.
38 test('Ping Service To Pong Client', () async { 38 test('Ping Service To Pong Client', () async {
39 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); 39 var pingPongServiceProxy = new PingPongServiceProxy.unbound();
40 application.connectToService( 40 application.connectToService(
41 "mojo:mojo_dart_pingpong_pkg", pingPongServiceProxy); 41 "mojo:dart_pingpong", pingPongServiceProxy);
42 42
43 var pingPongClient = new _TestingPingPongClient.unbound(); 43 var pingPongClient = new _TestingPingPongClient.unbound();
44 pingPongServiceProxy.ptr.setClient(pingPongClient.stub); 44 pingPongServiceProxy.ptr.setClient(pingPongClient.stub);
45 45
46 pingPongServiceProxy.ptr.ping(1); 46 pingPongServiceProxy.ptr.ping(1);
47 var pongValue = await pingPongClient.waitForPong(); 47 var pongValue = await pingPongClient.waitForPong();
48 expect(pongValue, equals(2)); 48 expect(pongValue, equals(2));
49 49
50 pingPongServiceProxy.ptr.ping(100); 50 pingPongServiceProxy.ptr.ping(100);
51 pongValue = await pingPongClient.waitForPong(); 51 pongValue = await pingPongClient.waitForPong();
52 expect(pongValue, equals(101)); 52 expect(pongValue, equals(101));
53 53
54 await pingPongClient.stub.close(); 54 await pingPongClient.stub.close();
55 await pingPongServiceProxy.close(); 55 await pingPongServiceProxy.close();
56 }); 56 });
57 57
58 // Verify that "pingpong.dart" can connect to "pingpong_target.dart", act as 58 // Verify that "pingpong.dart" can connect to "pingpong_target.dart", act as
59 // its client, and return a Future that only resolves after the 59 // its client, and return a Future that only resolves after the
60 // target.ping() => client.pong() methods have executed 9 times. 60 // target.ping() => client.pong() methods have executed 9 times.
61 test('Ping Target URL', () async { 61 test('Ping Target URL', () async {
62 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); 62 var pingPongServiceProxy = new PingPongServiceProxy.unbound();
63 application.connectToService( 63 application.connectToService(
64 "mojo:mojo_dart_pingpong_pkg", pingPongServiceProxy); 64 "mojo:dart_pingpong", pingPongServiceProxy);
65 65
66 var r = await pingPongServiceProxy.ptr.pingTargetUrl( 66 var r = await pingPongServiceProxy.ptr.pingTargetUrl(
67 "mojo:mojo_dart_pingpong_target_pkg", 9); 67 "mojo:dart_pingpong_target", 9);
68 expect(r.ok, equals(true)); 68 expect(r.ok, equals(true));
69 69
70 await pingPongServiceProxy.close(); 70 await pingPongServiceProxy.close();
71 }); 71 });
72 72
73 // Same as the previous test except that instead of providing the 73 // Same as the previous test except that instead of providing the
74 // pingpong_target.dart URL, we provide a connection to its PingPongService. 74 // pingpong_target.dart URL, we provide a connection to its PingPongService.
75 test('Ping Target Service', () async { 75 test('Ping Target Service', () async {
76 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); 76 var pingPongServiceProxy = new PingPongServiceProxy.unbound();
77 application.connectToService( 77 application.connectToService(
78 "mojo:mojo_dart_pingpong_pkg", pingPongServiceProxy); 78 "mojo:dart_pingpong", pingPongServiceProxy);
79 79
80 var targetServiceProxy = new PingPongServiceProxy.unbound(); 80 var targetServiceProxy = new PingPongServiceProxy.unbound();
81 application.connectToService( 81 application.connectToService(
82 "mojo:mojo_dart_pingpong_target_pkg", targetServiceProxy); 82 "mojo:dart_pingpong_target", targetServiceProxy);
83 83
84 var r = await pingPongServiceProxy.ptr.pingTargetService( 84 var r = await pingPongServiceProxy.ptr.pingTargetService(
85 targetServiceProxy.impl, 9); 85 targetServiceProxy.impl, 9);
86 expect(r.ok, equals(true)); 86 expect(r.ok, equals(true));
87 // This side no longer has access to the pipe. 87 // This side no longer has access to the pipe.
88 expect(targetServiceProxy.impl.isOpen, equals(false)); 88 expect(targetServiceProxy.impl.isOpen, equals(false));
89 expect(targetServiceProxy.impl.isBound, equals(false)); 89 expect(targetServiceProxy.impl.isBound, equals(false));
90 90
91 await pingPongServiceProxy.close(); 91 await pingPongServiceProxy.close();
92 }); 92 });
93 93
94 // Verify that Dart can implement an interface "request" parameter. 94 // Verify that Dart can implement an interface "request" parameter.
95 test('Get Target Service', () async { 95 test('Get Target Service', () async {
96 var pingPongServiceProxy = new PingPongServiceProxy.unbound(); 96 var pingPongServiceProxy = new PingPongServiceProxy.unbound();
97 application.connectToService( 97 application.connectToService(
98 "mojo:mojo_dart_pingpong_pkg", pingPongServiceProxy); 98 "mojo:dart_pingpong", pingPongServiceProxy);
99 99
100 var targetServiceProxy = new PingPongServiceProxy.unbound(); 100 var targetServiceProxy = new PingPongServiceProxy.unbound();
101 pingPongServiceProxy.ptr.getPingPongService(targetServiceProxy); 101 pingPongServiceProxy.ptr.getPingPongService(targetServiceProxy);
102 102
103 var pingPongClient = new _TestingPingPongClient.unbound(); 103 var pingPongClient = new _TestingPingPongClient.unbound();
104 targetServiceProxy.ptr.setClient(pingPongClient.stub); 104 targetServiceProxy.ptr.setClient(pingPongClient.stub);
105 105
106 targetServiceProxy.ptr.ping(1); 106 targetServiceProxy.ptr.ping(1);
107 var pongValue = await pingPongClient.waitForPong(); 107 var pongValue = await pingPongClient.waitForPong();
108 expect(pongValue, equals(2)); 108 expect(pongValue, equals(2));
109 109
110 targetServiceProxy.ptr.ping(100); 110 targetServiceProxy.ptr.ping(100);
111 pongValue = await pingPongClient.waitForPong(); 111 pongValue = await pingPongClient.waitForPong();
112 expect(pongValue, equals(101)); 112 expect(pongValue, equals(101));
113 113
114 await pingPongClient.stub.close(); 114 await pingPongClient.stub.close();
115 await targetServiceProxy.close(); 115 await targetServiceProxy.close();
116 await pingPongServiceProxy.close(); 116 await pingPongServiceProxy.close();
117 }); 117 });
118 }); 118 });
119 } 119 }
OLDNEW
« no previous file with comments | « services/dart/dart_apptests/lib/src/echo_apptests.dart ('k') | services/dart/test/echo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698