OLD | NEW |
1 #library('ExceptionsTest'); | 1 #library('ExceptionsTest'); |
2 #import('../../../testing/unittest/unittest.dart'); | 2 #import('../../../testing/unittest/unittest_dom.dart'); |
3 #import('dart:dom'); | 3 #import('dart:dom'); |
4 | 4 |
5 main() { | 5 main() { |
6 forLayoutTests(); | 6 forLayoutTests(); |
7 test('DOMException', () { | 7 test('DOMException', () { |
8 try { | 8 try { |
9 window.webkitNotifications.createNotification('', '', ''); | 9 window.webkitNotifications.createNotification('', '', ''); |
10 } catch (DOMException e) { | 10 } catch (DOMException e) { |
11 Expect.equals(DOMException.SECURITY_ERR, e.code); | 11 Expect.equals(DOMException.SECURITY_ERR, e.code); |
12 Expect.equals('SECURITY_ERR', e.name); | 12 Expect.equals('SECURITY_ERR', e.name); |
13 Expect.equals('SECURITY_ERR: DOM Exception 18', e.message); | 13 Expect.equals('SECURITY_ERR: DOM Exception 18', e.message); |
14 } | 14 } |
15 }); | 15 }); |
16 test('EventException', () { | 16 test('EventException', () { |
17 final event = window.document.createEvent('Event'); | 17 final event = window.document.createEvent('Event'); |
18 // Intentionally do not initialize it! | 18 // Intentionally do not initialize it! |
19 try { | 19 try { |
20 window.document.dispatchEvent(event); | 20 window.document.dispatchEvent(event); |
21 } catch (EventException e) { | 21 } catch (EventException e) { |
22 Expect.equals(EventException.UNSPECIFIED_EVENT_TYPE_ERR, e.code); | 22 Expect.equals(EventException.UNSPECIFIED_EVENT_TYPE_ERR, e.code); |
23 Expect.equals('UNSPECIFIED_EVENT_TYPE_ERR', e.name); | 23 Expect.equals('UNSPECIFIED_EVENT_TYPE_ERR', e.name); |
24 Expect.equals('UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0', e.mess
age); | 24 Expect.equals('UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0', e.mess
age); |
25 } | 25 } |
26 }); | 26 }); |
27 } | 27 } |
OLD | NEW |