Unverified Commit 2d5ed986 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

Update integration tests to use vm_service_lib (#23937)

* Move integration tests to use vm_service_lib
* Turn off debug logging that was accidentally committed
* Run update-packages --force to fix checksum for new dev dependency
* Trim trailing whitespace
parent d04fa1a6
......@@ -77,6 +77,7 @@ dev_dependencies:
collection: 1.14.11
mockito: 4.0.0
file_testing: 2.0.3
vm_service_lib: 0.3.10
http_multi_server: 2.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
js: 0.6.1+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......@@ -93,4 +94,4 @@ dartdoc:
# Exclude this package from the hosted API docs.
nodoc: true
# PUBSPEC CHECKSUM: e719
# PUBSPEC CHECKSUM: 0163
......@@ -7,7 +7,7 @@ import 'dart:async';
import 'package:file/file.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:vm_service_client/vm_service_client.dart';
import 'package:vm_service_lib/vm_service_lib.dart';
import '../src/common.dart';
import 'test_data/basic_project.dart';
......@@ -31,45 +31,45 @@ void main() {
tryToDelete(tempDir);
});
Future<VMIsolate> breakInBuildMethod(FlutterTestDriver flutter) async {
Future<Isolate> breakInBuildMethod(FlutterTestDriver flutter) async {
return _flutter.breakAt(
_project.buildMethodBreakpointUri,
_project.buildMethodBreakpointLine);
}
Future<VMIsolate> breakInTopLevelFunction(FlutterTestDriver flutter) async {
Future<Isolate> breakInTopLevelFunction(FlutterTestDriver flutter) async {
return _flutter.breakAt(
_project.topLevelFunctionBreakpointUri,
_project.topLevelFunctionBreakpointLine);
}
Future<void> evaluateTrivialExpressions() async {
VMInstanceRef res;
InstanceRef res;
res = await _flutter.evaluateExpression('"test"');
expect(res is VMStringInstanceRef && res.value == 'test', isTrue);
res = await _flutter.evaluateInFrame('"test"');
expect(res.kind == InstanceKind.kString && res.valueAsString == 'test', isTrue);
res = await _flutter.evaluateExpression('1');
expect(res is VMIntInstanceRef && res.value == 1, isTrue);
res = await _flutter.evaluateInFrame('1');
expect(res.kind == InstanceKind.kInt && res.valueAsString == 1.toString(), isTrue);
res = await _flutter.evaluateExpression('true');
expect(res is VMBoolInstanceRef && res.value == true, isTrue);
res = await _flutter.evaluateInFrame('true');
expect(res.kind == InstanceKind.kBool && res.valueAsString == true.toString(), isTrue);
}
Future<void> evaluateComplexExpressions() async {
final VMInstanceRef res = await _flutter.evaluateExpression('new DateTime.now().year');
expect(res is VMIntInstanceRef && res.value == DateTime.now().year, isTrue);
final InstanceRef res = await _flutter.evaluateInFrame('new DateTime.now().year');
expect(res.kind == InstanceKind.kInt && res.valueAsString == DateTime.now().year.toString(), isTrue);
}
Future<void> evaluateComplexReturningExpressions() async {
final DateTime now = DateTime.now();
final VMInstanceRef resp = await _flutter.evaluateExpression('new DateTime.now()');
expect(resp.klass.name, equals('DateTime'));
final InstanceRef resp = await _flutter.evaluateInFrame('new DateTime.now()');
expect(resp.classRef.name, equals('DateTime'));
// Ensure we got a reasonable approximation. The more accurate we try to
// make this, the more likely it'll fail due to differences in the time
// in the remote VM and the local VM at the time the code runs.
final VMStringInstanceRef res = await resp.evaluate(r'"$year-$month-$day"');
expect(res.value,
final InstanceRef res = await _flutter.evaluate(resp.id, r'"$year-$month-$day"');
expect(res.valueAsString,
equals('${now.year}-${now.month}-${now.day}'));
}
......
......@@ -6,7 +6,7 @@ import 'dart:async';
import 'package:file/file.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:vm_service_client/vm_service_client.dart';
import 'package:vm_service_lib/vm_service_lib.dart';
import '../src/common.dart';
import 'test_data/hot_reload_project.dart';
......@@ -55,10 +55,10 @@ void main() {
test('reload hits breakpoints after reload', () async {
await _flutter.run(withDebugger: true);
final VMIsolate isolate = await _flutter.breakAt(
final Isolate isolate = await _flutter.breakAt(
_project.breakpointUri,
_project.breakpointLine);
expect(isolate.pauseEvent, isInstanceOf<VMPauseBreakpointEvent>());
expect(isolate.pauseEvent.kind, equals(EventKind.kPauseBreakpoint));
});
}, timeout: const Timeout.factor(6));
}
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