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
942de678
Unverified
Commit
942de678
authored
Jan 27, 2022
by
Danny Tuppeny
Committed by
GitHub
Jan 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make remaining DAP tests null-safe (#97368)
parent
dcce0db1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
25 deletions
+21
-25
flutter_adapter_test.dart
...integration.shard/debug_adapter/flutter_adapter_test.dart
+16
-18
test_adapter_test.dart
...st/integration.shard/debug_adapter/test_adapter_test.dart
+5
-7
No files found.
packages/flutter_tools/test/integration.shard/debug_adapter/flutter_adapter_test.dart
View file @
942de678
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:async'
;
import
'package:dds/src/dap/protocol_generated.dart'
;
import
'package:dds/src/dap/protocol_generated.dart'
;
...
@@ -18,8 +16,8 @@ import 'test_client.dart';
...
@@ -18,8 +16,8 @@ import 'test_client.dart';
import
'test_support.dart'
;
import
'test_support.dart'
;
void
main
(
)
{
void
main
(
)
{
Directory
tempDir
;
late
Directory
tempDir
;
/*late*/
DapTestSession
dap
;
late
DapTestSession
dap
;
final
String
relativeMainPath
=
'lib
${fileSystem.path.separator}
main.dart'
;
final
String
relativeMainPath
=
'lib
${fileSystem.path.separator}
main.dart'
;
setUpAll
(()
{
setUpAll
(()
{
...
@@ -119,7 +117,7 @@ void main() {
...
@@ -119,7 +117,7 @@ void main() {
await
project
.
setUpIn
(
tempDir
);
await
project
.
setUpIn
(
tempDir
);
// Launch the app and wait for it to print "topLevelFunction".
// Launch the app and wait for it to print "topLevelFunction".
await
Future
.
wait
(<
Future
<
Object
>>[
await
Future
.
wait
(<
Future
<
void
>>[
dap
.
client
.
outputEvents
.
firstWhere
((
OutputEventBody
output
)
=>
output
.
output
.
startsWith
(
'topLevelFunction'
)),
dap
.
client
.
outputEvents
.
firstWhere
((
OutputEventBody
output
)
=>
output
.
output
.
startsWith
(
'topLevelFunction'
)),
dap
.
client
.
start
(
dap
.
client
.
start
(
launch:
()
=>
dap
.
client
.
launch
(
launch:
()
=>
dap
.
client
.
launch
(
...
@@ -156,7 +154,7 @@ void main() {
...
@@ -156,7 +154,7 @@ void main() {
await
project
.
setUpIn
(
tempDir
);
await
project
.
setUpIn
(
tempDir
);
// Launch the app and wait for it to print "topLevelFunction".
// Launch the app and wait for it to print "topLevelFunction".
await
Future
.
wait
(<
Future
<
Object
>>[
await
Future
.
wait
(<
Future
<
void
>>[
dap
.
client
.
outputEvents
.
firstWhere
((
OutputEventBody
output
)
=>
output
.
output
.
startsWith
(
'topLevelFunction'
)),
dap
.
client
.
outputEvents
.
firstWhere
((
OutputEventBody
output
)
=>
output
.
output
.
startsWith
(
'topLevelFunction'
)),
dap
.
client
.
start
(
dap
.
client
.
start
(
launch:
()
=>
dap
.
client
.
launch
(
launch:
()
=>
dap
.
client
.
launch
(
...
@@ -193,10 +191,10 @@ void main() {
...
@@ -193,10 +191,10 @@ void main() {
await
project
.
setUpIn
(
tempDir
);
await
project
.
setUpIn
(
tempDir
);
// Launch the app and wait for it to stop at an exception.
// Launch the app and wait for it to stop at an exception.
int
originalThreadId
,
newThreadId
;
late
int
originalThreadId
,
newThreadId
;
await
Future
.
wait
(<
Future
<
Object
>>[
await
Future
.
wait
(<
Future
<
void
>>[
// Capture the thread ID of the stopped thread.
// Capture the thread ID of the stopped thread.
dap
.
client
.
stoppedEvents
.
first
.
then
((
StoppedEventBody
event
)
=>
originalThreadId
=
event
.
threadId
),
dap
.
client
.
stoppedEvents
.
first
.
then
((
StoppedEventBody
event
)
=>
originalThreadId
=
event
.
threadId
!
),
dap
.
client
.
start
(
dap
.
client
.
start
(
exceptionPauseMode:
'All'
,
// Ensure we stop on all exceptions
exceptionPauseMode:
'All'
,
// Ensure we stop on all exceptions
launch:
()
=>
dap
.
client
.
launch
(
launch:
()
=>
dap
.
client
.
launch
(
...
@@ -208,9 +206,9 @@ void main() {
...
@@ -208,9 +206,9 @@ void main() {
// Hot restart, ensuring it completes and capturing the ID of the new thread
// Hot restart, ensuring it completes and capturing the ID of the new thread
// to pause.
// to pause.
await
Future
.
wait
(<
Future
<
Object
>>[
await
Future
.
wait
(<
Future
<
void
>>[
// Capture the thread ID of the newly stopped thread.
// Capture the thread ID of the newly stopped thread.
dap
.
client
.
stoppedEvents
.
first
.
then
((
StoppedEventBody
event
)
=>
newThreadId
=
event
.
threadId
),
dap
.
client
.
stoppedEvents
.
first
.
then
((
StoppedEventBody
event
)
=>
newThreadId
=
event
.
threadId
!
),
dap
.
client
.
hotRestart
(),
dap
.
client
.
hotRestart
(),
],
eagerError:
true
);
],
eagerError:
true
);
...
@@ -230,11 +228,11 @@ void main() {
...
@@ -230,11 +228,11 @@ void main() {
// extension loads, as we'll need that to call it later.
// extension loads, as we'll need that to call it later.
final
Future
<
String
>
isolateIdForDebugPaint
=
dap
.
client
final
Future
<
String
>
isolateIdForDebugPaint
=
dap
.
client
.
serviceExtensionAdded
(
debugPaintRpc
)
.
serviceExtensionAdded
(
debugPaintRpc
)
.
then
((
Map
<
String
,
Object
/*?*/
>
body
)
=>
body
[
'isolateId'
]
as
String
);
.
then
((
Map
<
String
,
Object
?>
body
)
=>
body
[
'isolateId'
]!
as
String
);
// Launch the app and wait for it to print "topLevelFunction" so we know
// Launch the app and wait for it to print "topLevelFunction" so we know
// it's up and running.
// it's up and running.
await
Future
.
wait
(<
Future
<
Object
>>[
await
Future
.
wait
(<
Future
<
void
>>[
dap
.
client
.
outputEvents
.
firstWhere
((
OutputEventBody
output
)
=>
dap
.
client
.
outputEvents
.
firstWhere
((
OutputEventBody
output
)
=>
output
.
output
.
startsWith
(
'topLevelFunction'
)),
output
.
output
.
startsWith
(
'topLevelFunction'
)),
dap
.
client
.
start
(
dap
.
client
.
start
(
...
@@ -247,15 +245,15 @@ void main() {
...
@@ -247,15 +245,15 @@ void main() {
// Capture the next relevant state-change event (which should occur as a
// Capture the next relevant state-change event (which should occur as a
// result of the call below).
// result of the call below).
final
Future
<
Map
<
String
,
Object
/*?*/
>>
stateChangeEventFuture
=
final
Future
<
Map
<
String
,
Object
?
>>
stateChangeEventFuture
=
dap
.
client
.
serviceExtensionStateChanged
(
debugPaintRpc
);
dap
.
client
.
serviceExtensionStateChanged
(
debugPaintRpc
);
// Enable debug paint to trigger the state change.
// Enable debug paint to trigger the state change.
await
dap
.
client
.
custom
(
await
dap
.
client
.
custom
(
'callService'
,
'callService'
,
<
String
,
Object
/*?*/
>{
<
String
,
Object
?
>{
'method'
:
debugPaintRpc
,
'method'
:
debugPaintRpc
,
'params'
:
<
String
,
Object
/*?*/
>{
'params'
:
<
String
,
Object
?
>{
'enabled'
:
true
,
'enabled'
:
true
,
'isolateId'
:
await
isolateIdForDebugPaint
,
'isolateId'
:
await
isolateIdForDebugPaint
,
},
},
...
@@ -263,7 +261,7 @@ void main() {
...
@@ -263,7 +261,7 @@ void main() {
);
);
// Ensure the event occurred, and its value was as expected.
// Ensure the event occurred, and its value was as expected.
final
Map
<
String
,
Object
/*?*/
>
stateChangeEvent
=
await
stateChangeEventFuture
;
final
Map
<
String
,
Object
?
>
stateChangeEvent
=
await
stateChangeEventFuture
;
expect
(
stateChangeEvent
[
'value'
],
'true'
);
// extension state change values are always strings
expect
(
stateChangeEvent
[
'value'
],
'true'
);
// extension state change values are always strings
await
dap
.
client
.
terminate
();
await
dap
.
client
.
terminate
();
...
@@ -273,7 +271,7 @@ void main() {
...
@@ -273,7 +271,7 @@ void main() {
/// Extracts the output from a set of [OutputEventBody], removing any
/// Extracts the output from a set of [OutputEventBody], removing any
/// adjacent duplicates and combining into a single string.
/// adjacent duplicates and combining into a single string.
String
_uniqueOutputLines
(
List
<
OutputEventBody
>
outputEvents
)
{
String
_uniqueOutputLines
(
List
<
OutputEventBody
>
outputEvents
)
{
String
/*?*/
lastItem
;
String
?
lastItem
;
return
outputEvents
return
outputEvents
.
map
((
OutputEventBody
e
)
=>
e
.
output
)
.
map
((
OutputEventBody
e
)
=>
e
.
output
)
.
where
((
String
output
)
{
.
where
((
String
output
)
{
...
...
packages/flutter_tools/test/integration.shard/debug_adapter/test_adapter_test.dart
View file @
942de678
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:dds/src/dap/protocol_generated.dart'
;
import
'package:dds/src/dap/protocol_generated.dart'
;
import
'package:file/file.dart'
;
import
'package:file/file.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
...
@@ -15,8 +13,8 @@ import 'test_client.dart';
...
@@ -15,8 +13,8 @@ import 'test_client.dart';
import
'test_support.dart'
;
import
'test_support.dart'
;
void
main
(
)
{
void
main
(
)
{
Directory
tempDir
;
late
Directory
tempDir
;
/*late*/
DapTestSession
dap
;
late
DapTestSession
dap
;
setUpAll
(()
{
setUpAll
(()
{
Cache
.
flutterRoot
=
getFlutterRoot
();
Cache
.
flutterRoot
=
getFlutterRoot
();
...
@@ -107,8 +105,8 @@ void main() {
...
@@ -107,8 +105,8 @@ void main() {
);
);
final
List
<
Object
>
testsNames
=
outputEvents
.
testNotifications
final
List
<
Object
>
testsNames
=
outputEvents
.
testNotifications
.
where
((
Map
<
String
,
Object
>
/*?*/
e
)
=>
e
[
'type'
]
==
'testStart'
)
.
where
((
Map
<
String
,
Object
?>
e
)
=>
e
[
'type'
]
==
'testStart'
)
.
map
((
Map
<
String
,
Object
>
/*?*/
e
)
=>
(
e
[
'test'
]
as
Map
<
String
,
Object
/*?*/
>)[
'name'
]
)
.
map
((
Map
<
String
,
Object
?>
e
)
=>
(
e
[
'test'
]!
as
Map
<
String
,
Object
?>)[
'name'
]!
)
.
toList
();
.
toList
();
expect
(
testsNames
,
contains
(
'Flutter tests can pass'
));
expect
(
testsNames
,
contains
(
'Flutter tests can pass'
));
...
@@ -140,7 +138,7 @@ void _expectStandardTestsProjectResults(TestEvents events) {
...
@@ -140,7 +138,7 @@ void _expectStandardTestsProjectResults(TestEvents events) {
// Check we recieved all expected test events passed through from
// Check we recieved all expected test events passed through from
// package:test.
// package:test.
final
List
<
Object
>
eventNames
=
final
List
<
Object
>
eventNames
=
events
.
testNotifications
.
map
((
Map
<
String
,
Object
/*?*/
>
e
)
=>
e
[
'type'
]
).
toList
();
events
.
testNotifications
.
map
((
Map
<
String
,
Object
?>
e
)
=>
e
[
'type'
]!
).
toList
();
// start/done should always be first/last.
// start/done should always be first/last.
expect
(
eventNames
.
first
,
equals
(
'start'
));
expect
(
eventNames
.
first
,
equals
(
'start'
));
...
...
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