Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Remove unnecessary work around from test in prep for vm_service migration #3209

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/android_alarm_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.5+16

* Remove unnecessary workaround from test.

## 0.4.5+15

* Update android compileSdkVersion to 29.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,14 @@ import 'dart:convert';
import 'dart:io';

import 'package:flutter_driver/flutter_driver.dart';
import 'package:vm_service_client/vm_service_client.dart';

Future<StreamSubscription<VMIsolateRef>> resumeIsolatesOnPause(
FlutterDriver driver) async {
final VM vm = await driver.serviceClient.getVM();
for (VMIsolateRef isolateRef in vm.isolates) {
final VMIsolate isolate = await isolateRef.load();
if (isolate.isPaused) {
await isolate.resume();
}
}
return driver.serviceClient.onIsolateRunnable
.asBroadcastStream()
.listen((VMIsolateRef isolateRef) async {
final VMIsolate isolate = await isolateRef.load();
if (isolate.isPaused) {
await isolate.resume();
}
});
}

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
// flutter drive causes isolates to be paused on spawn. The background isolate
// for this plugin will need to be resumed for the test to pass.
final StreamSubscription<VMIsolateRef> subscription =
await resumeIsolatesOnPause(driver);
final String data = await driver.requestData(
null,
timeout: const Duration(minutes: 1),
);
await driver.close();
await subscription.cancel();
final Map<String, dynamic> result = jsonDecode(data);
exit(result['result'] == 'true' ? 0 : 1);
}
2 changes: 1 addition & 1 deletion packages/android_alarm_manager/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for accessing the Android AlarmManager service, and
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.4.5+15
version: 0.4.5+16
homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager

dependencies:
Expand Down