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

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

Issue 306523002: Tweak isolate/spawn_uri_missing*test.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « dart/tests/isolate/spawn_uri_missing_from_isolate_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// Tests that Isolate.spanUri completes with an error when the given URI 5 /// Tests that Isolate.spanUri completes with an error when the given URI
6 /// doesn't resolve to an existing resource. 6 /// doesn't resolve to an existing resource.
7 library test.isolate.spawn_uri_missing_test; 7 library test.isolate.spawn_uri_missing_test;
8 8
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 10
11 import 'dart:async'; 11 import 'dart:async';
12 12
13 import 'package:async_helper/async_helper.dart'; 13 import 'package:async_helper/async_helper.dart';
14 14
15 const UNEXPECTED_MESSAGE = 'Created isolate from missing file.';
16
15 Future doTest() { 17 Future doTest() {
16 return Isolate.spawnUri(Uri.base.resolve('no_such_file'), [], null) 18 return Isolate.spawnUri(Uri.base.resolve('no_such_file'), [], null)
17 .then((Isolate isolate) { 19 .then((Isolate isolate) {
18 throw 'Created isolate from missing file'; 20 throw UNEXPECTED_MESSAGE;
19 }).catchError((error) { 21 }).catchError((error) {
22 if (error == UNEXPECTED_MESSAGE) throw error;
20 print('An error was thrown as expected'); 23 print('An error was thrown as expected');
21 return null; 24 return null;
22 }); 25 });
Lasse Reichstein Nielsen 2014/05/27 12:09:15 This seem overly complicated. Try this: return
ahe 2014/05/27 13:31:27 We talked about this, and I was surprised that it
23 } 26 }
24 27
25 main() { 28 main() {
26 asyncTest(doTest); 29 asyncTest(doTest);
27 } 30 }
OLDNEW
« no previous file with comments | « dart/tests/isolate/spawn_uri_missing_from_isolate_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698