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
21be8372
Unverified
Commit
21be8372
authored
Oct 18, 2019
by
Jonah Williams
Committed by
GitHub
Oct 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement debugTogglePlatform for the web (#42951)
parent
e67f9a3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+28
-0
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+20
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
21be8372
...
...
@@ -384,6 +384,34 @@ class ResidentWebRunner extends ResidentRunner {
}
}
@override
Future
<
void
>
debugTogglePlatform
()
async
{
try
{
final
vmservice
.
Response
response
=
await
_vmService
.
callServiceExtension
(
'ext.flutter.platformOverride'
);
final
String
currentPlatform
=
response
.
json
[
'value'
];
String
nextPlatform
;
switch
(
currentPlatform
)
{
case
'android'
:
nextPlatform
=
'iOS'
;
break
;
case
'iOS'
:
nextPlatform
=
'android'
;
break
;
}
if
(
nextPlatform
==
null
)
{
return
;
}
await
_vmService
.
callServiceExtension
(
'ext.flutter.platformOverride'
,
args:
<
String
,
Object
>{
'value'
:
nextPlatform
,
});
printStatus
(
'Switched operating system to
$nextPlatform
'
);
}
on
vmservice
.
RPCError
{
return
;
}
}
@override
Future
<
void
>
debugDumpSemanticsTreeInInverseHitTestOrder
()
async
{
try
{
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
21be8372
...
...
@@ -435,6 +435,26 @@ void main() {
args:
<
String
,
Object
>{
'enabled'
:
true
})).
called
(
1
);
}));
test
(
'debugTogglePlatform'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
final
BufferLogger
bufferLogger
=
logger
;
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
unawaited
(
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
));
await
connectionInfoCompleter
.
future
;
when
(
mockVmService
.
callServiceExtension
(
'ext.flutter.platformOverride'
))
.
thenAnswer
((
Invocation
_
)
async
{
return
Response
.
parse
(<
String
,
Object
>{
'value'
:
'iOS'
});
});
await
residentWebRunner
.
debugTogglePlatform
();
expect
(
bufferLogger
.
statusText
,
contains
(
'Switched operating system to android'
));
verify
(
mockVmService
.
callServiceExtension
(
'ext.flutter.platformOverride'
,
args:
<
String
,
Object
>{
'value'
:
'android'
})).
called
(
1
);
}));
test
(
'cleanup of resources is safe to call multiple times'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
bool
debugClosed
=
false
;
...
...
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