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
91c342e2
Unverified
Commit
91c342e2
authored
Feb 06, 2020
by
Jonah Williams
Committed by
GitHub
Feb 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] force page refresh when hot restarting in profile/release mode (#50215)
parent
e300c1a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+12
-3
resident_web_runner_cold_test.dart
...ols/test/general.shard/resident_web_runner_cold_test.dart
+40
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
91c342e2
...
...
@@ -453,8 +453,12 @@ class _ExperimentalResidentWebRunner extends ResidentWebRunner {
.
join
(
','
);
try
{
if
(
fullRestart
)
{
await
_wipConnection
?.
sendCommand
(
'Page.reload'
);
if
(
fullRestart
||
!
debuggingOptions
.
buildInfo
.
isDebug
)
{
// On non-debug builds, a hard refresh is required to ensure the
// up to date sources are loaded.
await
_wipConnection
?.
sendCommand
(
'Page.reload'
,
<
String
,
Object
>{
'ignoreCache'
:
!
debuggingOptions
.
buildInfo
.
isDebug
,
});
}
else
{
await
_wipConnection
?.
debugger
?.
sendCommand
(
'Runtime.evaluate'
,
params:
<
String
,
Object
>{
...
...
@@ -808,10 +812,15 @@ class _DwdsResidentWebRunner extends ResidentWebRunner {
return
chromeTab
.
url
.
contains
(
debuggingOptions
.
hostname
);
});
final
WipConnection
wipConnection
=
await
chromeTab
.
connect
();
await
wipConnection
.
sendCommand
(
'Page.reload'
);
// On non-debug builds, a hard refresh is required to ensure the
// up to date sources are loaded.
await
wipConnection
?.
sendCommand
(
'Page.reload'
,
<
String
,
Object
>{
'ignoreCache'
:
!
debuggingOptions
.
buildInfo
.
isDebug
,
});
status
.
stop
();
return
OperationResult
.
ok
;
}
catch
(
err
)
{
globals
.
printTrace
(
err
.
toString
());
// Ignore error and continue with posted message;
}
}
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart
View file @
91c342e2
...
...
@@ -16,10 +16,13 @@ import 'package:flutter_tools/src/project.dart';
import
'package:flutter_tools/src/resident_runner.dart'
;
import
'package:flutter_tools/src/build_runner/resident_web_runner.dart'
;
import
'package:flutter_tools/src/build_runner/web_fs.dart'
;
import
'package:flutter_tools/src/web/chrome.dart'
;
import
'package:flutter_tools/src/web/web_device.dart'
;
import
'package:meta/meta.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:platform/platform.dart'
;
import
'package:vm_service/vm_service.dart'
;
import
'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'
;
import
'../src/common.dart'
;
import
'../src/testbed.dart'
;
...
...
@@ -126,6 +129,38 @@ void main() {
expect
(
result
.
message
,
contains
(
'Failed to recompile application.'
));
}));
test
(
'Correctly performs a full refresh on attached chrome device.'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
final
MockChromeDevice
chromeDevice
=
MockChromeDevice
();
final
MockChrome
chrome
=
MockChrome
();
final
MockChromeConnection
mockChromeConnection
=
MockChromeConnection
();
final
MockChromeTab
mockChromeTab
=
MockChromeTab
();
final
MockWipConnection
mockWipConnection
=
MockWipConnection
();
when
(
mockChromeConnection
.
getTab
(
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
mockChromeTab
;
});
when
(
mockChromeTab
.
connect
()).
thenAnswer
((
Invocation
invocation
)
async
{
return
mockWipConnection
;
});
when
(
chrome
.
chromeConnection
).
thenReturn
(
mockChromeConnection
);
launchChromeInstance
(
chrome
);
when
(
mockFlutterDevice
.
device
).
thenReturn
(
chromeDevice
);
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
unawaited
(
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
));
await
connectionInfoCompleter
.
future
;
when
(
mockWebFs
.
recompile
()).
thenAnswer
((
Invocation
_
)
async
{
return
true
;
});
final
OperationResult
result
=
await
residentWebRunner
.
restart
(
fullRestart:
true
);
expect
(
result
.
code
,
0
);
verify
(
mockWipConnection
.
sendCommand
(
'Page.reload'
,
<
String
,
Object
>{
'ignoreCache'
:
true
,
})).
called
(
1
);
}));
}
class
MockWebDevice
extends
Mock
implements
Device
{}
...
...
@@ -135,3 +170,8 @@ class MockDebugConnection extends Mock implements DebugConnection {}
class
MockVmService
extends
Mock
implements
VmService
{}
class
MockStatus
extends
Mock
implements
Status
{}
class
MockFlutterDevice
extends
Mock
implements
FlutterDevice
{}
class
MockChromeDevice
extends
Mock
implements
ChromeDevice
{}
class
MockChrome
extends
Mock
implements
Chrome
{}
class
MockChromeConnection
extends
Mock
implements
ChromeConnection
{}
class
MockChromeTab
extends
Mock
implements
ChromeTab
{}
class
MockWipConnection
extends
Mock
implements
WipConnection
{}
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