OLD | NEW |
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 library WindowNSMETest; | 5 library WindowNSMETest; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
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 import 'dart:html' as dom; | 10 import 'dart:html' as dom; |
(...skipping 23 matching lines...) Expand all Loading... |
34 expect(false, isTrue, reason: 'Wrong exception: $e'); | 34 expect(false, isTrue, reason: 'Wrong exception: $e'); |
35 } | 35 } |
36 }); | 36 }); |
37 | 37 |
38 test('foo', () { | 38 test('foo', () { |
39 var win = things[inscrutable(0)]; | 39 var win = things[inscrutable(0)]; |
40 String x = win.foo('bar'); | 40 String x = win.foo('bar'); |
41 expect(x, 'not bar'); | 41 expect(x, 'not bar'); |
42 }); | 42 }); |
43 | 43 |
44 // Use dom.window direclty in case the compiler does type inference. | 44 // Use dom.window directly in case the compiler does type inference. |
45 test('windowNonMethod2', () { | 45 test('windowNonMethod2', () { |
46 final message = foo("Hello World"); | 46 final message = foo("Hello World"); |
47 try { | 47 try { |
48 String x = dom.window.foo(message); | 48 String x = dom.window.foo(message); |
49 expect(false, isTrue, reason: 'Should not reach here: $x'); | 49 expect(false, isTrue, reason: 'Should not reach here: $x'); |
50 } on NoSuchMethodError catch (e) { | 50 } on NoSuchMethodError catch (e) { |
51 // Expected exception. | 51 // Expected exception. |
52 } on Exception catch (e) { | 52 } on Exception catch (e) { |
53 expect(false, isTrue, reason: 'Wrong exception: $e'); | 53 expect(false, isTrue, reason: 'Wrong exception: $e'); |
54 } | 54 } |
55 }); | 55 }); |
56 } | 56 } |
OLD | NEW |