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
159710ec
Unverified
Commit
159710ec
authored
Apr 14, 2020
by
Jonah Williams
Committed by
GitHub
Apr 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] fix response format of flutterVersion, flutterMemoryInfo (#54786)
parent
6a983e73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
4 deletions
+65
-4
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+22
-4
vmservice_integration_test.dart
...ls/test/integration.shard/vmservice_integration_test.dart
+43
-0
No files found.
packages/flutter_tools/lib/src/vmservice.dart
View file @
159710ec
...
...
@@ -255,7 +255,12 @@ class VMService implements vm_service.VmService {
final
Map
<
String
,
Object
>
versionJson
=
version
.
toJson
();
versionJson
[
'frameworkRevisionShort'
]
=
version
.
frameworkRevisionShort
;
versionJson
[
'engineRevisionShort'
]
=
version
.
engineRevisionShort
;
return
versionJson
;
return
<
String
,
dynamic
>{
'result'
:
<
String
,
Object
>{
'type'
:
'Success'
,
...
versionJson
,
}
};
});
_delegateService
.
registerService
(
'flutterVersion'
,
'Flutter Tools'
);
...
...
@@ -306,8 +311,21 @@ class VMService implements vm_service.VmService {
}
if
(
device
!=
null
)
{
_delegateService
.
registerServiceCallback
(
'flutterMemoryInfo'
,
(
Map
<
String
,
dynamic
>
params
)
async
{
final
MemoryInfo
result
=
await
device
.
queryMemoryInfo
();
return
result
.
toJson
();
try
{
final
MemoryInfo
result
=
await
device
.
queryMemoryInfo
();
return
<
String
,
dynamic
>{
'result'
:
<
String
,
Object
>{
'type'
:
'Success'
,
...
result
.
toJson
(),
}
};
}
on
Exception
catch
(
e
,
st
)
{
throw
vm_service
.
RPCError
(
'Error during memory info query
$e
\n
$st
'
,
RPCErrorCodes
.
kServerError
,
''
,
);
}
});
_delegateService
.
registerService
(
'flutterMemoryInfo'
,
'Flutter Tools'
);
}
...
...
@@ -354,6 +372,7 @@ class VMService implements vm_service.VmService {
final
io
.
WebSocket
channel
=
await
_openChannel
(
wsUri
.
toString
(),
compression:
compression
);
final
StreamController
<
dynamic
>
primary
=
StreamController
<
dynamic
>();
final
StreamController
<
dynamic
>
secondary
=
StreamController
<
dynamic
>();
// Create an instance of the package:vm_service API in addition to the flutter
// tool's to allow gradual migration.
final
Completer
<
void
>
streamClosedCompleter
=
Completer
<
void
>();
...
...
@@ -371,7 +390,6 @@ class VMService implements vm_service.VmService {
primary
.
addError
(
error
,
stackTrace
);
secondary
.
addError
(
error
,
stackTrace
);
});
final
vm_service
.
VmService
delegateService
=
vm_service
.
VmService
(
primary
.
stream
,
channel
.
add
,
...
...
packages/flutter_tools/test/integration.shard/vmservice_integration_test.dart
0 → 100644
View file @
159710ec
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:file/file.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:vm_service/vm_service.dart'
;
import
'package:vm_service/vm_service_io.dart'
;
import
'../src/common.dart'
;
import
'test_data/basic_project.dart'
;
import
'test_driver.dart'
;
import
'test_utils.dart'
;
void
main
(
)
{
Directory
tempDir
;
FlutterRunTestDriver
flutter
;
test
(
'Flutter Tool VMService methods can be called'
,
()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'vmservice_integration_test.'
);
final
BasicProject
_project
=
BasicProject
();
await
_project
.
setUpIn
(
tempDir
);
flutter
=
FlutterRunTestDriver
(
tempDir
);
await
flutter
.
run
(
withDebugger:
true
);
final
int
port
=
flutter
.
vmServicePort
;
final
VmService
vmService
=
await
vmServiceConnectUri
(
'ws://localhost:
$port
/ws'
);
final
Response
versionResponse
=
await
vmService
.
callMethod
(
's0.flutterVersion'
);
expect
(
versionResponse
.
type
,
'Success'
);
expect
(
versionResponse
.
json
,
containsPair
(
'frameworkRevisionShort'
,
isNotNull
));
expect
(
versionResponse
.
json
,
containsPair
(
'engineRevisionShort'
,
isNotNull
));
final
Response
memoryInfoResponse
=
await
vmService
.
callMethod
(
's0.flutterMemoryInfo'
);
expect
(
memoryInfoResponse
.
type
,
'Success'
);
});
tearDown
(()
{
tryToDelete
(
tempDir
);
flutter
?.
stop
();
});
}
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