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

Side by Side Diff: mojo/dart/apptests/dart_apptests/lib/src/echo_apptests.dart

Issue 1874553002: Dart: Fix bug in unbind() for Stubs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 8 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/echo/lib/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 library echo_apptests; 5 library echo_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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 "quit", milliseconds)).then((result) { 79 "quit", milliseconds)).then((result) {
80 fail('This future should not complete.'); 80 fail('This future should not complete.');
81 }, onError: (e) { 81 }, onError: (e) {
82 expect(e is ProxyError, isTrue); 82 expect(e is ProxyError, isTrue);
83 }); 83 });
84 84
85 return new Future.delayed( 85 return new Future.delayed(
86 new Duration(milliseconds: 10), () => echoProxy.close()); 86 new Duration(milliseconds: 10), () => echoProxy.close());
87 }); 87 });
88 88
89 test('Swap', () async {
90 var echoProxy =
91 new EchoServiceProxy.connectToService(application, "mojo:dart_echo");
92
93 for (int i = 0; i < 10; i++) {
94 var v =
95 await echoProxy.responseOrError(echoProxy.ptr.echoString("foo"));
96 expect(v.value, equals("foo"));
97 }
98
99 echoProxy.impl.errorFuture.then((e) {
100 fail("echoProxy: $e");
101 });
102
103 // Trigger an implementation swap in the echo server.
104 echoProxy.ptr.swap();
105
106 expect(echoProxy.impl.isBound, isTrue);
107
108 for (int i = 0; i < 10; i++) {
109 var v =
110 await echoProxy.responseOrError(echoProxy.ptr.echoString("foo"));
111 expect(v.value, equals("foo"));
112 }
113
114 var q = await echoProxy.responseOrError(echoProxy.ptr.echoString("quit"));
115 expect(q.value, equals("quit"));
116
117 await echoProxy.close();
118 });
119
89 test('Multiple Error Checks Success', () { 120 test('Multiple Error Checks Success', () {
90 var echoProxy = 121 var echoProxy =
91 new EchoServiceProxy.connectToService(application, "mojo:dart_echo"); 122 new EchoServiceProxy.connectToService(application, "mojo:dart_echo");
92 123
93 List<Future> futures = []; 124 List<Future> futures = [];
94 for (int i = 0; i < 100; i++) { 125 for (int i = 0; i < 100; i++) {
95 var f = echoProxy.responseOrError(echoProxy.ptr.echoString("foo")) 126 var f = echoProxy.responseOrError(echoProxy.ptr.echoString("foo"))
96 .then((r) { 127 .then((r) {
97 expect(r.value, equals("foo")); 128 expect(r.value, equals("foo"));
98 }, onError: (e) { 129 }, onError: (e) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 await echoProxy.close(); 309 await echoProxy.close();
279 310
280 r = await differentEchoProxy.responseOrError( 311 r = await differentEchoProxy.responseOrError(
281 differentEchoProxy.ptr.echoString("foo")); 312 differentEchoProxy.ptr.echoString("foo"));
282 expect(r.value, equals("foo")); 313 expect(r.value, equals("foo"));
283 314
284 await differentEchoProxy.close(); 315 await differentEchoProxy.close();
285 }); 316 });
286 }); 317 });
287 } 318 }
OLDNEW
« no previous file with comments | « no previous file | mojo/dart/apptests/test_apps/echo/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698