Skip to content

Commit 3620314

Browse files
authored
Delete MockResidentCompiler (flutter#76280)
1 parent 5e61466 commit 3620314

File tree

3 files changed

+11
-89
lines changed

3 files changed

+11
-89
lines changed

packages/flutter_tools/test/general.shard/cold_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ import 'package:mockito/mockito.dart';
1818

1919
import '../src/common.dart';
2020
import '../src/context.dart';
21-
import '../src/mocks.dart';
2221

2322
void main() {
2423
testUsingContext('Exits with code 2 when when HttpException is thrown '
2524
'during VM service connection', () async {
26-
final MockResidentCompiler residentCompiler = MockResidentCompiler();
25+
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
2726
final MockDevice mockDevice = MockDevice();
2827
when(mockDevice.supportsHotReload).thenReturn(true);
2928
when(mockDevice.supportsHotRestart).thenReturn(false);
@@ -140,3 +139,5 @@ class TestFlutterDevice extends FlutterDevice {
140139
throw exception;
141140
}
142141
}
142+
143+
class FakeResidentCompiler extends Fake implements ResidentCompiler {}

packages/flutter_tools/test/general.shard/hot_test.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import 'package:mockito/mockito.dart';
2323

2424
import '../src/common.dart';
2525
import '../src/context.dart';
26-
import '../src/mocks.dart';
2726

2827
final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate(
2928
id: '1',
@@ -57,6 +56,7 @@ final FakeVmServiceRequest listViews = FakeVmServiceRequest(
5756
],
5857
},
5958
);
59+
6060
void main() {
6161
group('validateReloadReport', () {
6262
testUsingContext('invalid', () async {
@@ -142,7 +142,7 @@ void main() {
142142
});
143143

144144
group('hotRestart', () {
145-
final MockResidentCompiler residentCompiler = MockResidentCompiler();
145+
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
146146
final MockDevFs mockDevFs = MockDevFs();
147147
FileSystem fileSystem;
148148

@@ -511,7 +511,7 @@ void main() {
511511
..createSync(recursive: true)
512512
..writeAsStringSync('\n');
513513

514-
final MockResidentCompiler residentCompiler = MockResidentCompiler();
514+
final FakeResidentCompiler residentCompiler = FakeResidentCompiler();
515515
final MockDevice mockDevice = MockDevice();
516516
when(mockDevice.supportsHotReload).thenReturn(true);
517517
when(mockDevice.supportsHotRestart).thenReturn(false);
@@ -629,3 +629,8 @@ class TestHotRunnerConfig extends HotRunnerConfig {
629629
shutdownHookCalled = true;
630630
}
631631
}
632+
633+
class FakeResidentCompiler extends Fake implements ResidentCompiler {
634+
@override
635+
void accept() {}
636+
}

packages/flutter_tools/test/src/mocks.dart

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,17 @@ import 'dart:io' as io show IOSink;
1010

1111
import 'package:flutter_tools/src/android/android_device.dart';
1212
import 'package:flutter_tools/src/android/android_sdk.dart' show AndroidSdk;
13-
import 'package:flutter_tools/src/base/context.dart';
1413
import 'package:flutter_tools/src/base/file_system.dart' hide IOSink;
1514
import 'package:flutter_tools/src/base/io.dart';
16-
import 'package:flutter_tools/src/base/platform.dart';
1715
import 'package:flutter_tools/src/build_info.dart';
18-
import 'package:flutter_tools/src/compile.dart';
1916
import 'package:flutter_tools/src/globals.dart' as globals;
2017
import 'package:flutter_tools/src/ios/devices.dart';
2118
import 'package:flutter_tools/src/project.dart';
2219
import 'package:mockito/mockito.dart';
23-
import 'package:package_config/package_config.dart';
2420
import 'package:process/process.dart';
2521

26-
import 'common.dart';
2722
import 'fakes.dart';
2823

29-
// TODO(fujino): replace FakePlatform.fromPlatform() with FakePlatform()
30-
final Generator kNoColorTerminalPlatform = () {
31-
return FakePlatform.fromPlatform(
32-
const LocalPlatform()
33-
)..stdoutSupportsAnsi = false;
34-
};
35-
3624
/// An SDK installation with several SDK levels (19, 22, 23).
3725
class MockAndroidSdk extends Mock implements AndroidSdk {
3826
static Directory createSdkDirectory({
@@ -251,78 +239,6 @@ class MockIOSDevice extends Mock implements IOSDevice {
251239
bool isSupportedForProject(FlutterProject flutterProject) => true;
252240
}
253241

254-
/// Common functionality for tracking mock interaction.
255-
class _BasicMock {
256-
final List<String> messages = <String>[];
257-
258-
void expectMessages(List<String> expectedMessages) {
259-
final List<String> actualMessages = List<String>.of(messages);
260-
messages.clear();
261-
expect(actualMessages, unorderedEquals(expectedMessages));
262-
}
263-
264-
bool contains(String match) {
265-
print('Checking for `$match` in:');
266-
print(messages);
267-
final bool result = messages.contains(match);
268-
messages.clear();
269-
return result;
270-
}
271-
}
272-
273-
class MockResidentCompiler extends _BasicMock implements ResidentCompiler {
274-
@override
275-
void accept() { }
276-
277-
@override
278-
Future<CompilerOutput> reject() async { return null; }
279-
280-
@override
281-
void reset() { }
282-
283-
@override
284-
Future<dynamic> shutdown() async { }
285-
286-
@override
287-
Future<CompilerOutput> compileExpression(
288-
String expression,
289-
List<String> definitions,
290-
List<String> typeDefinitions,
291-
String libraryUri,
292-
String klass,
293-
bool isStatic,
294-
) async {
295-
return null;
296-
}
297-
298-
@override
299-
Future<CompilerOutput> compileExpressionToJs(
300-
String libraryUri,
301-
int line,
302-
int column,
303-
Map<String, String> jsModules,
304-
Map<String, String> jsFrameValues,
305-
String moduleName,
306-
String expression,
307-
) async {
308-
return null;
309-
}
310-
311-
@override
312-
Future<CompilerOutput> recompile(Uri mainPath, List<Uri> invalidatedFiles, {
313-
String outputPath,
314-
PackageConfig packageConfig,
315-
bool suppressErrors = false,
316-
}) async {
317-
globals.fs.file(outputPath).createSync(recursive: true);
318-
globals.fs.file(outputPath).writeAsStringSync('compiled_kernel_output');
319-
return CompilerOutput(outputPath, 0, <Uri>[]);
320-
}
321-
322-
@override
323-
void addFileSystemRoot(String root) { }
324-
}
325-
326242
class MockStdIn extends Mock implements IOSink {
327243
final StringBuffer stdInWrites = StringBuffer();
328244

0 commit comments

Comments
 (0)