Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6d1938e6
Unverified
Commit
6d1938e6
authored
Dec 15, 2021
by
嘟囔
Committed by
GitHub
Dec 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate integration.shard/vmservice_integration_test.dart to null safety (#92812)
parent
8b70641c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
vmservice_integration_test.dart
...ls/test/integration.shard/vmservice_integration_test.dart
+19
-20
No files found.
packages/flutter_tools/test/integration.shard/vmservice_integration_test.dart
View file @
6d1938e6
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/file.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:vm_service/vm_service.dart'
;
...
...
@@ -16,9 +14,9 @@ import 'test_utils.dart';
void
main
(
)
{
group
(
'Flutter Tool VMService method'
,
()
{
Directory
tempDir
;
FlutterRunTestDriver
flutter
;
VmService
vmService
;
late
Directory
tempDir
;
late
FlutterRunTestDriver
flutter
;
late
VmService
vmService
;
setUp
(()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'vmservice_integration_test.'
);
...
...
@@ -28,12 +26,13 @@ void main() {
flutter
=
FlutterRunTestDriver
(
tempDir
);
await
flutter
.
run
(
withDebugger:
true
);
final
int
port
=
flutter
.
vmServicePort
;
final
int
?
port
=
flutter
.
vmServicePort
;
expect
(
port
!=
null
,
true
);
vmService
=
await
vmServiceConnectUri
(
'ws://localhost:
$port
/ws'
);
});
tearDown
(()
async
{
await
flutter
?
.
stop
();
await
flutter
.
stop
();
tryToDelete
(
tempDir
);
});
...
...
@@ -41,7 +40,7 @@ void main() {
final
ProtocolList
protocolList
=
await
vmService
.
getSupportedProtocols
();
expect
(
protocolList
.
protocols
,
hasLength
(
2
));
for
(
final
Protocol
protocol
in
protocolList
.
protocols
)
{
for
(
final
Protocol
protocol
in
protocolList
.
protocols
!
)
{
expect
(
protocol
.
protocolName
,
anyOf
(
'VM Service'
,
'DDS'
));
}
});
...
...
@@ -62,10 +61,10 @@ void main() {
testWithoutContext
(
'reloadSources can be called'
,
()
async
{
final
VM
vm
=
await
vmService
.
getVM
();
final
IsolateRef
isolateRef
=
vm
.
isolates
.
first
;
final
IsolateRef
?
isolateRef
=
vm
.
isolates
?
.
first
;
expect
(
isolateRef
!=
null
,
true
);
final
Response
response
=
await
vmService
.
callMethod
(
's0.reloadSources'
,
isolateId:
isolateRef
.
id
);
isolateId:
isolateRef
!
.
id
);
expect
(
response
.
type
,
'Success'
);
});
...
...
@@ -77,10 +76,10 @@ void main() {
testWithoutContext
(
'hotRestart can be called'
,
()
async
{
final
VM
vm
=
await
vmService
.
getVM
();
final
IsolateRef
isolateRef
=
vm
.
isolates
.
first
;
final
IsolateRef
?
isolateRef
=
vm
.
isolates
?
.
first
;
expect
(
isolateRef
!=
null
,
true
);
final
Response
response
=
await
vmService
.
callMethod
(
's0.hotRestart'
,
isolateId:
isolateRef
.
id
);
await
vmService
.
callMethod
(
's0.hotRestart'
,
isolateId:
isolateRef
!
.
id
);
expect
(
response
.
type
,
'Success'
);
});
...
...
@@ -102,7 +101,7 @@ void main() {
'ext.flutter.brightnessOverride'
,
isolateId:
isolate
.
id
,
);
expect
(
response
.
json
[
'value'
],
'Brightness.light'
);
expect
(
response
.
json
?
[
'value'
],
'Brightness.light'
);
final
Response
updateResponse
=
await
vmService
.
callServiceExtension
(
'ext.flutter.brightnessOverride'
,
...
...
@@ -111,7 +110,7 @@ void main() {
'value'
:
'Brightness.dark'
,
}
);
expect
(
updateResponse
.
json
[
'value'
],
'Brightness.dark'
);
expect
(
updateResponse
.
json
?
[
'value'
],
'Brightness.dark'
);
// Change the brightness back to light
final
Response
verifyResponse
=
await
vmService
.
callServiceExtension
(
...
...
@@ -121,7 +120,7 @@ void main() {
'value'
:
'Brightness.light'
,
}
);
expect
(
verifyResponse
.
json
[
'value'
],
'Brightness.light'
);
expect
(
verifyResponse
.
json
?
[
'value'
],
'Brightness.light'
);
// Change with a bogus value
final
Response
bogusResponse
=
await
vmService
.
callServiceExtension
(
...
...
@@ -131,7 +130,7 @@ void main() {
'value'
:
'dark'
,
// Intentionally invalid value.
}
);
expect
(
bogusResponse
.
json
[
'value'
],
'Brightness.light'
);
expect
(
bogusResponse
.
json
?
[
'value'
],
'Brightness.light'
);
});
testWithoutContext
(
'ext.flutter.debugPaint can toggle debug painting'
,
()
async
{
...
...
@@ -140,7 +139,7 @@ void main() {
'ext.flutter.debugPaint'
,
isolateId:
isolate
.
id
,
);
expect
(
response
.
json
[
'enabled'
],
'false'
);
expect
(
response
.
json
?
[
'enabled'
],
'false'
);
final
Response
updateResponse
=
await
vmService
.
callServiceExtension
(
'ext.flutter.debugPaint'
,
...
...
@@ -149,7 +148,7 @@ void main() {
'enabled'
:
'true'
,
}
);
expect
(
updateResponse
.
json
[
'enabled'
],
'true'
);
expect
(
updateResponse
.
json
?
[
'enabled'
],
'true'
);
});
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment