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
d983c1d1
Unverified
Commit
d983c1d1
authored
Oct 28, 2019
by
Jonah Williams
Committed by
GitHub
Oct 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure Chrome is closed on tab close (#43586)
parent
c31cd071
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+10
-1
chrome.dart
packages/flutter_tools/lib/src/web/chrome.dart
+2
-0
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+17
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
d983c1d1
...
...
@@ -113,9 +113,18 @@ class ResidentWebRunner extends ResidentRunner {
await
_stdOutSub
?.
cancel
();
await
_webFs
?.
stop
();
await
device
.
stopApp
(
null
);
if
(
ChromeLauncher
.
hasChromeInstance
)
{
final
Chrome
chrome
=
await
ChromeLauncher
.
connectedInstance
;
await
chrome
.
close
();
}
_exited
=
true
;
}
Future
<
void
>
_cleanupAndExit
()
async
{
await
_cleanup
();
appFinished
();
}
@override
void
printHelp
({
bool
details
=
true
})
{
if
(
details
)
{
...
...
@@ -201,7 +210,7 @@ class ResidentWebRunner extends ResidentRunner {
);
if
(
supportsServiceProtocol
)
{
_connectionResult
=
await
_webFs
.
connect
(
debuggingOptions
);
unawaited
(
_connectionResult
.
debugConnection
.
onDone
.
whenComplete
(
()
=>
exit
(
0
)
));
unawaited
(
_connectionResult
.
debugConnection
.
onDone
.
whenComplete
(
_cleanupAndExit
));
}
if
(
statusActive
)
{
buildStatus
.
stop
();
...
...
packages/flutter_tools/lib/src/web/chrome.dart
View file @
d983c1d1
...
...
@@ -69,6 +69,8 @@ String findChromeExecutable() {
class
ChromeLauncher
{
const
ChromeLauncher
();
static
bool
get
hasChromeInstance
=>
_currentCompleter
.
isCompleted
;
static
final
Completer
<
Chrome
>
_currentCompleter
=
Completer
<
Chrome
>();
/// Whether we can locate the chrome executable.
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
d983c1d1
...
...
@@ -532,6 +532,23 @@ void main() {
verifyNever
(
mockDebugConnection
.
close
());
}));
test
(
'cleans up Chrome if tab is closed'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
final
Completer
<
void
>
onDone
=
Completer
<
void
>();
when
(
mockDebugConnection
.
onDone
).
thenAnswer
((
Invocation
invocation
)
{
return
onDone
.
future
;
});
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
final
Future
<
int
>
result
=
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
);
await
connectionInfoCompleter
.
future
;
onDone
.
complete
();
await
result
;
verify
(
mockWebFs
.
stop
()).
called
(
1
);
}));
test
(
'Prints target and device name on run'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
when
(
mockWebDevice
.
name
).
thenReturn
(
'Chromez'
);
...
...
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