Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
permission_handler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songyanzhi
permission_handler
Commits
84059290
Commit
84059290
authored
Mar 16, 2021
by
Jan-Derk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests
parent
5af10275
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
permission_handler/test/permission_handler_test.dart
+14
-16
No files found.
permission_handler/test/permission_handler_test.dart
View file @
84059290
...
@@ -5,7 +5,7 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart';
...
@@ -5,7 +5,7 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
void
main
(
)
{
void
main
(
)
{
group
(
'PermissionHandler'
,
(){
group
(
'PermissionHandler'
,
()
{
setUp
(()
{
setUp
(()
{
PermissionHandlerPlatform
.
instance
=
MockPermissionHandlerPlatform
();
PermissionHandlerPlatform
.
instance
=
MockPermissionHandlerPlatform
();
});
});
...
@@ -17,9 +17,9 @@ void main() {
...
@@ -17,9 +17,9 @@ void main() {
});
});
test
(
'PermissionActions on Permission: get shouldShowRequestRationale'
,
test
(
'PermissionActions on Permission: get shouldShowRequestRationale'
,
()
async
{
()
async
{
final
requestRationale
=
final
requestRationale
=
await
Permission
.
calendar
.
shouldShowRequestRationale
;
await
Permission
.
calendar
.
shouldShowRequestRationale
;
expect
(
requestRationale
,
false
);
expect
(
requestRationale
,
false
);
});
});
...
@@ -45,29 +45,27 @@ void main() {
...
@@ -45,29 +45,27 @@ void main() {
expect
(
isRestricted
,
false
);
expect
(
isRestricted
,
false
);
});
});
test
(
'PermissionCheckShortcuts on Permission: get isPermanentlyDenied'
,
()
async
{
test
(
'PermissionCheckShortcuts on Permission: get isPermanentlyDenied'
,
()
async
{
final
isPermanentlyDenied
=
await
Permission
.
calendar
.
isPermanentlyDenied
;
final
isPermanentlyDenied
=
await
Permission
.
calendar
.
isPermanentlyDenied
;
expect
(
isPermanentlyDenied
,
false
);
expect
(
isPermanentlyDenied
,
false
);
});
});
test
(
'ServicePermissionActions on PermissionWithService: get serviceStatus'
,
()
async
{
test
(
'ServicePermissionActions on PermissionWithService: get serviceStatus'
,
()
async
{
//TODO: Implement
//TODO: Implement
});
});
});
});
}
}
class
MockPermissionHandlerPlatform
extends
Mock
class
MockPermissionHandlerPlatform
extends
Mock
with
// ignore: prefer_mixin
MockPlatformInterfaceMixin
with
MockPlatformInterfaceMixin
implements
implements
PermissionHandlerPlatform
{
PermissionHandlerPlatform
{
@override
@override
Future
<
PermissionStatus
>
checkPermissionStatus
(
Permission
permission
)
=>
Future
<
PermissionStatus
>
checkPermissionStatus
(
Permission
permission
)
=>
Future
.
value
(
PermissionStatus
.
granted
);
Future
.
value
(
PermissionStatus
.
granted
);
@override
@override
Future
<
ServiceStatus
>
checkServiceStatus
(
Permission
permission
)
=>
Future
<
ServiceStatus
>
checkServiceStatus
(
Permission
permission
)
=>
Future
.
value
(
ServiceStatus
.
enabled
);
Future
.
value
(
ServiceStatus
.
enabled
);
...
@@ -76,12 +74,13 @@ class MockPermissionHandlerPlatform extends Mock
...
@@ -76,12 +74,13 @@ class MockPermissionHandlerPlatform extends Mock
Future
<
bool
>
openAppSettings
()
=>
Future
.
value
(
true
);
Future
<
bool
>
openAppSettings
()
=>
Future
.
value
(
true
);
@override
@override
Future
<
Map
<
Permission
,
PermissionStatus
>>
requestPermissions
(
List
<
Permission
>
permissions
)
{
Future
<
Map
<
Permission
,
PermissionStatus
>>
requestPermissions
(
Map
<
Permission
,
PermissionStatus
>
permissionsMap
=
{};
List
<
Permission
>
permissions
)
{
var
permissionsMap
=
<
Permission
,
PermissionStatus
>{};
return
Future
.
value
(
permissionsMap
);
return
Future
.
value
(
permissionsMap
);
}
}
@override
@override
Future
<
bool
>
shouldShowRequestPermissionRationale
(
Permission
permission
)
=>
Future
<
bool
>
shouldShowRequestPermissionRationale
(
Permission
permission
)
=>
Future
.
value
(
true
);
Future
.
value
(
true
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment