[frdp] Add configurable timeouts for VM. (#22893)
This adds configurable timeouts for the Dart VM. Due to some testing machines running things quite slowly, this is becoming more necessary.
This commit is contained in:
@@ -17,7 +17,10 @@ void main() {
|
||||
});
|
||||
|
||||
test('null connector', () async {
|
||||
Future<json_rpc.Peer> mockServiceFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockServiceFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
return Future<json_rpc.Peer>(() => null);
|
||||
}
|
||||
|
||||
@@ -28,7 +31,10 @@ void main() {
|
||||
|
||||
test('disconnect closes peer', () async {
|
||||
final MockPeer peer = MockPeer();
|
||||
Future<json_rpc.Peer> mockServiceFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockServiceFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
return Future<json_rpc.Peer>(() => peer);
|
||||
}
|
||||
|
||||
@@ -84,7 +90,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(() => flutterViewCannedResponses));
|
||||
return Future<json_rpc.Peer>(() => mockPeer);
|
||||
@@ -139,7 +148,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(() => flutterViewCannedResponses));
|
||||
return Future<json_rpc.Peer>(() => mockPeer);
|
||||
@@ -186,7 +198,10 @@ void main() {
|
||||
]
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(
|
||||
() => flutterViewCannedResponseMissingId));
|
||||
@@ -239,7 +254,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer(
|
||||
(_) => Future<Map<String, dynamic>>(() => vmCannedResponse));
|
||||
return Future<json_rpc.Peer>(() => mockPeer);
|
||||
@@ -278,7 +296,10 @@ void main() {
|
||||
],
|
||||
};
|
||||
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
when(mockPeer.sendRequest(any, any)).thenAnswer((_) =>
|
||||
Future<Map<String, dynamic>>(
|
||||
() => flutterViewCannedResponseMissingIsolateName));
|
||||
@@ -311,7 +332,10 @@ void main() {
|
||||
|
||||
test('verify timeout fires', () async {
|
||||
const Duration timeoutTime = Duration(milliseconds: 100);
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(Uri uri) {
|
||||
Future<json_rpc.Peer> mockVmConnectionFunction(
|
||||
Uri uri, {
|
||||
Duration timeout,
|
||||
}) {
|
||||
// Return a command that will never complete.
|
||||
when(mockPeer.sendRequest(any, any))
|
||||
.thenAnswer((_) => Completer<Map<String, dynamic>>().future);
|
||||
|
||||
Reference in New Issue
Block a user