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

Side by Side Diff: dart/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart

Issue 23523003: Address a number of issues related to computation of currentScript and deferred loading. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add tests Created 7 years, 3 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "package:expect/expect.dart"; 5 import '../../../async_helper.dart';
6
7 import 'package:expect/expect.dart';
8
6 import 'dart:async'; 9 import 'dart:async';
7 10
8 @lazy import 'deferred_class_library.dart'; 11 @lazy import 'deferred_class_library.dart';
9 12
10 const lazy = const DeferredLibrary('deferred_class_library'); 13 const lazy = const DeferredLibrary('deferred_class_library');
11 14
12 isNoSuchMethodError(e) => e is NoSuchMethodError; 15 isNoSuchMethodError(e) => e is NoSuchMethodError;
13 16
14 main() { 17 main() {
15 var x; 18 var x;
16 Expect.throws(() { x = new MyClass(); }, isNoSuchMethodError); 19 Expect.throws(() { x = new MyClass(); }, isNoSuchMethodError);
17 Expect.isNull(x); 20 Expect.isNull(x);
18 int counter = 0; 21 int counter = 0;
22 asyncStart();
19 lazy.load().then((bool didLoad) { 23 lazy.load().then((bool didLoad) {
20 Expect.isTrue(didLoad); 24 Expect.isTrue(didLoad);
21 Expect.equals(1, ++counter); 25 Expect.equals(1, ++counter);
22 print('deferred_class_library was loaded'); 26 print('deferred_class_library was loaded');
23 x = new MyClass(); 27 x = new MyClass();
24 Expect.equals(42, x.foo(87)); 28 Expect.equals(42, x.foo(87));
29 asyncEnd();
25 }); 30 });
26 Expect.equals(0, counter); 31 Expect.equals(0, counter);
27 Expect.isNull(x); 32 Expect.isNull(x);
33 asyncStart();
28 lazy.load().then((bool didLoad) { 34 lazy.load().then((bool didLoad) {
29 Expect.isFalse(didLoad); 35 Expect.isFalse(didLoad);
30 Expect.equals(2, ++counter); 36 Expect.equals(2, ++counter);
31 print('deferred_class_library was loaded'); 37 print('deferred_class_library was loaded');
32 x = new MyClass(); 38 x = new MyClass();
33 Expect.equals(42, x.foo(87)); 39 Expect.equals(42, x.foo(87));
40 asyncEnd();
34 }); 41 });
35 Expect.equals(0, counter); 42 Expect.equals(0, counter);
36 Expect.isNull(x); 43 Expect.isNull(x);
37 Expect.throws(() { x = new MyClass(); }, isNoSuchMethodError); 44 Expect.throws(() { x = new MyClass(); }, isNoSuchMethodError);
38 Expect.isNull(x); 45 Expect.isNull(x);
39 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698