@@ -12,7 +12,8 @@ void main() {
12
12
String invalidCallback (String foo) => foo;
13
13
void validCallback (int id) => null ;
14
14
15
- const testChannel = MethodChannel ('plugins.flutter.io/android_alarm_manager' , JSONMethodCodec ());
15
+ const testChannel = MethodChannel (
16
+ 'plugins.flutter.io/android_alarm_manager' , JSONMethodCodec ());
16
17
TestWidgetsFlutterBinding .ensureInitialized ();
17
18
18
19
setUpAll (() {
@@ -36,17 +37,24 @@ void main() {
36
37
final validId = 1 ;
37
38
38
39
// Callback should take a single int param.
39
- await expectLater (() => AndroidAlarmManager .oneShotAt (validTime, validId, invalidCallback), throwsAssertionError);
40
+ await expectLater (
41
+ () => AndroidAlarmManager .oneShotAt (
42
+ validTime, validId, invalidCallback),
43
+ throwsAssertionError);
40
44
41
45
// ID should be less than 32 bits.
42
46
await expectLater (
43
- () => AndroidAlarmManager .oneShotAt (validTime, 2147483648 , validCallback), throwsAssertionError);
47
+ () => AndroidAlarmManager .oneShotAt (
48
+ validTime, 2147483648 , validCallback),
49
+ throwsAssertionError);
44
50
});
45
51
46
52
test ('sends arguments to the platform' , () async {
47
53
final alarm = DateTime (1993 );
48
54
const rawHandle = 4 ;
49
- AndroidAlarmManager .setTestOverides (getCallbackHandle: (Function _) => CallbackHandle .fromRawHandle (rawHandle));
55
+ AndroidAlarmManager .setTestOverides (
56
+ getCallbackHandle: (Function _) =>
57
+ CallbackHandle .fromRawHandle (rawHandle));
50
58
51
59
final id = 1 ;
52
60
final alarmClock = true ;
@@ -68,7 +76,8 @@ void main() {
68
76
return true ;
69
77
});
70
78
71
- final result = await AndroidAlarmManager .oneShotAt (alarm, id, validCallback,
79
+ final result = await AndroidAlarmManager .oneShotAt (
80
+ alarm, id, validCallback,
72
81
alarmClock: alarmClock,
73
82
allowWhileIdle: allowWhileIdle,
74
83
exact: exact,
@@ -83,7 +92,9 @@ void main() {
83
92
final now = DateTime (1993 );
84
93
const rawHandle = 4 ;
85
94
AndroidAlarmManager .setTestOverides (
86
- now: () => now, getCallbackHandle: (Function _) => CallbackHandle .fromRawHandle (rawHandle));
95
+ now: () => now,
96
+ getCallbackHandle: (Function _) =>
97
+ CallbackHandle .fromRawHandle (rawHandle));
87
98
88
99
const alarm = Duration (seconds: 1 );
89
100
final id = 1 ;
@@ -100,7 +111,8 @@ void main() {
100
111
expect (call.arguments[2 ], allowWhileIdle);
101
112
expect (call.arguments[3 ], exact);
102
113
expect (call.arguments[4 ], wakeup);
103
- expect (call.arguments[5 ], now.millisecondsSinceEpoch + alarm.inMilliseconds);
114
+ expect (
115
+ call.arguments[5 ], now.millisecondsSinceEpoch + alarm.inMilliseconds);
104
116
expect (call.arguments[6 ], rescheduleOnReboot);
105
117
expect (call.arguments[7 ], rawHandle);
106
118
return true ;
@@ -123,18 +135,24 @@ void main() {
123
135
124
136
// Callback should take a single int param.
125
137
await expectLater (
126
- () => AndroidAlarmManager .periodic (validDuration, validId, invalidCallback), throwsAssertionError);
138
+ () => AndroidAlarmManager .periodic (
139
+ validDuration, validId, invalidCallback),
140
+ throwsAssertionError);
127
141
128
142
// ID should be less than 32 bits.
129
143
await expectLater (
130
- () => AndroidAlarmManager .periodic (validDuration, 2147483648 , validCallback), throwsAssertionError);
144
+ () => AndroidAlarmManager .periodic (
145
+ validDuration, 2147483648 , validCallback),
146
+ throwsAssertionError);
131
147
});
132
148
133
149
test ('sends arguments through to the platform' , () async {
134
150
final now = DateTime (1993 );
135
151
const rawHandle = 4 ;
136
152
AndroidAlarmManager .setTestOverides (
137
- now: () => now, getCallbackHandle: (Function _) => CallbackHandle .fromRawHandle (rawHandle));
153
+ now: () => now,
154
+ getCallbackHandle: (Function _) =>
155
+ CallbackHandle .fromRawHandle (rawHandle));
138
156
139
157
final id = 1 ;
140
158
final exact = true ;
@@ -147,7 +165,8 @@ void main() {
147
165
expect (call.arguments[0 ], id);
148
166
expect (call.arguments[1 ], exact);
149
167
expect (call.arguments[2 ], wakeup);
150
- expect (call.arguments[3 ], (now.millisecondsSinceEpoch + period.inMilliseconds));
168
+ expect (call.arguments[3 ],
169
+ (now.millisecondsSinceEpoch + period.inMilliseconds));
151
170
expect (call.arguments[4 ], period.inMilliseconds);
152
171
expect (call.arguments[5 ], rescheduleOnReboot);
153
172
expect (call.arguments[6 ], rawHandle);
0 commit comments