Unverified Commit 5b823cde authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Remove dead mock classes (#75757)

parent 9236eefd
......@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/android/android_sdk.dart';
import 'package:flutter_tools/src/android/android_workflow.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/user_messages.dart';
import 'package:flutter_tools/src/base/version.dart';
......@@ -23,7 +22,6 @@ import '../../src/mocks.dart' show MockAndroidSdk, MockProcess, MockProcessManag
import '../../src/testbed.dart';
class MockAndroidSdkVersion extends Mock implements AndroidSdkVersion {}
class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {}
void main() {
AndroidSdk sdk;
......
......@@ -14,12 +14,10 @@ import 'package:flutter_tools/src/build_system/depfile.dart';
import 'package:flutter_tools/src/build_system/targets/common.dart';
import 'package:flutter_tools/src/build_system/targets/web.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:mockito/mockito.dart';
import 'package:process/process.dart';
import '../../../src/common.dart';
import '../../../src/context.dart';
import '../../../src/mocks.dart';
import '../../../src/testbed.dart';
const List<String> kDart2jsLinuxArgs = <String>[
......@@ -462,11 +460,21 @@ void main() {
test('Dart2JSTarget produces expected depfile', () => testbed.run(() async {
environment.defines[kBuildMode] = 'release';
when(globals.processManager.run(any)).thenAnswer((Invocation invocation) async {
environment.buildDir.childFile('app.dill.deps')
.writeAsStringSync('file:///a.dart');
return FakeProcessResult(exitCode: 0);
});
processManager.addCommand(FakeCommand(
command: <String>[
...kDart2jsLinuxArgs,
'-Ddart.vm.product=true',
'--no-source-maps',
'-o',
environment.buildDir.childFile('app.dill').absolute.path,
'--packages=.packages',
'--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path,
], onRun: () {
environment.buildDir.childFile('app.dill.deps')
.writeAsStringSync('file:///a.dart');
},
));
await const Dart2JSTarget().build(environment);
expect(environment.buildDir.childFile('dart2js.d'), exists);
......@@ -476,7 +484,7 @@ void main() {
expect(depfile.outputs.single.path,
environment.buildDir.childFile('main.dart.js').absolute.path);
}, overrides: <Type, Generator>{
ProcessManager: () => MockProcessManager(),
ProcessManager: () => processManager,
}));
test('Dart2JSTarget calls dart2js with Dart defines in release mode', () => testbed.run(() async {
......@@ -652,5 +660,3 @@ void main() {
contains('"main.dart.js"'));
}));
}
class MockProcessManager extends Mock implements ProcessManager {}
......@@ -109,18 +109,18 @@ void main() {
});
group('The FLUTTER_TEST environment variable is passed to the test process', () {
MockPlatform mockPlatform;
FakePlatform fakePlatform;
MockProcessManager mockProcessManager;
FlutterPlatform flutterPlatform;
final Map<Type, Generator> contextOverrides = <Type, Generator>{
Platform: () => mockPlatform,
Platform: () => fakePlatform,
ProcessManager: () => mockProcessManager,
FileSystem: () => fileSystem,
};
setUp(() {
mockPlatform = MockPlatform();
when(mockPlatform.isWindows).thenReturn(false);
// Not Windows
fakePlatform = FakePlatform(operatingSystem: 'linux');
mockProcessManager = MockProcessManager();
flutterPlatform = TestFlutterPlatform();
});
......@@ -144,31 +144,31 @@ void main() {
}
testUsingContext('as true when not originally set', () async {
when(mockPlatform.environment).thenReturn(<String, String>{});
fakePlatform.environment = <String, String>{};
final Map<String, String> capturedEnvironment = await captureEnvironment();
expect(capturedEnvironment['FLUTTER_TEST'], 'true');
}, overrides: contextOverrides);
testUsingContext('as true when set to true', () async {
when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_TEST': 'true'});
fakePlatform.environment = <String, String>{'FLUTTER_TEST': 'true'};
final Map<String, String> capturedEnvironment = await captureEnvironment();
expect(capturedEnvironment['FLUTTER_TEST'], 'true');
}, overrides: contextOverrides);
testUsingContext('as false when set to false', () async {
when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_TEST': 'false'});
fakePlatform.environment = <String, String>{'FLUTTER_TEST': 'false'};
final Map<String, String> capturedEnvironment = await captureEnvironment();
expect(capturedEnvironment['FLUTTER_TEST'], 'false');
}, overrides: contextOverrides);
testUsingContext('unchanged when set', () async {
when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_TEST': 'neither true nor false'});
fakePlatform.environment = <String, String>{'FLUTTER_TEST': 'neither true nor false'};
final Map<String, String> capturedEnvironment = await captureEnvironment();
expect(capturedEnvironment['FLUTTER_TEST'], 'neither true nor false');
}, overrides: contextOverrides);
testUsingContext('as null when set to null', () async {
when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_TEST': null});
fakePlatform.environment = <String, String>{'FLUTTER_TEST': null};
final Map<String, String> capturedEnvironment = await captureEnvironment();
expect(capturedEnvironment['FLUTTER_TEST'], null);
}, overrides: contextOverrides);
......@@ -279,8 +279,6 @@ class MockProcessManager extends Mock implements ProcessManager {}
class MockProcess extends Mock implements Process {}
class MockPlatform extends Mock implements Platform {}
class MockHttpServer extends Mock implements HttpServer {}
// A FlutterPlatform with enough fields set to load and start a test.
......
......@@ -25,7 +25,6 @@ import 'package:flutter_tools/src/ios/iproxy.dart';
import 'package:flutter_tools/src/ios/mac.dart';
import 'package:flutter_tools/src/macos/xcode.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart';
import '../../src/common.dart';
import '../../src/context.dart';
......@@ -583,8 +582,5 @@ void main() {
}
class MockIOSApp extends Mock implements IOSApp {}
class MockIMobileDevice extends Mock implements IMobileDevice {}
class MockIOSDeploy extends Mock implements IOSDeploy {}
class MockIOSWorkflow extends Mock implements IOSWorkflow {}
class MockXcdevice extends Mock implements XCDevice {}
class MockVmService extends Mock implements VmService {}
......@@ -18,8 +18,6 @@ import 'package:flutter_tools/src/ios/ios_deploy.dart';
import 'package:flutter_tools/src/ios/iproxy.dart';
import 'package:flutter_tools/src/ios/mac.dart';
import 'package:meta/meta.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart';
import '../../src/common.dart';
import '../../src/context.dart';
......@@ -316,5 +314,3 @@ IOSDevice setUpIOSDevice({
interfaceType: interfaceType,
);
}
class MockVmService extends Mock implements VmService {}
......@@ -12,8 +12,6 @@ import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/ios/devices.dart';
import 'package:flutter_tools/src/ios/iproxy.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart';
import '../../src/common.dart';
import '../../src/context.dart';
......@@ -92,5 +90,3 @@ IOSDevice setUpIOSDevice(FileSystem fileSystem) {
interfaceType: IOSDeviceInterface.usb,
);
}
class MockVmService extends Mock implements VmService {}
......@@ -22,7 +22,6 @@ import 'package:flutter_tools/src/macos/xcode.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:mockito/mockito.dart';
import 'package:fake_async/fake_async.dart';
import 'package:vm_service/vm_service.dart';
import '../../src/common.dart';
import '../../src/context.dart';
......@@ -350,4 +349,3 @@ IOSDevice setUpIOSDevice({
}
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {}
class MockVmService extends Mock implements VmService {}
......@@ -36,16 +36,13 @@ void main() {
platform = FakePlatform(operatingSystem: 'macos');
final FileSystem fileSystem = MemoryFileSystem.test();
fileSystem.file(xcodebuild).createSync(recursive: true);
final AnsiTerminal terminal = MockAnsiTerminal();
logger = BufferLogger.test(
terminal: terminal
);
logger = BufferLogger.test();
xcodeProjectInterpreter = XcodeProjectInterpreter(
logger: logger,
fileSystem: fileSystem,
platform: platform,
processManager: processManager,
terminal: terminal,
terminal: Terminal.test(),
usage: null,
);
});
......@@ -93,23 +90,19 @@ void main() {
FakePlatform platform;
FileSystem fileSystem;
BufferLogger logger;
AnsiTerminal terminal;
setUp(() {
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
platform = FakePlatform(operatingSystem: 'macos');
fileSystem = MemoryFileSystem.test();
fileSystem.file(xcodebuild).createSync(recursive: true);
terminal = MockAnsiTerminal();
logger = BufferLogger.test(
terminal: terminal
);
logger = BufferLogger.test();
xcodeProjectInterpreter = XcodeProjectInterpreter(
logger: logger,
fileSystem: fileSystem,
platform: platform,
processManager: fakeProcessManager,
terminal: terminal,
terminal: Terminal.test(),
usage: null,
);
});
......@@ -226,7 +219,7 @@ void main() {
fileSystem: fileSystem,
platform: platform,
processManager: fakeProcessManager,
terminal: terminal,
terminal: Terminal.test(),
usage: TestUsage(),
);
fileSystem.file(xcodebuild).deleteSync();
......@@ -430,7 +423,7 @@ void main() {
fileSystem: fileSystem,
platform: platform,
processManager: fakeProcessManager,
terminal: terminal,
terminal: Terminal.test(),
usage: TestUsage(),
);
......@@ -457,7 +450,7 @@ void main() {
fileSystem: fileSystem,
platform: platform,
processManager: fakeProcessManager,
terminal: terminal,
terminal: Terminal.test(),
usage: TestUsage(),
);
......@@ -999,8 +992,3 @@ flutter:
}
class MockLocalEngineArtifacts extends Mock implements LocalEngineArtifacts {}
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {}
class MockAnsiTerminal extends Mock implements AnsiTerminal {
@override
bool get supportsColor => false;
}
......@@ -2948,9 +2948,7 @@ class MockDartDevelopmentService extends Mock implements DartDevelopmentService
class MockVMService extends Mock implements vm_service.VmService {}
class MockDevFS extends Mock implements DevFS {}
class MockDeviceLogReader extends Mock implements DeviceLogReader {}
class MockDevicePortForwarder extends Mock implements DevicePortForwarder {}
class MockDevtoolsLauncher extends Mock implements DevtoolsLauncher {}
class MockProcessManager extends Mock implements ProcessManager {}
class MockResidentCompiler extends Mock implements ResidentCompiler {}
class MockDevice extends Mock implements Device {}
......
......@@ -6,7 +6,6 @@
import 'dart:async';
import 'package:dwds/dwds.dart';
import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
......@@ -23,7 +22,6 @@ import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/web/chrome.dart';
import 'package:flutter_tools/src/web/web_device.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart';
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
import '../src/common.dart';
......@@ -192,8 +190,6 @@ void main() {
class MockWebDevFS extends Mock implements WebDevFS {}
class MockWebDevice extends Mock implements Device {}
class MockDebugConnection extends Mock implements DebugConnection {}
class MockVmService extends Mock implements VmService {}
class MockStatus extends Mock implements Status {}
class MockFlutterDevice extends Mock implements FlutterDevice {}
class MockChromeDevice extends Mock implements ChromiumDevice {}
......
......@@ -32,7 +32,6 @@ import 'package:flutter_tools/src/web/chrome.dart';
import 'package:flutter_tools/src/web/web_device.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart' as vm_service;
import 'package:vm_service/vm_service.dart';
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
import '../src/common.dart';
......@@ -1649,7 +1648,6 @@ class MockFlutterUsage extends Mock implements Usage {}
class MockChromeDevice extends Mock implements ChromiumDevice {}
class MockDebugConnection extends Mock implements DebugConnection {}
class MockAppConnection extends Mock implements AppConnection {}
class MockVmService extends Mock implements VmService {}
class MockStatus extends Mock implements Status {}
class MockFlutterDevice extends Mock implements FlutterDevice {}
class MockWebDevFS extends Mock implements WebDevFS {}
......
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