Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 library ExceptionsTest; | 1 library ExceptionsTest; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_individual_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 | 5 |
| 6 main() { | 6 main() { |
| 7 useHtmlConfiguration(); | 7 useHtmlIndividualConfiguration(); |
| 8 test('DomException', () { | 8 |
| 9 try { | 9 group('supported', () { |
| 10 window.webkitNotifications.createNotification('', '', ''); | 10 test('supported', () { |
| 11 } on DomException catch (e) { | 11 expect(NotificationCenter.supported, true); |
|
blois
2013/01/15 01:31:56
This should probably go in a separate notification
Emily Fortuna
2013/01/15 02:21:06
Done.
| |
| 12 expect(e.code, DomException.SECURITY_ERR); | 12 }); |
| 13 expect(e.name, 'SecurityError'); | |
| 14 expect(e.message, 'SecurityError: DOM Exception 18'); | |
| 15 } | |
| 16 }); | 13 }); |
| 17 test('EventException', () { | 14 |
| 18 final event = new Event('Event'); | 15 group('webkitNotifications', () { |
| 19 // Intentionally do not initialize it! | 16 if (NotificationCenter.supported) { |
| 20 try { | 17 test('DomException', () { |
| 21 document.$dom_dispatchEvent(event); | 18 try { |
| 22 } on EventException catch (e) { | 19 window.notifications.createNotification('', '', ''); |
| 23 expect(e.code, EventException.UNSPECIFIED_EVENT_TYPE_ERR); | 20 } on DomException catch (e) { |
| 24 expect(e.name, 'UNSPECIFIED_EVENT_TYPE_ERR'); | 21 expect(e.code, DomException.SECURITY_ERR); |
| 25 expect(e.message, 'UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0'); | 22 expect(e.name, 'SecurityError'); |
| 23 expect(e.message, 'SecurityError: DOM Exception 18'); | |
| 24 } | |
| 25 }); | |
| 26 test('EventException', () { | |
|
blois
2013/01/15 01:31:56
seems like this test should not be included in the
Emily Fortuna
2013/01/15 02:21:06
Done.
| |
| 27 final event = new Event('Event'); | |
| 28 // Intentionally do not initialize it! | |
| 29 try { | |
| 30 document.$dom_dispatchEvent(event); | |
| 31 } on EventException catch (e) { | |
| 32 expect(e.code, EventException.UNSPECIFIED_EVENT_TYPE_ERR); | |
| 33 expect(e.name, 'UNSPECIFIED_EVENT_TYPE_ERR'); | |
| 34 expect(e.message, | |
| 35 'UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0'); | |
| 36 } | |
| 37 }); | |
| 26 } | 38 } |
| 27 }); | 39 }); |
| 28 } | 40 } |
| OLD | NEW |