Unverified Commit 66768f8c authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Remove mocks from web devices test (#77968)

parent d637b187
...@@ -19,7 +19,6 @@ import 'package:flutter_tools/src/commands/attach.dart'; ...@@ -19,7 +19,6 @@ import 'package:flutter_tools/src/commands/attach.dart';
import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/ios/devices.dart'; import 'package:flutter_tools/src/ios/devices.dart';
import 'package:flutter_tools/src/mdns_discovery.dart';
import 'package:flutter_tools/src/project.dart'; import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/resident_runner.dart'; import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/run_hot.dart'; import 'package:flutter_tools/src/run_hot.dart';
...@@ -718,7 +717,6 @@ void main() { ...@@ -718,7 +717,6 @@ void main() {
class MockHotRunner extends Mock implements HotRunner {} class MockHotRunner extends Mock implements HotRunner {}
class MockHotRunnerFactory extends Mock implements HotRunnerFactory {} class MockHotRunnerFactory extends Mock implements HotRunnerFactory {}
class MockIOSDevice extends Mock implements IOSDevice {} class MockIOSDevice extends Mock implements IOSDevice {}
class MockMDnsObservatoryDiscovery extends Mock implements MDnsObservatoryDiscovery {}
class MockPortForwarder extends Mock implements DevicePortForwarder {} class MockPortForwarder extends Mock implements DevicePortForwarder {}
class StreamLogger extends Logger { class StreamLogger extends Logger {
......
...@@ -1277,8 +1277,6 @@ class FuchsiaModulePackage extends ApplicationPackage { ...@@ -1277,8 +1277,6 @@ class FuchsiaModulePackage extends ApplicationPackage {
final String name; final String name;
} }
class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {}
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
class MockProcessResult extends Mock implements ProcessResult {} class MockProcessResult extends Mock implements ProcessResult {}
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/process.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_pm.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_pm.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
...@@ -74,6 +73,4 @@ void main() { ...@@ -74,6 +73,4 @@ void main() {
} }
class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {} class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {}
class MockProcessUtils extends Mock implements ProcessUtils {}
class MockProcess extends Mock implements Process {}
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import 'dart:io' hide Directory, File; import 'dart:io' hide Directory, File;
import 'package:dwds/dwds.dart';
import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
...@@ -1084,4 +1083,3 @@ void main() { ...@@ -1084,4 +1083,3 @@ void main() {
class MockHttpServer extends Mock implements HttpServer {} class MockHttpServer extends Mock implements HttpServer {}
class MockResidentCompiler extends Mock implements ResidentCompiler {} class MockResidentCompiler extends Mock implements ResidentCompiler {}
class MockDwds extends Mock implements Dwds {}
...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/build_info.dart'; ...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/web/chrome.dart'; import 'package:flutter_tools/src/web/chrome.dart';
import 'package:flutter_tools/src/web/web_device.dart'; import 'package:flutter_tools/src/web/web_device.dart';
import 'package:mockito/mockito.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
...@@ -126,8 +125,8 @@ void main() { ...@@ -126,8 +125,8 @@ void main() {
}); });
testWithoutContext('Chrome device is not listed when Chrome cannot be run', () async { testWithoutContext('Chrome device is not listed when Chrome cannot be run', () async {
final MockProcessManager processManager = MockProcessManager(); final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[]);
when(processManager.canRun(any)).thenReturn(false); processManager.excludedExecutables = <String>{kLinuxExecutable};
final WebDevices webDevices = WebDevices( final WebDevices webDevices = WebDevices(
featureFlags: TestFeatureFlags(isWebEnabled: true), featureFlags: TestFeatureFlags(isWebEnabled: true),
fileSystem: MemoryFileSystem.test(), fileSystem: MemoryFileSystem.test(),
...@@ -143,24 +142,6 @@ void main() { ...@@ -143,24 +142,6 @@ void main() {
isNot(contains(isA<GoogleChromeDevice>()))); isNot(contains(isA<GoogleChromeDevice>())));
}); });
testWithoutContext('Edge device is not listed when Edge cannot be run', () async {
final MockProcessManager processManager = MockProcessManager();
when(processManager.canRun(any)).thenReturn(false);
final WebDevices webDevices = WebDevices(
featureFlags: TestFeatureFlags(isWebEnabled: true),
fileSystem: MemoryFileSystem.test(),
logger: BufferLogger.test(),
platform: FakePlatform(
operatingSystem: 'linux',
environment: <String, String>{}
),
processManager: processManager,
);
expect(await webDevices.pollingGetDevices(),
isNot(contains(isA<MicrosoftEdgeDevice>())));
});
testWithoutContext('Web Server device is listed if enabled via showWebServerDevice', () async { testWithoutContext('Web Server device is listed if enabled via showWebServerDevice', () async {
WebServerDevice.showWebServerDevice = true; WebServerDevice.showWebServerDevice = true;
final WebDevices webDevices = WebDevices( final WebDevices webDevices = WebDevices(
...@@ -329,6 +310,3 @@ void main() { ...@@ -329,6 +310,3 @@ void main() {
expect((await macosWebDevices.pollingGetDevices()).whereType<MicrosoftEdgeDevice>(), isEmpty); expect((await macosWebDevices.pollingGetDevices()).whereType<MicrosoftEdgeDevice>(), isEmpty);
}); });
} }
// This is used to set `canRun` to false in a test.
class MockProcessManager extends Mock implements ProcessManager {}
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