Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 library NotificationsTest; | |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | |
| 3 import '../../pkg/unittest/lib/html_individual_config.dart'; | |
| 4 import 'dart:html'; | |
| 5 | |
| 6 main() { | |
| 7 useHtmlIndividualConfiguration(); | |
| 8 | |
| 9 group('supported', () { | |
| 10 test('supported', () { | |
| 11 expect(NotificationCenter.supported, true); | |
| 12 }); | |
| 13 }); | |
| 14 | |
| 15 group('unsupported throws', () { | |
| 16 test('createNotification', () { | |
| 17 var expectation = NotificationCenter.supported ? returnsNormally : throws; | |
| 18 expect(() { window.notifications.createNotification; }, expectation); | |
| 19 }); | |
| 20 }); | |
| 21 | |
| 22 group('webkitNotifications', () { | |
| 23 if (NotificationCenter.supported) { | |
| 24 test('DomException', () { | |
| 25 try { | |
| 26 window.notifications.createNotification('', '', ''); | |
| 27 } on DomException catch (e) { | |
| 28 expect(e.code, DomException.SECURITY_ERR); | |
|
blois
2013/01/15 18:20:57
My understanding is that e.code is deprecated and
| |
| 29 expect(e.name, 'SecurityError'); | |
| 30 expect(e.message, 'SecurityError: DOM Exception 18'); | |
|
blois
2013/01/15 18:20:57
I believe that message may be localized. Not sure
| |
| 31 } | |
| 32 }); | |
| 33 } | |
| 34 }); | |
| 35 } | |
| 36 | |
| OLD | NEW |