Unverified Commit 51ca131e authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] remove most mocks from Fuchsia device tests (#81789)

parent 5575bf3c
...@@ -10,30 +10,29 @@ import 'package:flutter_tools/src/base/file_system.dart'; ...@@ -10,30 +10,29 @@ import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_dev_finder.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_dev_finder.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:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/fake_process_manager.dart'; import '../../src/fake_process_manager.dart';
void main() { void main() {
MockFuchsiaArtifacts mockFuchsiaArtifacts; FakeFuchsiaArtifacts fuchsiaArtifacts;
BufferLogger logger; BufferLogger logger;
MemoryFileSystem memoryFileSystem; MemoryFileSystem memoryFileSystem;
File deviceFinder; File deviceFinder;
setUp(() { setUp(() {
mockFuchsiaArtifacts = MockFuchsiaArtifacts(); fuchsiaArtifacts = FakeFuchsiaArtifacts();
memoryFileSystem = MemoryFileSystem.test(); memoryFileSystem = MemoryFileSystem.test();
logger = BufferLogger.test(); logger = BufferLogger.test();
deviceFinder = memoryFileSystem.file('device-finder'); deviceFinder = memoryFileSystem.file('device-finder');
fuchsiaArtifacts.devFinder = deviceFinder;
when(mockFuchsiaArtifacts.devFinder).thenReturn(deviceFinder);
}); });
group('device-finder list', () { group('device-finder list', () {
testWithoutContext('device-finder not found', () { testWithoutContext('device-finder not found', () {
final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder( final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder(
fuchsiaArtifacts: mockFuchsiaArtifacts, fuchsiaArtifacts: fuchsiaArtifacts,
logger: logger, logger: logger,
processManager: FakeProcessManager.any(), processManager: FakeProcessManager.any(),
); );
...@@ -54,7 +53,7 @@ void main() { ...@@ -54,7 +53,7 @@ void main() {
]); ]);
final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder( final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder(
fuchsiaArtifacts: mockFuchsiaArtifacts, fuchsiaArtifacts: fuchsiaArtifacts,
logger: logger, logger: logger,
processManager: processManager, processManager: processManager,
); );
...@@ -75,7 +74,7 @@ void main() { ...@@ -75,7 +74,7 @@ void main() {
]); ]);
final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder( final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder(
fuchsiaArtifacts: mockFuchsiaArtifacts, fuchsiaArtifacts: fuchsiaArtifacts,
logger: logger, logger: logger,
processManager: processManager, processManager: processManager,
); );
...@@ -96,7 +95,7 @@ void main() { ...@@ -96,7 +95,7 @@ void main() {
]); ]);
final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder( final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder(
fuchsiaArtifacts: mockFuchsiaArtifacts, fuchsiaArtifacts: fuchsiaArtifacts,
logger: logger, logger: logger,
processManager: processManager, processManager: processManager,
); );
...@@ -123,7 +122,7 @@ void main() { ...@@ -123,7 +122,7 @@ void main() {
]); ]);
final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder( final FuchsiaDevFinder fuchsiaDevFinder = FuchsiaDevFinder(
fuchsiaArtifacts: mockFuchsiaArtifacts, fuchsiaArtifacts: fuchsiaArtifacts,
logger: logger, logger: logger,
processManager: processManager, processManager: processManager,
); );
...@@ -133,4 +132,7 @@ void main() { ...@@ -133,4 +132,7 @@ void main() {
}); });
} }
class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {} class FakeFuchsiaArtifacts extends Fake implements FuchsiaArtifacts {
@override
File devFinder;
}
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