Unverified Commit 8bea6328 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

[flutter_tools] add shuffle to hermetic run_tests (#105462)

parent 0cdb3bf5
......@@ -4,12 +4,6 @@
// @dart = 2.8
// TODO(gspencergoog): Remove this tag once this test's state leaks/test
// dependencies have been fixed.
// https://github.com/flutter/flutter/issues/85160
// Fails with "flutter test --test-randomize-ordering-seed=1000"
@Tags(<String>['no-shuffle'])
import 'dart:async';
import 'package:file/file.dart';
......@@ -405,7 +399,6 @@ void main() {
Usage: () => usage,
});
testUsingContext('passes device target platform to usage', () async {
final RunCommand command = RunCommand();
final FakeDevice mockDevice = FakeDevice(sdkNameAndVersion: 'iOS 13')
......@@ -431,7 +424,7 @@ void main() {
expect(usage.commands, contains(
TestUsageCommand('run', parameters: CustomDimensions.fromMap(<String, String>{
'cd3': 'false', 'cd4': 'ios', 'cd22': 'iOS 13',
'cd23': 'debug', 'cd18': 'false', 'cd15': 'swift', 'cd31': 'false',
'cd23': 'debug', 'cd18': 'false', 'cd15': 'swift', 'cd31': 'true',
'cd56': 'false',
})
)));
......@@ -441,6 +434,7 @@ void main() {
DeviceManager: () => mockDeviceManager,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
Stdio: () => FakeStdio(),
Usage: () => usage,
});
......
......@@ -222,9 +222,9 @@ class MemoryStdout extends MemoryIOSink implements io.Stdout {
/// A Stdio that collects stdout and supports simulated stdin.
class FakeStdio extends Stdio {
final MemoryStdout _stdout = MemoryStdout();
final MemoryStdout _stdout = MemoryStdout()..terminalColumns = 80;
final MemoryIOSink _stderr = MemoryIOSink();
final StreamController<List<int>> _stdin = StreamController<List<int>>();
final FakeStdin _stdin = FakeStdin();
@override
MemoryStdout get stdout => _stdout;
......@@ -233,16 +233,52 @@ class FakeStdio extends Stdio {
MemoryIOSink get stderr => _stderr;
@override
Stream<List<int>> get stdin => _stdin.stream;
Stream<List<int>> get stdin => _stdin;
void simulateStdin(String line) {
_stdin.add(utf8.encode('$line\n'));
_stdin.controller.add(utf8.encode('$line\n'));
}
@override
bool hasTerminal = true;
List<String> get writtenToStdout => _stdout.writes.map<String>(_stdout.encoding.decode).toList();
List<String> get writtenToStderr => _stderr.writes.map<String>(_stderr.encoding.decode).toList();
}
class FakeStdin extends Fake implements Stdin {
final StreamController<List<int>> controller = StreamController<List<int>>();
@override
bool echoMode = true;
@override
bool echoNewlineMode = true;
@override
bool lineMode = true;
@override
Stream<S> transform<S>(StreamTransformer<List<int>, S> transformer) {
return controller.stream.transform(transformer);
}
@override
StreamSubscription<List<int>> listen(
void Function(List<int> event)? onData, {
Function? onError,
void Function()? onDone,
bool? cancelOnError,
}) {
return controller.stream.listen(
onData,
onError: onError,
onDone: onDone,
cancelOnError: cancelOnError,
);
}
}
class FakePlistParser implements PlistParser {
FakePlistParser([Map<String, Object>? underlyingValues]):
_underlyingValues = underlyingValues ?? <String, Object>{};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment