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

Side by Side Diff: tests/html/worker_api_test.dart

Issue 218273002: Upgrading tests with unittest deprecations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 7
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'package:unittest/html_config.dart'; 9 import 'package:unittest/html_config.dart';
10 10
11 worker(message) { 11 worker(message) {
12 var uri = message[0]; 12 var uri = message[0];
13 var replyTo = message[1]; 13 var replyTo = message[1];
14 try { 14 try {
15 var url = Url.createObjectUrl(new Blob([''], 'application/javascript')); 15 var url = Url.createObjectUrl(new Blob([''], 'application/javascript'));
16 Url.revokeObjectUrl(url); 16 Url.revokeObjectUrl(url);
17 replyTo.send('Hello from Worker'); 17 replyTo.send('Hello from Worker');
18 } catch (e) { 18 } catch (e) {
19 replyTo.send('Error: $e'); 19 replyTo.send('Error: $e');
20 } 20 }
21 } 21 }
22 22
23 main() { 23 main() {
24 useHtmlConfiguration(); 24 useHtmlConfiguration();
25 25
26 test('Use Worker API in Worker', () { 26 test('Use Worker API in Worker', () {
27 var response = new ReceivePort(); 27 var response = new ReceivePort();
28 var remote = Isolate.spawn(worker, ['', response.sendPort]); 28 var remote = Isolate.spawn(worker, ['', response.sendPort]);
29 remote.then((_) => response.first) 29 remote.then((_) => response.first)
30 .then(expectAsync1((reply) => expect(reply, equals('Hello from Worker')) )); 30 .then(expectAsync((reply) => expect(reply, equals('Hello from Worker'))) );
Siggi Cherem (dart-lang) 2014/03/31 17:13:34 I know it was there before, but since you are here
31 }); 31 });
32 } 32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698