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
52e5cd24
Unverified
Commit
52e5cd24
authored
Jan 03, 2019
by
Kenzie Schmoll
Committed by
GitHub
Jan 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add didSendFirstFrameEvent service extension. (#25977)
* Add didSendFirstFrameEvent service extension.
parent
71be92e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+9
-0
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+14
-1
No files found.
packages/flutter/lib/src/widgets/binding.dart
View file @
52e5cd24
...
...
@@ -289,6 +289,15 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
return
_forceRebuild
();
},
);
registerServiceExtension
(
name:
'didSendFirstFrameEvent'
,
callback:
(
_
)
async
{
return
<
String
,
dynamic
>{
'enabled'
:
_needToReportFirstFrame
?
'false'
:
'true'
};
},
);
}
assert
(()
{
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
52e5cd24
...
...
@@ -104,7 +104,20 @@ void main() {
test
(
'Service extensions - pretest'
,
()
async
{
binding
=
TestServiceExtensionsBinding
();
expect
(
binding
.
frameScheduled
,
isTrue
);
// We need to test this service extension here because the result is true
// after the first binding.doFrame() call.
Map
<
String
,
dynamic
>
firstFrameResult
;
expect
(
binding
.
debugDidSendFirstFrameEvent
,
isFalse
);
firstFrameResult
=
await
binding
.
testExtension
(
'didSendFirstFrameEvent'
,
<
String
,
String
>{});
expect
(
firstFrameResult
,
<
String
,
String
>{
'enabled'
:
'false'
});
await
binding
.
doFrame
();
// initial frame scheduled by creating the binding
expect
(
binding
.
debugDidSendFirstFrameEvent
,
isTrue
);
firstFrameResult
=
await
binding
.
testExtension
(
'didSendFirstFrameEvent'
,
<
String
,
String
>{});
expect
(
firstFrameResult
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
debugPrint
,
equals
(
debugPrintThrottled
));
...
...
@@ -548,7 +561,7 @@ void main() {
// If you add a service extension... TEST IT! :-)
// ...then increment this number.
expect
(
binding
.
extensions
.
length
,
2
4
+
widgetInspectorExtensionCount
);
expect
(
binding
.
extensions
.
length
,
2
5
+
widgetInspectorExtensionCount
);
expect
(
console
,
isEmpty
);
debugPrint
=
debugPrintThrottled
;
...
...
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