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
4ee618bb
Unverified
Commit
4ee618bb
authored
Apr 16, 2020
by
Jonah Williams
Committed by
GitHub
Apr 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] don't elapse real time during fallback test (#54717)
parent
e6abda7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
fallback_discovery.dart
packages/flutter_tools/lib/src/ios/fallback_discovery.dart
+9
-5
fallback_discovery_test.dart
...tools/test/general.shard/ios/fallback_discovery_test.dart
+1
-0
No files found.
packages/flutter_tools/lib/src/ios/fallback_discovery.dart
View file @
4ee618bb
...
...
@@ -13,6 +13,8 @@ import '../mdns_discovery.dart';
import
'../protocol_discovery.dart'
;
import
'../reporting/reporting.dart'
;
typedef
VmServiceConnector
=
Future
<
VmService
>
Function
(
String
,
{
Log
log
});
/// A protocol for discovery of a vmservice on an attached iOS device with
/// multiple fallbacks.
///
...
...
@@ -42,14 +44,16 @@ class FallbackDiscovery {
@required
Logger
logger
,
@required
ProtocolDiscovery
protocolDiscovery
,
@required
Usage
flutterUsage
,
Future
<
VmService
>
Function
(
String
wsUri
,
{
Log
log
})
vmServiceConnectUri
=
VmServiceConnector
vmServiceConnectUri
=
vm_service_io
.
vmServiceConnectUri
,
Duration
pollingDelay
=
const
Duration
(
seconds:
2
),
})
:
_logger
=
logger
,
_mDnsObservatoryDiscovery
=
mDnsObservatoryDiscovery
,
_portForwarder
=
portForwarder
,
_protocolDiscovery
=
protocolDiscovery
,
_flutterUsage
=
flutterUsage
,
_vmServiceConnectUri
=
vmServiceConnectUri
;
_vmServiceConnectUri
=
vmServiceConnectUri
,
_pollingDelay
=
pollingDelay
;
static
const
String
_kEventName
=
'ios-handshake'
;
...
...
@@ -58,7 +62,8 @@ class FallbackDiscovery {
final
Logger
_logger
;
final
ProtocolDiscovery
_protocolDiscovery
;
final
Usage
_flutterUsage
;
final
Future
<
VmService
>
Function
(
String
wsUri
,
{
Log
log
})
_vmServiceConnectUri
;
final
VmServiceConnector
_vmServiceConnectUri
;
final
Duration
_pollingDelay
;
/// Attempt to discover the observatory port.
Future
<
Uri
>
discover
({
...
...
@@ -152,7 +157,6 @@ class FallbackDiscovery {
// Attempt to connect to the VM service 5 times.
int
attempts
=
0
;
const
int
kDelaySeconds
=
2
;
Exception
firstException
;
while
(
attempts
<
5
)
{
try
{
...
...
@@ -184,7 +188,7 @@ class FallbackDiscovery {
// tool waits for a connection to be reasonable. If the vmservice cannot
// be connected to in this way, the mDNS discovery must be reached
// sooner rather than later.
await
Future
<
void
>.
delayed
(
const
Duration
(
seconds:
kDelaySeconds
)
);
await
Future
<
void
>.
delayed
(
_pollingDelay
);
attempts
+=
1
;
}
_logger
.
printTrace
(
'Failed to connect directly, falling back to mDNS'
);
...
...
packages/flutter_tools/test/general.shard/ios/fallback_discovery_test.dart
View file @
4ee618bb
...
...
@@ -42,6 +42,7 @@ void main() {
vmServiceConnectUri:
(
String
uri
,
{
Log
log
})
async
{
return
mockVmService
;
},
pollingDelay:
Duration
.
zero
,
);
when
(
mockPortForwarder
.
forward
(
23
,
hostPort:
anyNamed
(
'hostPort'
)))
.
thenAnswer
((
Invocation
invocation
)
async
=>
1
);
...
...
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