-
-
Notifications
You must be signed in to change notification settings - Fork 947
Expand file tree
/
Copy pathpermission_handler_default_test.dart
More file actions
43 lines (36 loc) · 1.32 KB
/
permission_handler_default_test.dart
File metadata and controls
43 lines (36 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import 'package:flutter_test/flutter_test.dart';
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
import 'package:permission_handler_default/permission_handler_default.dart';
void main() {
final List<Permission> testPermissions = [
Permission.camera,
Permission.contacts,
Permission.location,
Permission.microphone,
Permission.notification,
];
final plugin = DefaultPermissionHandler();
test('check permissions are all granted', () async {
final permissions = await plugin.requestPermissions(testPermissions);
for (final status in permissions.values) {
expect(status, PermissionStatus.granted);
}
});
test('check services are all enabled.', () async {
for (final permission in testPermissions) {
final serviceStatus = await plugin.checkServiceStatus(permission);
expect(serviceStatus, ServiceStatus.enabled);
}
});
test('never show unsupported permission rational.', () async {
for (final permission in testPermissions) {
final shouldIt =
await plugin.shouldShowRequestPermissionRationale(permission);
expect(shouldIt, false);
}
});
test('never show unsupported app settings.', () async {
final appSettings = await plugin.openAppSettings();
expect(appSettings, false);
});
}