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
22374517
Unverified
Commit
22374517
authored
Oct 24, 2019
by
Jonah Williams
Committed by
GitHub
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't eagerly call runMain when --start-paused is provided to web application (#42144)
parent
f9314df8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+11
-1
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+24
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
22374517
...
@@ -259,7 +259,17 @@ class ResidentWebRunner extends ResidentRunner {
...
@@ -259,7 +259,17 @@ class ResidentWebRunner extends ResidentRunner {
unawaited
(
_vmService
.
registerService
(
'reloadSources'
,
'FlutterTools'
));
unawaited
(
_vmService
.
registerService
(
'reloadSources'
,
'FlutterTools'
));
websocketUri
=
Uri
.
parse
(
_connectionResult
.
debugConnection
.
uri
);
websocketUri
=
Uri
.
parse
(
_connectionResult
.
debugConnection
.
uri
);
// Always run main after connecting because start paused doesn't work yet.
// Always run main after connecting because start paused doesn't work yet.
_connectionResult
.
appConnection
.
runMain
();
if
(!
debuggingOptions
.
startPaused
||
!
supportsServiceProtocol
)
{
_connectionResult
.
appConnection
.
runMain
();
}
else
{
StreamSubscription
<
void
>
resumeSub
;
resumeSub
=
_connectionResult
.
debugConnection
.
vmService
.
onDebugEvent
.
listen
((
vmservice
.
Event
event
)
{
if
(
event
.
type
==
vmservice
.
EventKind
.
kResume
)
{
_connectionResult
.
appConnection
.
runMain
();
resumeSub
.
cancel
();
}
});
}
}
}
if
(
websocketUri
!=
null
)
{
if
(
websocketUri
!=
null
)
{
printStatus
(
'Debug service listening on
$websocketUri
'
);
printStatus
(
'Debug service listening on
$websocketUri
'
);
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
22374517
...
@@ -83,6 +83,9 @@ void main() {
...
@@ -83,6 +83,9 @@ void main() {
when
(
mockVmService
.
onStdoutEvent
).
thenAnswer
((
Invocation
_
)
{
when
(
mockVmService
.
onStdoutEvent
).
thenAnswer
((
Invocation
_
)
{
return
const
Stream
<
Event
>.
empty
();
return
const
Stream
<
Event
>.
empty
();
});
});
when
(
mockVmService
.
onDebugEvent
).
thenAnswer
((
Invocation
_
)
{
return
const
Stream
<
Event
>.
empty
();
});
when
(
mockDebugConnection
.
uri
).
thenReturn
(
'ws://127.0.0.1/abcd/'
);
when
(
mockDebugConnection
.
uri
).
thenReturn
(
'ws://127.0.0.1/abcd/'
);
}
}
...
@@ -174,6 +177,27 @@ void main() {
...
@@ -174,6 +177,27 @@ void main() {
expect
(
bufferLogger
.
statusText
,
contains
(
'THIS MESSAGE IS IMPORTANT'
));
expect
(
bufferLogger
.
statusText
,
contains
(
'THIS MESSAGE IS IMPORTANT'
));
}));
}));
test
(
'Does not run main with --start-paused'
,
()
=>
testbed
.
run
(()
async
{
residentWebRunner
=
ResidentWebRunner
(
mockWebDevice
,
flutterProject:
FlutterProject
.
current
(),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
startPaused:
true
),
ipv6:
true
,
);
_setupMocks
();
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
final
StreamController
<
Event
>
controller
=
StreamController
<
Event
>.
broadcast
();
when
(
mockVmService
.
onStdoutEvent
).
thenAnswer
((
Invocation
_
)
{
return
controller
.
stream
;
});
unawaited
(
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
));
await
connectionInfoCompleter
.
future
;
verifyNever
(
mockAppConnection
.
runMain
());
}));
test
(
'Can hot reload after attaching'
,
()
=>
testbed
.
run
(()
async
{
test
(
'Can hot reload after attaching'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
_setupMocks
();
final
BufferLogger
bufferLogger
=
logger
;
final
BufferLogger
bufferLogger
=
logger
;
...
...
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