waitForExecutionRequest method
Returns when the native side requests execution of a Dart test. If the
native side requsted execution of dartTest
, returns true. Otherwise
returns false.
It's used inside of patrolTest to halt execution of test body until runDartTest is called.
The native side requests execution by RPC-ing runDartTest and providing
name of a Dart test that it wants to currently execute dartTest
.
Implementation
Future<bool> waitForExecutionRequest(String dartTest) async {
print('PatrolAppService: registered "$dartTest"');
final requestedDartTest = await testExecutionRequested;
if (requestedDartTest != dartTest) {
// If the requested Dart test is not the one we're waiting for now, it
// means that dartTest was already executed. Return false so that callers
// can skip the already executed test.
print(
'PatrolAppService: registered test "$dartTest" was not matched by requested test "$requestedDartTest"',
);
return false;
}
print('PatrolAppService: requested execution of test "$dartTest"');
return true;
}