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
cf7a6319
Unverified
Commit
cf7a6319
authored
Feb 02, 2021
by
Michael Goderbauer
Committed by
GitHub
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland "Make flutter_driver be usable from a null-safe app (#75175)" (#75269)
parent
c8310468
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
21 deletions
+24
-21
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+4
-4
vmservice_driver.dart
packages/flutter_driver/lib/src/driver/vmservice_driver.dart
+18
-15
flutter_driver_test.dart
...utter_driver/test/src/real_tests/flutter_driver_test.dart
+2
-2
No files found.
packages/flutter_driver/lib/src/driver/driver.dart
View file @
cf7a6319
...
...
@@ -311,7 +311,7 @@ abstract class FlutterDriver {
/// See also:
///
/// * [getWidgetDiagnostics], which gets the [DiagnosticsNode] of a [Widget].
Future
<
Map
<
String
,
Object
>>
getRenderObjectDiagnostics
(
Future
<
Map
<
String
,
Object
?
>>
getRenderObjectDiagnostics
(
SerializableFinder
finder
,
{
int
subtreeDepth
=
0
,
bool
includeProperties
=
true
,
...
...
@@ -323,7 +323,7 @@ abstract class FlutterDriver {
subtreeDepth:
subtreeDepth
,
includeProperties:
includeProperties
,
timeout:
timeout
,
))
as
Map
<
String
,
Object
>
;
));
}
/// Returns a JSON map of the [DiagnosticsNode] that is associated with the
...
...
@@ -344,7 +344,7 @@ abstract class FlutterDriver {
///
/// * [getRenderObjectDiagnostics], which gets the [DiagnosticsNode] of a
/// [RenderObject].
Future
<
Map
<
String
,
Object
>>
getWidgetDiagnostics
(
Future
<
Map
<
String
,
Object
?
>>
getWidgetDiagnostics
(
SerializableFinder
finder
,
{
int
subtreeDepth
=
0
,
bool
includeProperties
=
true
,
...
...
@@ -356,7 +356,7 @@ abstract class FlutterDriver {
subtreeDepth:
subtreeDepth
,
includeProperties:
includeProperties
,
timeout:
timeout
,
))
as
Map
<
String
,
Object
>
;
));
}
/// Tell the driver to perform a scrolling action.
...
...
packages/flutter_driver/lib/src/driver/vmservice_driver.dart
View file @
cf7a6319
...
...
@@ -149,6 +149,7 @@ class VMServiceFlutterDriver extends FlutterDriver {
'when another tool (usually a debugger) resumed the isolate '
'before the flutter_driver did.'
);
return
vms
.
Success
();
}
else
{
// Failed to resume due to another reason. Fail hard.
throw
e
;
...
...
@@ -312,11 +313,11 @@ class VMServiceFlutterDriver extends FlutterDriver {
isolateId:
_appIsolate
.
id
,
args:
serialized
,
).
then
<
Map
<
String
,
dynamic
>>((
vms
.
Response
value
)
=>
value
.
json
!);
response
=
(
await
_warnIfSlow
<
Map
<
String
,
dynamic
>>(
response
=
await
_warnIfSlow
<
Map
<
String
,
dynamic
>>(
future:
future
,
timeout:
command
.
timeout
??
kUnusuallyLongTimeout
,
message:
'
${command.kind}
message is taking a long time to complete...'
,
)
)!
;
);
_logCommunication
(
'<<<
$response
'
);
}
catch
(
error
,
stackTrace
)
{
throw
DriverError
(
...
...
@@ -407,7 +408,7 @@ class VMServiceFlutterDriver extends FlutterDriver {
const
int
kSecondInMicros
=
1000000
;
int
currentStart
=
startTime
;
int
currentEnd
=
startTime
+
kSecondInMicros
;
// 1 second of timeline
final
List
<
Map
<
String
,
Object
?>?>
chunks
=
<
Map
<
String
,
Object
>?>[];
final
List
<
Map
<
String
,
Object
?>?>
chunks
=
<
Map
<
String
,
Object
?
>?>[];
do
{
final
vms
.
Timeline
chunk
=
await
_serviceClient
.
getVMTimeline
(
timeOriginMicros:
currentStart
,
...
...
@@ -420,9 +421,9 @@ class VMServiceFlutterDriver extends FlutterDriver {
currentEnd
+=
kSecondInMicros
;
}
while
(
currentStart
<
endTime
!);
return
Timeline
.
fromJson
(<
String
,
Object
>{
'traceEvents'
:
<
Object
>
[
'traceEvents'
:
<
Object
?
>
[
for
(
Map
<
String
,
Object
?>?
chunk
in
chunks
)
...
chunk
![
'traceEvents'
]!
as
List
<
Object
>,
...
chunk
![
'traceEvents'
]!
as
List
<
Object
?
>,
],
});
}
catch
(
error
,
stackTrace
)
{
...
...
@@ -621,22 +622,24 @@ void _log(String message) {
driverLog
(
'VMServiceFlutterDriver'
,
message
);
}
Future
<
T
?
>
_warnIfSlow
<
T
>({
required
Future
<
T
?
>
future
,
Future
<
T
>
_warnIfSlow
<
T
>({
required
Future
<
T
>
future
,
required
Duration
timeout
,
required
String
message
,
})
{
})
async
{
assert
(
future
!=
null
);
assert
(
timeout
!=
null
);
assert
(
message
!=
null
);
f
uture
.
timeout
(
timeout
,
onTimeout:
()
{
f
inal
Completer
<
void
>
completer
=
Completer
<
void
>();
completer
.
future
.
timeout
(
timeout
,
onTimeout:
()
{
_log
(
message
);
return
null
;
})
});
try
{
await
future
.
whenComplete
(()
{
completer
.
complete
();
});
}
catch
(
e
)
{
// Don't duplicate errors if [future] completes with an error.
.
catchError
((
Object
e
,
StackTrace
s
)
=>
null
);
}
return
future
;
}
...
...
packages/flutter_driver/test/flutter_driver_test.dart
→
packages/flutter_driver/test/
src/real_tests/
flutter_driver_test.dart
View file @
cf7a6319
...
...
@@ -14,7 +14,7 @@ import 'package:flutter_driver/src/driver/timeline.dart';
import
'package:fake_async/fake_async.dart'
;
import
'package:vm_service/vm_service.dart'
as
vms
;
import
'common.dart'
;
import
'
../../
common.dart'
;
/// Magical timeout value that's different from the default.
const
Duration
_kTestTimeout
=
Duration
(
milliseconds:
1234
);
...
...
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