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