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
7a4d8e19
Unverified
Commit
7a4d8e19
authored
Sep 18, 2020
by
Brian Eaton
Committed by
GitHub
Sep 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure all isolates start during flutter driver tests. (#65703)
parent
4253e42b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
vmservice_driver.dart
packages/flutter_driver/lib/src/driver/vmservice_driver.dart
+15
-1
flutter_driver_test.dart
packages/flutter_driver/test/flutter_driver_test.dart
+22
-1
No files found.
packages/flutter_driver/lib/src/driver/vmservice_driver.dart
View file @
7a4d8e19
...
@@ -131,8 +131,22 @@ class VMServiceFlutterDriver extends FlutterDriver {
...
@@ -131,8 +131,22 @@ class VMServiceFlutterDriver extends FlutterDriver {
// Attempts to resume the isolate, but does not crash if it fails because
// Attempts to resume the isolate, but does not crash if it fails because
// the isolate is already resumed. There could be a race with other tools,
// the isolate is already resumed. There could be a race with other tools,
// such as a debugger, any of which could have resumed the isolate.
// such as a debugger, any of which could have resumed the isolate.
Future
<
dynamic
>
resumeLeniently
()
{
Future
<
dynamic
>
resumeLeniently
()
async
{
_log
(
'Attempting to resume isolate'
);
_log
(
'Attempting to resume isolate'
);
// Let subsequent isolates start automatically.
try
{
final
Map
<
String
,
dynamic
>
result
=
await
connection
.
peer
.
sendRequest
(
'setFlag'
,
<
String
,
String
>{
'name'
:
'pause_isolates_on_start'
,
'value'
:
'false'
,
})
as
Map
<
String
,
dynamic
>;
if
(
result
==
null
||
result
[
'type'
]
!=
'Success'
)
{
_log
(
'setFlag failure:
$result
'
);
}
}
catch
(
e
)
{
_log
(
'Failed to set pause_isolates_on_start=false, proceeding. Error:
$e
'
);
}
return
isolate
.
resume
().
catchError
((
dynamic
e
)
{
return
isolate
.
resume
().
catchError
((
dynamic
e
)
{
const
int
vmMustBePausedCode
=
101
;
const
int
vmMustBePausedCode
=
101
;
if
(
e
is
rpc
.
RpcException
&&
e
.
code
==
vmMustBePausedCode
)
{
if
(
e
is
rpc
.
RpcException
&&
e
.
code
==
vmMustBePausedCode
)
{
...
...
packages/flutter_driver/test/flutter_driver_test.dart
View file @
7a4d8e19
...
@@ -72,6 +72,10 @@ void main() {
...
@@ -72,6 +72,10 @@ void main() {
connectionLog
.
add
(
'streamListen'
);
connectionLog
.
add
(
'streamListen'
);
return
null
;
return
null
;
});
});
when
(
mockPeer
.
sendRequest
(
'setFlag'
,
any
)).
thenAnswer
((
Invocation
invocation
)
{
connectionLog
.
add
(
'setFlag'
);
return
null
;
});
when
(
mockIsolate
.
pauseEvent
).
thenReturn
(
MockVMPauseStartEvent
());
when
(
mockIsolate
.
pauseEvent
).
thenReturn
(
MockVMPauseStartEvent
());
when
(
mockIsolate
.
resume
()).
thenAnswer
((
Invocation
invocation
)
{
when
(
mockIsolate
.
resume
()).
thenAnswer
((
Invocation
invocation
)
{
connectionLog
.
add
(
'resume'
);
connectionLog
.
add
(
'resume'
);
...
@@ -85,9 +89,26 @@ void main() {
...
@@ -85,9 +89,26 @@ void main() {
final
FlutterDriver
driver
=
await
FlutterDriver
.
connect
(
dartVmServiceUrl:
''
);
final
FlutterDriver
driver
=
await
FlutterDriver
.
connect
(
dartVmServiceUrl:
''
);
expect
(
driver
,
isNotNull
);
expect
(
driver
,
isNotNull
);
expectLogContains
(
'Isolate is paused at start'
);
expectLogContains
(
'Isolate is paused at start'
);
expect
(
connectionLog
,
<
String
>[
'resume'
,
'streamListen'
,
'onExtensionAdded'
]);
expect
(
connectionLog
,
<
String
>[
'
setFlag'
,
'
resume'
,
'streamListen'
,
'onExtensionAdded'
]);
});
});
test
(
'ignores setFlag failure'
,
()
async
{
when
(
mockPeer
.
sendRequest
(
'setFlag'
,
any
)).
thenThrow
(
Exception
(
'setFlag failed'
));
when
(
mockIsolate
.
pauseEvent
).
thenReturn
(
MockVMPauseStartEvent
());
when
(
mockIsolate
.
resume
()).
thenAnswer
((
Invocation
invocation
)
{
return
Future
<
dynamic
>.
value
(
null
);
});
when
(
mockIsolate
.
onExtensionAdded
).
thenAnswer
((
Invocation
invocation
)
{
return
Stream
<
String
>.
fromIterable
(<
String
>[
'ext.flutter.driver'
]);
});
final
FlutterDriver
driver
=
await
FlutterDriver
.
connect
(
dartVmServiceUrl:
''
);
expectLogContains
(
'Failed to set pause_isolates_on_start=false, proceeding. '
'Error: Exception: setFlag failed'
);
expect
(
driver
,
isNotNull
);
});
test
(
'connects to isolate paused mid-flight'
,
()
async
{
test
(
'connects to isolate paused mid-flight'
,
()
async
{
when
(
mockIsolate
.
pauseEvent
).
thenReturn
(
MockVMPauseBreakpointEvent
());
when
(
mockIsolate
.
pauseEvent
).
thenReturn
(
MockVMPauseBreakpointEvent
());
when
(
mockIsolate
.
resume
()).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
dynamic
>.
value
(
null
));
when
(
mockIsolate
.
resume
()).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
dynamic
>.
value
(
null
));
...
...
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