Unverified Commit 9eacc9ef authored by Dan Field's avatar Dan Field Committed by GitHub

drop mockito for integration_test (#74770)

parent 7db172b2
...@@ -29,6 +29,7 @@ dependencies: ...@@ -29,6 +29,7 @@ dependencies:
file: 6.0.0-nullsafety.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" file: 6.0.0-nullsafety.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.10-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" matcher: 0.12.10-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.3.0-nullsafety.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" meta: 1.3.0-nullsafety.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pedantic: 1.10.0-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.8.0-nullsafety.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_span: 1.8.0-nullsafety.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.10.0-nullsafety.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" stack_trace: 1.10.0-nullsafety.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.1.0-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" stream_channel: 2.1.0-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
...@@ -40,10 +41,6 @@ dependencies: ...@@ -40,10 +41,6 @@ dependencies:
vector_math: 2.1.0-nullsafety.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" vector_math: 2.1.0-nullsafety.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webdriver: 3.0.0-nullsafety.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" webdriver: 3.0.0-nullsafety.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
pedantic: 1.10.0-nullsafety.3
mockito: 4.1.1
flutter: flutter:
plugin: plugin:
platforms: platforms:
...@@ -53,4 +50,4 @@ flutter: ...@@ -53,4 +50,4 @@ flutter:
ios: ios:
pluginClass: IntegrationTestPlugin pluginClass: IntegrationTestPlugin
# PUBSPEC CHECKSUM: 9569 # PUBSPEC CHECKSUM: 4623
...@@ -9,7 +9,6 @@ import 'package:flutter/material.dart'; ...@@ -9,7 +9,6 @@ import 'package:flutter/material.dart';
import 'package:integration_test/integration_test.dart'; import 'package:integration_test/integration_test.dart';
import 'package:integration_test/common.dart'; import 'package:integration_test/common.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart' as vm; import 'package:vm_service/vm_service.dart' as vm;
vm.Timeline _kTimelines = vm.Timeline( vm.Timeline _kTimelines = vm.Timeline(
...@@ -26,20 +25,14 @@ Future<void> main() async { ...@@ -26,20 +25,14 @@ Future<void> main() async {
assert(binding is IntegrationTestWidgetsFlutterBinding); assert(binding is IntegrationTestWidgetsFlutterBinding);
final IntegrationTestWidgetsFlutterBinding integrationBinding = binding as IntegrationTestWidgetsFlutterBinding; final IntegrationTestWidgetsFlutterBinding integrationBinding = binding as IntegrationTestWidgetsFlutterBinding;
MockVM mockVM; FakeVM fakeVM;
final List<int> clockTimes = <int>[100, 200];
setUp(() { setUp(() {
request = integrationBinding.callback(<String, String>{ request = integrationBinding.callback(<String, String>{
'command': 'request_data', 'command': 'request_data',
}); });
mockVM = MockVM(); fakeVM = FakeVM(
when(mockVM.getVMTimeline( timeline: _kTimelines,
timeOriginMicros: anyNamed('timeOriginMicros'),
timeExtentMicros: anyNamed('timeExtentMicros'),
)).thenAnswer((_) => Future<vm.Timeline>.value(_kTimelines));
when(mockVM.getVMTimelineMicros()).thenAnswer(
(_) => Future<vm.Timestamp>.value(vm.Timestamp(timestamp: clockTimes.removeAt(0))),
); );
}); });
...@@ -78,7 +71,7 @@ Future<void> main() async { ...@@ -78,7 +71,7 @@ Future<void> main() async {
}); });
testWidgets('Test traceAction', (WidgetTester tester) async { testWidgets('Test traceAction', (WidgetTester tester) async {
await integrationBinding.enableTimeline(vmService: mockVM); await integrationBinding.enableTimeline(vmService: fakeVM);
await integrationBinding.traceAction(() async {}); await integrationBinding.traceAction(() async {});
expect(integrationBinding.reportData, isNotNull); expect(integrationBinding.reportData, isNotNull);
expect(integrationBinding.reportData.containsKey('timeline'), true); expect(integrationBinding.reportData.containsKey('timeline'), true);
...@@ -121,4 +114,32 @@ Future<void> main() async { ...@@ -121,4 +114,32 @@ Future<void> main() async {
}); });
} }
class MockVM extends Mock implements vm.VmService {} class FakeVM extends Fake implements vm.VmService {
FakeVM({@required this.timeline});
vm.Timeline timeline;
@override
Future<vm.Timeline> getVMTimeline({int timeOriginMicros, int timeExtentMicros}) async {
return timeline;
}
int lastTimeStamp = 0;
@override
Future<vm.Timestamp> getVMTimelineMicros() async {
lastTimeStamp += 100;
return vm.Timestamp(timestamp: lastTimeStamp);
}
List<String> recordedStreams = <String>[];
@override
Future<vm.Success> setVMTimelineFlags(List<String> recordedStreams) async {
recordedStreams = recordedStreams;
return vm.Success();
}
@override
Future<vm.Success> clearVMTimeline() async {
return vm.Success();
}
}
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