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

Side by Side Diff: tests/isolate/deferred_in_isolate_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test that deferred libraries are supported from isolates other than the root 5 // Test that deferred libraries are supported from isolates other than the root
6 // isolate. 6 // isolate.
7 7
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 9
10 main() { 10 main() {
11 try { 11 try {
12 var receivePort = new RawReceivePort(); 12 var receivePort = new RawReceivePort();
13 var expectedMsg = "Deferred Loaded."; 13 var expectedMsg = "Deferred Loaded.";
14 14
15 receivePort.handler = (msg) { 15 receivePort.handler = (msg) {
16 if (msg != expectedMsg) { 16 if (msg != expectedMsg) {
17 print("Test failed."); 17 print("Test failed.");
18 throw msg; // Fail the test if the message is not expected. 18 throw msg; // Fail the test if the message is not expected.
19 } 19 }
20 print('Test done.'); 20 print('Test done.');
21 receivePort.close(); 21 receivePort.close();
22 }; 22 };
23 23
24 var stopwatch = new Stopwatch()..start(); 24 var stopwatch = new Stopwatch()..start();
25 Isolate.spawnUri(new Uri(path: 'deferred_in_isolate_app.dart'), 25 Isolate.spawnUri(new Uri(path: 'deferred_in_isolate_app.dart'),
26 [expectedMsg], 26 [expectedMsg], [receivePort.sendPort]).then((isolate) {
27 [receivePort.sendPort]).then((isolate) {
28 print('Isolate spawn: ${stopwatch.elapsedMilliseconds}ms'); 27 print('Isolate spawn: ${stopwatch.elapsedMilliseconds}ms');
29 }).catchError((error) { 28 }).catchError((error) {
30 print(error); 29 print(error);
31 }); 30 });
32 } catch (exception, stackTrace) { 31 } catch (exception, stackTrace) {
33 print('Test failed.'); 32 print('Test failed.');
34 print(exception); 33 print(exception);
35 print(stackTrace); 34 print(stackTrace);
36 rethrow; 35 rethrow;
37 } 36 }
38 } 37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698