Chromium Code Reviews| Index: tests/html/notifications_test.dart |
| diff --git a/tests/html/notifications_test.dart b/tests/html/notifications_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cf6ba4f6eaf303f00186d683d75e5af90bf47cc5 |
| --- /dev/null |
| +++ b/tests/html/notifications_test.dart |
| @@ -0,0 +1,36 @@ |
| +library NotificationsTest; |
| +import '../../pkg/unittest/lib/unittest.dart'; |
| +import '../../pkg/unittest/lib/html_individual_config.dart'; |
| +import 'dart:html'; |
| + |
| +main() { |
| + useHtmlIndividualConfiguration(); |
| + |
| + group('supported', () { |
| + test('supported', () { |
| + expect(NotificationCenter.supported, true); |
| + }); |
| + }); |
| + |
| + group('unsupported throws', () { |
| + test('createNotification', () { |
| + var expectation = NotificationCenter.supported ? returnsNormally : throws; |
| + expect(() { window.notifications.createNotification; }, expectation); |
| + }); |
| + }); |
| + |
| + group('webkitNotifications', () { |
| + if (NotificationCenter.supported) { |
| + test('DomException', () { |
| + try { |
| + window.notifications.createNotification('', '', ''); |
| + } on DomException catch (e) { |
| + expect(e.code, DomException.SECURITY_ERR); |
|
blois
2013/01/15 18:20:57
My understanding is that e.code is deprecated and
|
| + expect(e.name, 'SecurityError'); |
| + expect(e.message, 'SecurityError: DOM Exception 18'); |
|
blois
2013/01/15 18:20:57
I believe that message may be localized. Not sure
|
| + } |
| + }); |
| + } |
| + }); |
| +} |
| + |