mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Remove dead code in tools tests (#104567)
This commit is contained in:
parent
7a2b187c7b
commit
3fa355c97d
@ -5,7 +5,6 @@
|
||||
// @dart = 2.8
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/android/android_device.dart';
|
||||
@ -36,28 +35,8 @@ import 'package:vm_service/vm_service.dart' as vm_service;
|
||||
import '../../src/common.dart';
|
||||
import '../../src/context.dart';
|
||||
import '../../src/fake_devices.dart';
|
||||
import '../../src/fake_vm_services.dart';
|
||||
import '../../src/test_flutter_command_runner.dart';
|
||||
|
||||
final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate(
|
||||
id: '1',
|
||||
pauseEvent: vm_service.Event(
|
||||
kind: vm_service.EventKind.kResume,
|
||||
timestamp: 0
|
||||
),
|
||||
breakpoints: <vm_service.Breakpoint>[],
|
||||
exceptionPauseMode: null,
|
||||
isolateFlags: <vm_service.IsolateFlag>[],
|
||||
libraries: <vm_service.LibraryRef>[],
|
||||
livePorts: 0,
|
||||
name: 'test',
|
||||
number: '1',
|
||||
pauseOnExit: false,
|
||||
runnable: true,
|
||||
startTime: 0,
|
||||
isSystemIsolate: false,
|
||||
);
|
||||
|
||||
void main() {
|
||||
tearDown(() {
|
||||
MacOSDesignedForIPadDevices.allowDiscovery = false;
|
||||
@ -688,108 +667,6 @@ Future<void> expectLoggerInterruptEndsTask(Future<void> task, StreamLogger logge
|
||||
);
|
||||
}
|
||||
|
||||
VMServiceConnector getFakeVmServiceFactory({
|
||||
@required Completer<void> vmServiceDoneCompleter,
|
||||
}) {
|
||||
assert(vmServiceDoneCompleter != null);
|
||||
|
||||
return (
|
||||
Uri httpUri, {
|
||||
ReloadSources reloadSources,
|
||||
Restart restart,
|
||||
CompileExpression compileExpression,
|
||||
GetSkSLMethod getSkSLMethod,
|
||||
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
|
||||
CompressionOptions compression,
|
||||
Device device,
|
||||
Logger logger,
|
||||
}) async {
|
||||
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
|
||||
requests: <VmServiceExpectation>[
|
||||
FakeVmServiceRequest(
|
||||
method: kListViewsMethod,
|
||||
args: null,
|
||||
jsonResponse: <String, Object>{
|
||||
'views': <Object>[
|
||||
<String, Object>{
|
||||
'id': '1',
|
||||
'isolate': fakeUnpausedIsolate.toJson(),
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
FakeVmServiceRequest(
|
||||
method: 'getVM',
|
||||
args: null,
|
||||
jsonResponse: vm_service.VM.parse(<String, Object>{})
|
||||
.toJson(),
|
||||
),
|
||||
FakeVmServiceRequest(
|
||||
method: '_createDevFS',
|
||||
args: <String, Object>{
|
||||
'fsName': globals.fs.currentDirectory.absolute.path,
|
||||
},
|
||||
jsonResponse: <String, Object>{
|
||||
'uri': globals.fs.currentDirectory.absolute.path,
|
||||
},
|
||||
),
|
||||
FakeVmServiceRequest(
|
||||
method: kListViewsMethod,
|
||||
args: null,
|
||||
jsonResponse: <String, Object>{
|
||||
'views': <Object>[
|
||||
<String, Object>{
|
||||
'id': '1',
|
||||
'isolate': fakeUnpausedIsolate.toJson(),
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
return fakeVmServiceHost.vmService;
|
||||
};
|
||||
}
|
||||
|
||||
class TestHotRunnerFactory extends HotRunnerFactory {
|
||||
HotRunner _runner;
|
||||
|
||||
@override
|
||||
HotRunner build(
|
||||
List<FlutterDevice> devices, {
|
||||
String target,
|
||||
DebuggingOptions debuggingOptions,
|
||||
bool benchmarkMode = false,
|
||||
File applicationBinary,
|
||||
bool hostIsIde = false,
|
||||
String projectRootPath,
|
||||
String packagesFilePath,
|
||||
String dillOutputPath,
|
||||
bool stayResident = true,
|
||||
bool ipv6 = false,
|
||||
FlutterProject flutterProject,
|
||||
}) {
|
||||
_runner ??= HotRunner(
|
||||
devices,
|
||||
target: target,
|
||||
debuggingOptions: debuggingOptions,
|
||||
benchmarkMode: benchmarkMode,
|
||||
applicationBinary: applicationBinary,
|
||||
hostIsIde: hostIsIde,
|
||||
projectRootPath: projectRootPath,
|
||||
dillOutputPath: dillOutputPath,
|
||||
stayResident: stayResident,
|
||||
ipv6: ipv6,
|
||||
);
|
||||
return _runner;
|
||||
}
|
||||
|
||||
Future<void> exitApp() async {
|
||||
assert(_runner != null);
|
||||
await _runner.exit();
|
||||
}
|
||||
}
|
||||
|
||||
class FakeDartDevelopmentService extends Fake implements DartDevelopmentService {
|
||||
@override
|
||||
Future<void> get done => noopCompleter.future;
|
||||
|
@ -163,13 +163,6 @@ const String defaultConfigLinux2 = r'''
|
||||
}
|
||||
''';
|
||||
|
||||
final Platform linuxPlatform = FakePlatform(
|
||||
environment: <String, String>{
|
||||
'FLUTTER_ROOT': linuxFlutterRoot,
|
||||
'HOME': '/',
|
||||
}
|
||||
);
|
||||
|
||||
final Platform windowsPlatform = FakePlatform(
|
||||
operatingSystem: 'windows',
|
||||
environment: <String, String>{
|
||||
|
@ -19,7 +19,6 @@ import 'package:flutter_tools/src/android/android_studio_validator.dart';
|
||||
import 'package:flutter_tools/src/android/android_workflow.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/base/terminal.dart';
|
||||
import 'package:flutter_tools/src/base/user_messages.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
@ -42,11 +41,6 @@ import '../../src/context.dart';
|
||||
import '../../src/fakes.dart';
|
||||
import '../../src/test_flutter_command_runner.dart';
|
||||
|
||||
final Platform macPlatform = FakePlatform(
|
||||
operatingSystem: 'macos',
|
||||
environment: <String, String>{'HOME': '/foo/bar'}
|
||||
);
|
||||
|
||||
void main() {
|
||||
FakeFlutterVersion flutterVersion;
|
||||
BufferLogger logger;
|
||||
|
@ -801,14 +801,6 @@ class FakeAndroidSdk extends Fake implements AndroidSdk {
|
||||
String get adbPath => 'adb';
|
||||
}
|
||||
|
||||
class TestRunCommand extends RunCommand {
|
||||
@override
|
||||
// ignore: must_call_super
|
||||
Future<void> validateCommand() async {
|
||||
devices = await globals.deviceManager.getDevices();
|
||||
}
|
||||
}
|
||||
|
||||
// Unfortunately Device, despite not being immutable, has an `operator ==`.
|
||||
// Until we fix that, we have to also ignore related lints here.
|
||||
// ignore: avoid_implementing_value_types
|
||||
|
@ -17,7 +17,6 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:test/fake.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
import '../../src/context.dart';
|
||||
@ -704,12 +703,3 @@ flutter:
|
||||
// TODO(zanderso): This is an integration test and should be moved to the integration shard.
|
||||
}, skip: true); // https://github.com/flutter/flutter/issues/87922
|
||||
}
|
||||
|
||||
class FakeGradleUtils extends GradleUtils {
|
||||
@override
|
||||
String getExecutable(FlutterProject project) {
|
||||
return 'gradlew';
|
||||
}
|
||||
}
|
||||
|
||||
class FakeAndroidSdk extends Fake implements AndroidSdk { }
|
||||
|
@ -183,4 +183,3 @@ class FakeProcessSignal extends Fake implements io.ProcessSignal {
|
||||
@override
|
||||
Stream<io.ProcessSignal> watch() => controller.stream;
|
||||
}
|
||||
class FakeFile extends Fake implements File { }
|
||||
|
@ -10,7 +10,6 @@ import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/deferred_component.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/depfile.dart';
|
||||
@ -21,7 +20,6 @@ import '../../../src/common.dart';
|
||||
import '../../../src/context.dart';
|
||||
import '../../../src/fake_process_manager.dart';
|
||||
|
||||
final Platform platform = FakePlatform();
|
||||
void main() {
|
||||
FakeProcessManager processManager;
|
||||
FileSystem fileSystem;
|
||||
|
@ -6,7 +6,6 @@ import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/icon_tree_shaker.dart';
|
||||
@ -16,7 +15,6 @@ import '../../../src/common.dart';
|
||||
import '../../../src/fake_process_manager.dart';
|
||||
import '../../../src/fakes.dart';
|
||||
|
||||
final Platform kNoAnsiPlatform = FakePlatform();
|
||||
const List<int> _kTtfHeaderBytes = <int>[0, 1, 0, 0, 0, 15, 0, 128, 0, 3, 0, 112];
|
||||
|
||||
const String inputPath = '/input/fonts/MaterialIcons-Regular.otf';
|
||||
|
@ -9,7 +9,6 @@ import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/depfile.dart';
|
||||
@ -20,11 +19,6 @@ import 'package:flutter_tools/src/convert.dart';
|
||||
import '../../../src/common.dart';
|
||||
import '../../../src/context.dart';
|
||||
|
||||
final Platform kWindowsPlatform = FakePlatform(
|
||||
operatingSystem: 'windows',
|
||||
environment: <String, String>{},
|
||||
);
|
||||
|
||||
void main() {
|
||||
testWithoutContext('UnpackWindows copies files to the correct windows/ cache directory', () async {
|
||||
final Artifacts artifacts = Artifacts.test();
|
||||
|
@ -1062,19 +1062,6 @@ class FakeSimpleArtifact extends CachedArtifact {
|
||||
Future<void> updateInner(ArtifactUpdater artifactUpdater, FileSystem fileSystem, OperatingSystemUtils operatingSystemUtils) async { }
|
||||
}
|
||||
|
||||
class FakeDownloadedArtifact extends CachedArtifact {
|
||||
FakeDownloadedArtifact(this.downloadedFile, Cache cache) : super(
|
||||
'fake',
|
||||
cache,
|
||||
DevelopmentArtifact.universal,
|
||||
);
|
||||
|
||||
final File downloadedFile;
|
||||
|
||||
@override
|
||||
Future<void> updateInner(ArtifactUpdater artifactUpdater, FileSystem fileSystem, OperatingSystemUtils operatingSystemUtils) async { }
|
||||
}
|
||||
|
||||
class FakeSecondaryCachedArtifact extends Fake implements CachedArtifact {
|
||||
bool upToDate = false;
|
||||
bool didUpdate = false;
|
||||
|
@ -3,13 +3,10 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
import 'package:flutter_tools/src/daemon.dart';
|
||||
import 'package:test/fake.dart';
|
||||
|
||||
import '../src/common.dart';
|
||||
|
||||
@ -388,29 +385,3 @@ Future<List<_DaemonMessageAndBinary>> _readAllBinaries(Stream<DaemonMessage> inp
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
|
||||
class FakeSocket extends Fake implements Socket {
|
||||
bool closeCalled = false;
|
||||
final StreamController<Uint8List> controller = StreamController<Uint8List>();
|
||||
final List<Object?> writtenObjects = <Object?>[];
|
||||
|
||||
@override
|
||||
StreamSubscription<Uint8List> listen(
|
||||
void Function(Uint8List event)? onData, {
|
||||
Function? onError,
|
||||
void Function()? onDone,
|
||||
bool? cancelOnError,
|
||||
}) {
|
||||
return controller.stream.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(Object? object) {
|
||||
writtenObjects.add(object);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() async {
|
||||
closeCalled = true;
|
||||
}
|
||||
}
|
||||
|
@ -55,36 +55,6 @@ final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate(
|
||||
isolateFlags: <vm_service.IsolateFlag>[],
|
||||
);
|
||||
|
||||
final vm_service.Isolate fakePausedIsolate = vm_service.Isolate(
|
||||
id: '1',
|
||||
pauseEvent: vm_service.Event(
|
||||
kind: vm_service.EventKind.kPauseException,
|
||||
timestamp: 0
|
||||
),
|
||||
breakpoints: <vm_service.Breakpoint>[
|
||||
vm_service.Breakpoint(
|
||||
breakpointNumber: 123,
|
||||
id: 'test-breakpoint',
|
||||
location: vm_service.SourceLocation(
|
||||
tokenPos: 0,
|
||||
script: vm_service.ScriptRef(id: 'test-script', uri: 'foo.dart'),
|
||||
),
|
||||
enabled: true,
|
||||
resolved: true,
|
||||
),
|
||||
],
|
||||
exceptionPauseMode: null,
|
||||
libraries: <vm_service.LibraryRef>[],
|
||||
livePorts: 0,
|
||||
name: 'test',
|
||||
number: '1',
|
||||
pauseOnExit: false,
|
||||
runnable: true,
|
||||
startTime: 0,
|
||||
isSystemIsolate: false,
|
||||
isolateFlags: <vm_service.IsolateFlag>[],
|
||||
);
|
||||
|
||||
final vm_service.VM fakeVM = vm_service.VM(
|
||||
isolates: <vm_service.IsolateRef>[fakeUnpausedIsolate],
|
||||
pid: 1,
|
||||
|
@ -121,17 +121,3 @@ void main() {
|
||||
}
|
||||
|
||||
class FakeSuitePlatform extends Fake implements SuitePlatform { }
|
||||
|
||||
// A FlutterPlatform with enough fields set to load and start a test.
|
||||
class TestFlutterPlatform extends FlutterPlatform {
|
||||
TestFlutterPlatform() : super(
|
||||
shellPath: '/',
|
||||
debuggingOptions: DebuggingOptions.enabled(
|
||||
const BuildInfo(
|
||||
BuildMode.debug,
|
||||
'',
|
||||
treeShakeIcons: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import 'dart:convert';
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/common.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/os.dart';
|
||||
@ -734,17 +733,6 @@ class FakeFuchsiaKernelCompiler implements FuchsiaKernelCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
class FailingKernelCompiler implements FuchsiaKernelCompiler {
|
||||
@override
|
||||
Future<void> build({
|
||||
@required FuchsiaProject fuchsiaProject,
|
||||
@required String target, // E.g., lib/main.dart
|
||||
BuildInfo buildInfo = BuildInfo.debug,
|
||||
}) async {
|
||||
throwToolExit('Build process failed');
|
||||
}
|
||||
}
|
||||
|
||||
class FakeFuchsiaFfx implements FuchsiaFfx {
|
||||
@override
|
||||
Future<List<String>> list({Duration timeout}) async {
|
||||
|
@ -876,26 +876,6 @@ class FakePortForwarder extends Fake implements DevicePortForwarder {
|
||||
}
|
||||
}
|
||||
|
||||
class FuchsiaDeviceWithFakeDiscovery extends FuchsiaDevice {
|
||||
FuchsiaDeviceWithFakeDiscovery(String id, {String name}) : super(id, name: name);
|
||||
|
||||
@override
|
||||
FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(String isolateName) {
|
||||
return FakeFuchsiaIsolateDiscoveryProtocol();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.fuchsia_arm64;
|
||||
}
|
||||
|
||||
class FakeFuchsiaIsolateDiscoveryProtocol implements FuchsiaIsolateDiscoveryProtocol {
|
||||
@override
|
||||
FutureOr<Uri> get uri => Uri.parse('http://[::1]:37');
|
||||
|
||||
@override
|
||||
void dispose() {}
|
||||
}
|
||||
|
||||
class FakeFuchsiaFfx implements FuchsiaFfx {
|
||||
@override
|
||||
Future<List<String>> list({Duration timeout}) async {
|
||||
|
@ -39,11 +39,6 @@ const String singleEsMessageArbFileString = '''
|
||||
{
|
||||
"title": "Título"
|
||||
}''';
|
||||
const String twoEsMessageArbFileString = '''
|
||||
{
|
||||
"title": "Título",
|
||||
"subtitle": "Subtitular"
|
||||
}''';
|
||||
const String singleZhMessageArbFileString = '''
|
||||
{
|
||||
"title": "标题"
|
||||
|
@ -27,42 +27,8 @@ import 'package:vm_service/vm_service.dart' as vm_service;
|
||||
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
import '../src/fake_vm_services.dart';
|
||||
import '../src/fakes.dart';
|
||||
|
||||
final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate(
|
||||
id: '1',
|
||||
pauseEvent: vm_service.Event(
|
||||
kind: vm_service.EventKind.kResume,
|
||||
timestamp: 0
|
||||
),
|
||||
breakpoints: <vm_service.Breakpoint>[],
|
||||
exceptionPauseMode: null,
|
||||
libraries: <vm_service.LibraryRef>[],
|
||||
livePorts: 0,
|
||||
name: 'test',
|
||||
number: '1',
|
||||
pauseOnExit: false,
|
||||
runnable: true,
|
||||
startTime: 0,
|
||||
isSystemIsolate: false,
|
||||
isolateFlags: <vm_service.IsolateFlag>[],
|
||||
);
|
||||
|
||||
final FlutterView fakeFlutterView = FlutterView(
|
||||
id: 'a',
|
||||
uiIsolate: fakeUnpausedIsolate,
|
||||
);
|
||||
|
||||
final FakeVmServiceRequest listViews = FakeVmServiceRequest(
|
||||
method: kListViewsMethod,
|
||||
jsonResponse: <String, Object>{
|
||||
'views': <Object>[
|
||||
fakeFlutterView.toJson(),
|
||||
],
|
||||
},
|
||||
);
|
||||
|
||||
void main() {
|
||||
group('validateReloadReport', () {
|
||||
testUsingContext('invalid', () async {
|
||||
|
@ -21,18 +21,6 @@ import '../src/context.dart';
|
||||
import '../src/fake_devices.dart';
|
||||
import '../src/fake_vm_services.dart';
|
||||
|
||||
final Map<String, Object> vm = <String, dynamic>{
|
||||
'isolates': <dynamic>[
|
||||
<String, dynamic>{
|
||||
'type': '@Isolate',
|
||||
'fixedId': true,
|
||||
'id': 'isolates/242098474',
|
||||
'name': 'main.dart:main()',
|
||||
'number': 242098474,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
final vm_service.Isolate isolate = vm_service.Isolate(
|
||||
id: '1',
|
||||
pauseEvent: vm_service.Event(
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
@ -22,8 +21,6 @@ import '../../src/common.dart';
|
||||
import '../../src/context.dart';
|
||||
import '../../src/fake_process_manager.dart';
|
||||
|
||||
typedef InvokeProcess = Future<ProcessResult> Function();
|
||||
|
||||
void main() {
|
||||
FileSystem fileSystem;
|
||||
FakeProcessManager fakeProcessManager;
|
||||
|
@ -5,7 +5,6 @@
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/project_migrator.dart';
|
||||
import 'package:flutter_tools/src/macos/migrations/remove_macos_framework_link_and_embedding_migration.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:flutter_tools/src/xcode_project.dart';
|
||||
@ -159,19 +158,3 @@ class FakeMacOSProject extends Fake implements MacOSProject {
|
||||
@override
|
||||
File xcodeProjectInfoFile = MemoryFileSystem.test().file('xcodeProjectInfoFile');
|
||||
}
|
||||
|
||||
class FakeMacOSMigrator extends ProjectMigrator {
|
||||
FakeMacOSMigrator({required this.succeeds}) : super(BufferLogger.test());
|
||||
|
||||
final bool succeeds;
|
||||
|
||||
@override
|
||||
bool migrate() {
|
||||
return succeeds;
|
||||
}
|
||||
|
||||
@override
|
||||
String migrateLine(String line) {
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
@ -48,21 +48,6 @@ final vm_service.Isolate isolate = vm_service.Isolate(
|
||||
extensionRPCs: <String>['ext.flutter.connectedVmServiceUri'],
|
||||
);
|
||||
|
||||
final vm_service.VM fakeVM = vm_service.VM(
|
||||
isolates: <vm_service.IsolateRef>[isolate],
|
||||
pid: 1,
|
||||
hostCPU: '',
|
||||
isolateGroups: <vm_service.IsolateGroupRef>[],
|
||||
targetCPU: '',
|
||||
startTime: 0,
|
||||
name: 'dart',
|
||||
architectureBits: 64,
|
||||
operatingSystem: '',
|
||||
version: '',
|
||||
systemIsolateGroups: <vm_service.IsolateGroupRef>[],
|
||||
systemIsolates: <vm_service.IsolateRef>[],
|
||||
);
|
||||
|
||||
final FakeVmServiceRequest listViews = FakeVmServiceRequest(
|
||||
method: kListViewsMethod,
|
||||
jsonResponse: <String, Object>{
|
||||
|
@ -52,21 +52,6 @@ final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate(
|
||||
isolateFlags: <vm_service.IsolateFlag>[],
|
||||
);
|
||||
|
||||
final vm_service.VM fakeVM = vm_service.VM(
|
||||
isolates: <vm_service.IsolateRef>[fakeUnpausedIsolate],
|
||||
pid: 1,
|
||||
hostCPU: '',
|
||||
isolateGroups: <vm_service.IsolateGroupRef>[],
|
||||
targetCPU: '',
|
||||
startTime: 0,
|
||||
name: 'dart',
|
||||
architectureBits: 64,
|
||||
operatingSystem: '',
|
||||
version: '',
|
||||
systemIsolateGroups: <vm_service.IsolateGroupRef>[],
|
||||
systemIsolates: <vm_service.IsolateRef>[],
|
||||
);
|
||||
|
||||
final FlutterView fakeFlutterView = FlutterView(
|
||||
id: 'a',
|
||||
uiIsolate: fakeUnpausedIsolate,
|
||||
|
@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart' as io;
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/version.dart';
|
||||
import 'package:flutter_tools/src/vmservice.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:vm_service/vm_service.dart' as vm_service;
|
||||
@ -20,31 +19,6 @@ import '../src/common.dart';
|
||||
import '../src/context.dart' hide testLogger;
|
||||
import '../src/fake_vm_services.dart';
|
||||
|
||||
final Map<String, Object> vm = <String, dynamic>{
|
||||
'type': 'VM',
|
||||
'name': 'vm',
|
||||
'architectureBits': 64,
|
||||
'targetCPU': 'x64',
|
||||
'hostCPU': ' Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz',
|
||||
'version': '2.1.0-dev.7.1.flutter-45f9462398 (Fri Oct 19 19:27:56 2018 +0000) on "linux_x64"',
|
||||
'_profilerMode': 'Dart',
|
||||
'_nativeZoneMemoryUsage': 0,
|
||||
'pid': 103707,
|
||||
'startTime': 1540426121876,
|
||||
'_embedder': 'Flutter',
|
||||
'_maxRSS': 312614912,
|
||||
'_currentRSS': 33091584,
|
||||
'isolates': <dynamic>[
|
||||
<String, dynamic>{
|
||||
'type': '@Isolate',
|
||||
'fixedId': true,
|
||||
'id': 'isolates/242098474',
|
||||
'name': 'main.dart:main()',
|
||||
'number': 242098474,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const String kExtensionName = 'ext.flutter.test.interestingExtension';
|
||||
|
||||
final vm_service.Isolate isolate = vm_service.Isolate(
|
||||
@ -87,8 +61,6 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest(
|
||||
},
|
||||
);
|
||||
|
||||
typedef ServiceCallback = Future<Map<String, dynamic>> Function(Map<String, Object>);
|
||||
|
||||
void main() {
|
||||
testWithoutContext('VmService registers reloadSources', () async {
|
||||
Future<void> reloadSources(String isolateId, { bool pause, bool force}) async {}
|
||||
@ -880,11 +852,6 @@ class MockVMService extends Fake implements vm_service.VmService {
|
||||
// ignore: avoid_implementing_value_types
|
||||
class FakeDevice extends Fake implements Device { }
|
||||
|
||||
class FakeFlutterVersion extends Fake implements FlutterVersion {
|
||||
@override
|
||||
Map<String, Object> toJson() => const <String, Object>{'Fake': 'Version'};
|
||||
}
|
||||
|
||||
/// A [WebSocketConnector] that always throws an [io.SocketException].
|
||||
Future<io.WebSocket> failingWebSocketConnector(
|
||||
String url, {
|
||||
|
@ -16,20 +16,6 @@ import '../../src/common.dart';
|
||||
|
||||
const TemplateRenderer renderer = MustacheTemplateRenderer();
|
||||
|
||||
const String kPluginDependencies = r'''
|
||||
{
|
||||
"info":"This is a generated file; do not edit or check into version control.",
|
||||
"plugins":{
|
||||
"windows":[
|
||||
{
|
||||
"name":"example","path":"C:\\\\example\\\\",
|
||||
"dependencies":[]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
void main() {
|
||||
|
||||
testWithoutContext('Win32 injects Win32 plugins', () async {
|
||||
|
@ -31,7 +31,6 @@ final bool useInProcessDap = Platform.environment['DAP_TEST_INTERNAL'] == 'true'
|
||||
/// Service traffic (wrapped in a custom 'dart.log' event).
|
||||
final bool verboseLogging = Platform.environment['DAP_TEST_VERBOSE'] == 'true';
|
||||
|
||||
const String startOfErrorOutputMarker = '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════';
|
||||
const String endOfErrorOutputMarker = '════════════════════════════════════════════════════════════════════════════════════════════════════';
|
||||
|
||||
/// Expects the lines in [actual] to match the relevant matcher in [expected],
|
||||
|
@ -54,15 +54,6 @@ test:${fileSystem.path.join(fileSystem.currentDirectory.path, 'lib')}/
|
||||
''');
|
||||
}
|
||||
|
||||
void writePubspec(String folder) {
|
||||
writeFile(fileSystem.path.join(folder, 'pubspec.yaml'), '''
|
||||
name: test
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> getPackages(String folder) async {
|
||||
final List<String> command = <String>[
|
||||
fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'),
|
||||
|
@ -51,9 +51,6 @@ export 'fake_process_manager.dart' show ProcessManager, FakeProcessManager, Fake
|
||||
BufferLogger get testLogger => context.get<Logger>() as BufferLogger;
|
||||
|
||||
FakeDeviceManager get testDeviceManager => context.get<DeviceManager>() as FakeDeviceManager;
|
||||
FakeDoctor get testDoctor => context.get<Doctor>() as FakeDoctor;
|
||||
|
||||
typedef ContextInitializer = void Function(AppContext testContext);
|
||||
|
||||
@isTest
|
||||
void testUsingContext(
|
||||
|
@ -38,14 +38,6 @@ final CustomDeviceConfig testConfig = CustomDeviceConfig(
|
||||
forwardPortSuccessRegex: RegExp('testforwardportsuccess')
|
||||
);
|
||||
|
||||
const String testConfigPingSuccessOutput = 'testpingsuccess\n';
|
||||
const String testConfigForwardPortSuccessOutput = 'testforwardportsuccess\n';
|
||||
final CustomDeviceConfig disabledTestConfig = testConfig.copyWith(enabled: false);
|
||||
final CustomDeviceConfig testConfigNonForwarding = testConfig.copyWith(
|
||||
explicitForwardPortCommand: true,
|
||||
explicitForwardPortSuccessRegex: true,
|
||||
);
|
||||
|
||||
const Map<String, dynamic> testConfigJson = <String, dynamic>{
|
||||
'id': 'testid',
|
||||
'label': 'testlabel',
|
||||
|
@ -68,51 +68,6 @@ class FakeProcess implements Process {
|
||||
}
|
||||
}
|
||||
|
||||
/// A process that prompts the user to proceed, then asynchronously writes
|
||||
/// some lines to stdout before it exits.
|
||||
class PromptingProcess implements Process {
|
||||
PromptingProcess({
|
||||
bool stdinError = false,
|
||||
}) : _stdin = CompleterIOSink(throwOnAdd: stdinError);
|
||||
|
||||
Future<void> showPrompt(String prompt, List<String> outputLines) async {
|
||||
try {
|
||||
_stdoutController.add(utf8.encode(prompt));
|
||||
final List<int> bytesOnStdin = await _stdin.future;
|
||||
// Echo stdin to stdout.
|
||||
_stdoutController.add(bytesOnStdin);
|
||||
if (bytesOnStdin.isNotEmpty && bytesOnStdin[0] == utf8.encode('y')[0]) {
|
||||
for (final String line in outputLines) {
|
||||
_stdoutController.add(utf8.encode('$line\n'));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
await _stdoutController.close();
|
||||
}
|
||||
}
|
||||
|
||||
final StreamController<List<int>> _stdoutController = StreamController<List<int>>();
|
||||
final CompleterIOSink _stdin;
|
||||
|
||||
@override
|
||||
Stream<List<int>> get stdout => _stdoutController.stream;
|
||||
|
||||
@override
|
||||
Stream<List<int>> get stderr => const Stream<List<int>>.empty();
|
||||
|
||||
@override
|
||||
IOSink get stdin => _stdin;
|
||||
|
||||
@override
|
||||
Future<int> get exitCode async {
|
||||
await _stdoutController.done;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@override
|
||||
dynamic noSuchMethod(Invocation invocation) => null;
|
||||
}
|
||||
|
||||
/// An IOSink that completes a future with the first line written to it.
|
||||
class CompleterIOSink extends MemoryIOSink {
|
||||
CompleterIOSink({
|
||||
@ -480,19 +435,6 @@ class TestFeatureFlags implements FeatureFlags {
|
||||
}
|
||||
}
|
||||
|
||||
class FakeStatusLogger extends DelegatingLogger {
|
||||
FakeStatusLogger(super.delegate);
|
||||
|
||||
late Status status;
|
||||
|
||||
@override
|
||||
Status startProgress(String message, {
|
||||
String? progressId,
|
||||
bool multilineOutput = false,
|
||||
int progressIndicatorPadding = kDefaultStatusPadding,
|
||||
}) => status;
|
||||
}
|
||||
|
||||
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
|
||||
FakeOperatingSystemUtils({this.hostPlatform = HostPlatform.linux_x64});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user