Remove dead code in tools tests (#104567)
This commit is contained in:
committed by
GitHub
parent
7a2b187c7b
commit
3fa355c97d
@@ -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});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user