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 {
...
@@ -113,9 +113,18 @@ class ResidentWebRunner extends ResidentRunner {
await
_stdOutSub
?.
cancel
();
await
_stdOutSub
?.
cancel
();
await
_webFs
?.
stop
();
await
_webFs
?.
stop
();
await
device
.
stopApp
(
null
);
await
device
.
stopApp
(
null
);
if
(
ChromeLauncher
.
hasChromeInstance
)
{
final
Chrome
chrome
=
await
ChromeLauncher
.
connectedInstance
;
await
chrome
.
close
();
}
_exited
=
true
;
_exited
=
true
;
}
}
Future
<
void
>
_cleanupAndExit
()
async
{
await
_cleanup
();
appFinished
();
}
@override
@override
void
printHelp
({
bool
details
=
true
})
{
void
printHelp
({
bool
details
=
true
})
{
if
(
details
)
{
if
(
details
)
{
...
@@ -201,7 +210,7 @@ class ResidentWebRunner extends ResidentRunner {
...
@@ -201,7 +210,7 @@ class ResidentWebRunner extends ResidentRunner {
);
);
if
(
supportsServiceProtocol
)
{
if
(
supportsServiceProtocol
)
{
_connectionResult
=
await
_webFs
.
connect
(
debuggingOptions
);
_connectionResult
=
await
_webFs
.
connect
(
debuggingOptions
);
unawaited
(
_connectionResult
.
debugConnection
.
onDone
.
whenComplete
(
()
=>
exit
(
0
)
));
unawaited
(
_connectionResult
.
debugConnection
.
onDone
.
whenComplete
(
_cleanupAndExit
));
}
}
if
(
statusActive
)
{
if
(
statusActive
)
{
buildStatus
.
stop
();
buildStatus
.
stop
();
...
...
packages/flutter_tools/lib/src/web/chrome.dart
View file @
d983c1d1
...
@@ -69,6 +69,8 @@ String findChromeExecutable() {
...
@@ -69,6 +69,8 @@ String findChromeExecutable() {
class
ChromeLauncher
{
class
ChromeLauncher
{
const
ChromeLauncher
();
const
ChromeLauncher
();
static
bool
get
hasChromeInstance
=>
_currentCompleter
.
isCompleted
;
static
final
Completer
<
Chrome
>
_currentCompleter
=
Completer
<
Chrome
>();
static
final
Completer
<
Chrome
>
_currentCompleter
=
Completer
<
Chrome
>();
/// Whether we can locate the chrome executable.
/// 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() {
...
@@ -532,6 +532,23 @@ void main() {
verifyNever
(
mockDebugConnection
.
close
());
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
{
test
(
'Prints target and device name on run'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
_setupMocks
();
when
(
mockWebDevice
.
name
).
thenReturn
(
'Chromez'
);
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