mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Note when --enable-vmservice
is required and skip otherwise. (#167579)
Our CI system runs with `--enable-vmservice`, but the default (i.e. for `flutter test`) does not. Closes https://github.com/flutter/flutter/issues/136079.
This commit is contained in:
parent
731d2d9e77
commit
b94e21b439
17
packages/integration_test/test/_requires_vm_service.dart
Normal file
17
packages/integration_test/test/_requires_vm_service.dart
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'dart:developer' as developer;
|
||||||
|
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
Future<bool> hasVmServiceEnabled() async {
|
||||||
|
final developer.ServiceProtocolInfo info = await developer.Service.getInfo();
|
||||||
|
final bool result = info.serverUri != null;
|
||||||
|
if (!result) {
|
||||||
|
// ignore: avoid_print
|
||||||
|
print('Run test suite with --enable-vmservice to enable this test.');
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
@ -7,6 +7,8 @@ import 'dart:io';
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
|
|
||||||
|
import '_requires_vm_service.dart';
|
||||||
|
|
||||||
class SocketExceptionHttpClient extends Fake implements HttpClient {
|
class SocketExceptionHttpClient extends Fake implements HttpClient {
|
||||||
@override
|
@override
|
||||||
Future<HttpClientRequest> openUrl(String method, Uri url) {
|
Future<HttpClientRequest> openUrl(String method, Uri url) {
|
||||||
@ -29,5 +31,5 @@ Future<void> main() async {
|
|||||||
fail('Did not expect a socket exception.');
|
fail('Did not expect a socket exception.');
|
||||||
}
|
}
|
||||||
expect(gotStateError, true);
|
expect(gotStateError, true);
|
||||||
});
|
}, skip: !(await hasVmServiceEnabled())); // [intended] avoid local failures
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user