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
6db3d61e
Unverified
Commit
6db3d61e
authored
Feb 11, 2021
by
Wyte Krongapiradee
Committed by
GitHub
Feb 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(flutter_driver): Properly declare socket as nullable (#75769)
parent
e7953b3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
vmservice_driver.dart
packages/flutter_driver/lib/src/driver/vmservice_driver.dart
+3
-3
flutter_driver_test.dart
...utter_driver/test/src/real_tests/flutter_driver_test.dart
+13
-0
No files found.
packages/flutter_driver/lib/src/driver/vmservice_driver.dart
View file @
6db3d61e
...
...
@@ -561,7 +561,7 @@ String _getWebSocketUrl(String url) {
Future
<
vms
.
VmService
>
_waitAndConnect
(
String
url
,
Map
<
String
,
dynamic
>?
headers
)
async
{
final
String
webSocketUrl
=
_getWebSocketUrl
(
url
);
int
attempts
=
0
;
late
WebSocket
socket
;
WebSocket
?
socket
;
while
(
true
)
{
try
{
socket
=
await
WebSocket
.
connect
(
webSocketUrl
,
headers:
headers
);
...
...
@@ -575,7 +575,7 @@ Future<vms.VmService> _waitAndConnect(String url, Map<String, dynamic>? headers)
controller
.
stream
,
socket
.
add
,
log:
null
,
disposeHandler:
()
=>
socket
.
close
(),
disposeHandler:
()
=>
socket
!
.
close
(),
streamClosed:
streamClosedCompleter
.
future
);
// This call is to ensure we are able to establish a connection instead of
...
...
@@ -583,7 +583,7 @@ Future<vms.VmService> _waitAndConnect(String url, Map<String, dynamic>? headers)
await
service
.
getVersion
();
return
service
;
}
catch
(
e
)
{
await
socket
.
close
();
await
socket
?
.
close
();
if
(
attempts
>
5
)
{
_log
(
'It is taking an unusually long time to connect to the VM...'
);
}
...
...
packages/flutter_driver/test/src/real_tests/flutter_driver_test.dart
View file @
6db3d61e
...
...
@@ -52,6 +52,19 @@ void main() {
restoreVmServiceConnectFunction
();
});
test
(
'Retries while Dart VM service is not available'
,
()
async
{
// This test case will test the real implementation of `_waitAndConnect`.
restoreVmServiceConnectFunction
();
// The actual behavior is to retry indefinitely until the Dart VM service
// becomes available. `.timeout` is used here to exit the infinite loop,
// expecting that no other types of error are thrown during the process.
expect
(
vmServiceConnectFunction
(
'http://foo.bar'
,
<
String
,
dynamic
>{})
.
timeout
(
const
Duration
(
seconds:
1
)),
throwsA
(
isA
<
TimeoutException
>()),
);
});
test
(
'throws after retries if no isolate'
,
()
async
{
fakeVM
.
numberOfTriesBeforeResolvingIsolate
=
10000
;
...
...
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