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
21fc0c3a
Unverified
Commit
21fc0c3a
authored
Jun 24, 2021
by
Jonah Williams
Committed by
GitHub
Jun 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove online requirement for devtools (#85176)
parent
2b9fdada
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
22 deletions
+103
-22
devtools_launcher.dart
packages/flutter_tools/lib/src/devtools_launcher.dart
+10
-16
devtools_launcher_test.dart
...tter_tools/test/general.shard/devtools_launcher_test.dart
+93
-6
No files found.
packages/flutter_tools/lib/src/devtools_launcher.dart
View file @
21fc0c3a
...
...
@@ -94,23 +94,17 @@ class DevtoolsServerLauncher extends DevtoolsLauncher {
);
}
if
(
offline
)
{
// TODO(kenz): we should launch an already activated version of DevTools
// here, if available, once DevTools has offline support. DevTools does
// not work without internet currently due to the failed request of a
// couple scripts. See https://github.com/flutter/devtools/issues/2420.
return
;
}
else
{
bool
devToolsActive
=
await
_checkForActiveDevTools
();
bool
devToolsActive
=
await
_checkForActiveDevTools
();
if
(!
offline
)
{
await
_activateDevTools
(
throttleUpdates:
devToolsActive
);
if
(!
devToolsActive
)
{
devToolsActive
=
await
_checkForActiveDevTools
();
}
if
(!
devToolsActive
)
{
// We don't have devtools installed and installing it failed;
// _activateDevTools will have reported the error already.
return
;
}
}
if
(!
devToolsActive
&&
!
offline
)
{
devToolsActive
=
await
_checkForActiveDevTools
();
}
if
(!
devToolsActive
)
{
// We don't have devtools installed and installing it failed;
// _activateDevTools will have reported the error already.
return
;
}
_devToolsProcess
=
await
_processManager
.
start
(<
String
>[
...
...
packages/flutter_tools/test/general.shard/devtools_launcher_test.dart
View file @
21fc0c3a
...
...
@@ -35,7 +35,7 @@ void main() {
);
});
testWithoutContext
(
'DevtoolsLauncher does not launch devtools if unable to reach pub.dev'
,
()
async
{
testWithoutContext
(
'DevtoolsLauncher does not launch devtools if unable to reach pub.dev
and there is no activated package
'
,
()
async
{
final
DevtoolsLauncher
launcher
=
DevtoolsServerLauncher
(
pubExecutable:
'pub'
,
logger:
logger
,
...
...
@@ -48,13 +48,64 @@ void main() {
response:
const
FakeResponse
(
statusCode:
HttpStatus
.
internalServerError
),
),
]),
processManager:
FakeProcessManager
.
empty
(),
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'pub'
,
'global'
,
'list'
,
],
stdout:
'foobar 0.9.6'
,
),
]),
);
final
DevToolsServerAddress
address
=
await
launcher
.
serve
();
expect
(
address
,
isNull
);
});
testWithoutContext
(
'DevtoolsLauncher launches devtools if unable to reach pub.dev but there is an activated package'
,
()
async
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
DevtoolsLauncher
launcher
=
DevtoolsServerLauncher
(
pubExecutable:
'pub'
,
logger:
logger
,
platform:
platform
,
persistentToolState:
persistentToolState
,
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
https
(
'pub.dev'
,
''
),
method:
HttpMethod
.
head
,
response:
const
FakeResponse
(
statusCode:
HttpStatus
.
internalServerError
),
),
]),
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'pub'
,
'global'
,
'list'
,
],
stdout:
'devtools 0.9.6'
,
),
FakeCommand
(
command:
const
<
String
>[
'pub'
,
'global'
,
'run'
,
'devtools'
,
'--no-launch-browser'
,
],
stdout:
'Serving DevTools at http://127.0.0.1:9100
\n
'
,
completer:
completer
,
),
]),
);
final
DevToolsServerAddress
address
=
await
launcher
.
serve
();
expect
(
address
.
host
,
'127.0.0.1'
);
expect
(
address
.
port
,
9100
);
});
testWithoutContext
(
'DevtoolsLauncher pings PUB_HOSTED_URL instead of pub.dev for online check'
,
()
async
{
final
DevtoolsLauncher
launcher
=
DevtoolsServerLauncher
(
pubExecutable:
'pub'
,
...
...
@@ -70,7 +121,16 @@ void main() {
response:
const
FakeResponse
(
statusCode:
HttpStatus
.
internalServerError
),
),
]),
processManager:
FakeProcessManager
.
empty
(),
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'pub'
,
'global'
,
'list'
,
],
stdout:
'foobar 0.9.6'
,
),
]),
);
final
DevToolsServerAddress
address
=
await
launcher
.
serve
();
...
...
@@ -86,7 +146,16 @@ void main() {
}),
persistentToolState:
persistentToolState
,
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[]),
processManager:
FakeProcessManager
.
empty
(),
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'pub'
,
'global'
,
'list'
,
],
stdout:
'foobar 0.9.6'
,
),
]),
);
final
DevToolsServerAddress
address
=
await
launcher
.
serve
();
...
...
@@ -416,7 +485,16 @@ void main() {
responseError:
Exception
(
'Connection failed.'
),
),
]),
processManager:
FakeProcessManager
.
empty
(),
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'pub'
,
'global'
,
'list'
,
],
stdout:
'foobar 0.9.6'
,
),
]),
);
await
launcher
.
launch
(
Uri
.
parse
(
'http://127.0.0.1:1234/abcdefg'
));
...
...
@@ -439,7 +517,16 @@ void main() {
),
),
]),
processManager:
FakeProcessManager
.
empty
(),
processManager:
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'pub'
,
'global'
,
'list'
,
],
stdout:
'foobar 0.9.6'
,
),
]),
);
await
launcher
.
launch
(
Uri
.
parse
(
'http://127.0.0.1:1234/abcdefg'
));
...
...
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