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

Side by Side Diff: services/dart/test/pingpong/main.dart

Issue 998693004: Enable dartanalyze warnings. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: zra comments Created 5 years, 9 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 | « services/dart/test/echo/main.dart ('k') | services/dart/test/pingpong_target/main.dart » ('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 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:services/dart/test/pingpong_service.mojom.dart'; 10 import 'package:services/dart/test/pingpong_service.mojom.dart';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 assert(_pingPongClient == null); 44 assert(_pingPongClient == null);
45 _pingPongClient = proxyBase; 45 _pingPongClient = proxyBase;
46 } 46 }
47 47
48 void ping(int pingValue) { 48 void ping(int pingValue) {
49 if (_pingPongClient != null) { 49 if (_pingPongClient != null) {
50 _pingPongClient.ptr.pong(pingValue + 1); 50 _pingPongClient.ptr.pong(pingValue + 1);
51 } 51 }
52 } 52 }
53 53
54 Future pingTargetUrl(String url, int count, Function responseFactory) async { 54 Future pingTargetUrl(String url, int count,
55 [Function responseFactory]) async {
55 if (_application == null) { 56 if (_application == null) {
56 return responseFactory(false); 57 return responseFactory(false);
57 } 58 }
58 var completer = new Completer(); 59 var completer = new Completer();
59 var pingPongService = new PingPongServiceProxy.unbound(); 60 var pingPongService = new PingPongServiceProxy.unbound();
60 _application.connectToService(url, pingPongService); 61 _application.connectToService(url, pingPongService);
61 62
62 var pingPongClient = new PingPongClientImpl.unbound(count, completer); 63 var pingPongClient = new PingPongClientImpl.unbound(count, completer);
63 pingPongService.ptr.setClient(pingPongClient.stub); 64 pingPongService.ptr.setClient(pingPongClient.stub);
64 65
65 for (var i = 0; i < count; i++) { 66 for (var i = 0; i < count; i++) {
66 pingPongService.ptr.ping(i); 67 pingPongService.ptr.ping(i);
67 } 68 }
68 await completer.future; 69 await completer.future;
69 pingPongService.ptr.quit(); 70 pingPongService.ptr.quit();
70 pingPongService.close(); 71 pingPongService.close();
71 72
72 return responseFactory(true); 73 return responseFactory(true);
73 } 74 }
74 75
75 Future pingTargetService( 76 Future pingTargetService(ProxyBase proxyBase, int count,
76 ProxyBase proxyBase, int count, Function responseFactory) async { 77 [Function responseFactory]) async {
77 var pingPongService = proxyBase; 78 var pingPongService = proxyBase;
78 var completer = new Completer(); 79 var completer = new Completer();
79 var client = new PingPongClientImpl.unbound(count, completer); 80 var client = new PingPongClientImpl.unbound(count, completer);
80 pingPongService.ptr.setClient(client.stub); 81 pingPongService.ptr.setClient(client.stub);
81 82
82 for (var i = 0; i < count; i++) { 83 for (var i = 0; i < count; i++) {
83 pingPongService.ptr.ping(i); 84 pingPongService.ptr.ping(i);
84 } 85 }
85 await completer.future; 86 await completer.future;
86 pingPongService.ptr.quit(); 87 pingPongService.ptr.quit();
(...skipping 25 matching lines...) Expand all
112 connection.provideService(PingPongServiceName, 113 connection.provideService(PingPongServiceName,
113 (endpoint) => new PingPongServiceImpl(this, endpoint)); 114 (endpoint) => new PingPongServiceImpl(this, endpoint));
114 } 115 }
115 } 116 }
116 117
117 main(List args) { 118 main(List args) {
118 MojoHandle appHandle = new MojoHandle(args[0]); 119 MojoHandle appHandle = new MojoHandle(args[0]);
119 String url = args[1]; 120 String url = args[1];
120 new PingPongApplication.fromHandle(appHandle); 121 new PingPongApplication.fromHandle(appHandle);
121 } 122 }
OLDNEW
« no previous file with comments | « services/dart/test/echo/main.dart ('k') | services/dart/test/pingpong_target/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698