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
07c548c6
Unverified
Commit
07c548c6
authored
Feb 13, 2023
by
Ian Hickson
Committed by
GitHub
Feb 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply BindingBase.checkInstance to TestDefaultBinaryMessengerBinding (#116937)
parent
865422da
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
135 additions
and
135 deletions
+135
-135
adaptive_text_selection_toolbar_test.dart
.../test/cupertino/adaptive_text_selection_toolbar_test.dart
+2
-2
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+1
-1
text_selection_test.dart
packages/flutter/test/cupertino/text_selection_test.dart
+2
-2
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+2
-2
adaptive_text_selection_toolbar_test.dart
...r/test/material/adaptive_text_selection_toolbar_test.dart
+1
-1
feedback_test.dart
packages/flutter/test/material/feedback_test.dart
+2
-2
feedback_tester.dart
packages/flutter/test/material/feedback_tester.dart
+3
-3
search_test.dart
packages/flutter/test/material/search_test.dart
+2
-2
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+2
-2
text_form_field_test.dart
packages/flutter/test/material/text_form_field_test.dart
+1
-1
text_selection_test.dart
packages/flutter/test/material/text_selection_test.dart
+2
-2
semantics_service_test.dart
packages/flutter/test/semantics/semantics_service_test.dart
+1
-1
browser_context_menu_test.dart
...ages/flutter/test/services/browser_context_menu_test.dart
+6
-6
default_binary_messenger_test.dart
.../flutter/test/services/default_binary_messenger_test.dart
+1
-1
deferred_component_test.dart
packages/flutter/test/services/deferred_component_test.dart
+2
-2
fake_platform_views.dart
packages/flutter/test/services/fake_platform_views.dart
+3
-3
haptic_feedback_test.dart
packages/flutter/test/services/haptic_feedback_test.dart
+2
-2
platform_channel_test.dart
packages/flutter/test/services/platform_channel_test.dart
+23
-23
platform_messages_test.dart
packages/flutter/test/services/platform_messages_test.dart
+4
-4
raw_keyboard_test.dart
packages/flutter/test/services/raw_keyboard_test.dart
+22
-22
system_chrome_test.dart
packages/flutter/test/services/system_chrome_test.dart
+8
-7
system_navigator_test.dart
packages/flutter/test/services/system_navigator_test.dart
+4
-4
system_sound_test.dart
packages/flutter/test/services/system_sound_test.dart
+1
-1
editable_text_shortcuts_test.dart
...es/flutter/test/widgets/editable_text_shortcuts_test.dart
+2
-2
router_test.dart
packages/flutter/test/widgets/router_test.dart
+1
-2
scrollable_selection_test.dart
packages/flutter/test/widgets/scrollable_selection_test.dart
+2
-2
selectable_region_test.dart
packages/flutter/test/widgets/selectable_region_test.dart
+2
-2
selectable_text_test.dart
packages/flutter/test/widgets/selectable_text_test.dart
+2
-2
text_selection_test.dart
packages/flutter/test/widgets/text_selection_test.dart
+4
-4
binding.dart
packages/flutter_test/lib/src/binding.dart
+5
-5
deprecated.dart
packages/flutter_test/lib/src/deprecated.dart
+6
-6
event_simulation.dart
packages/flutter_test/lib/src/event_simulation.dart
+1
-1
test_text_input.dart
packages/flutter_test/lib/src/test_text_input.dart
+8
-8
test_text_input_key_handler.dart
...ges/flutter_test/lib/src/test_text_input_key_handler.dart
+1
-1
widget_tester_test.dart
packages/flutter_test/test/widget_tester_test.dart
+4
-4
No files found.
packages/flutter/test/cupertino/adaptive_text_selection_toolbar_test.dart
View file @
07c548c6
...
...
@@ -13,7 +13,7 @@ void main() {
final
MockClipboard
mockClipboard
=
MockClipboard
();
setUp
(()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
,
);
...
...
@@ -23,7 +23,7 @@ void main() {
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
,
);
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
07c548c6
...
...
@@ -159,7 +159,7 @@ class PathPointsMatcher extends Matcher {
void
main
(
)
{
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
MockClipboard
mockClipboard
=
MockClipboard
();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
// Returns the first RenderEditable.
RenderEditable
findRenderEditable
(
WidgetTester
tester
)
{
...
...
packages/flutter/test/cupertino/text_selection_test.dart
View file @
07c548c6
...
...
@@ -82,7 +82,7 @@ void main() {
}
setUp
(()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
,
);
...
...
@@ -92,7 +92,7 @@ void main() {
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
,
);
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
07c548c6
...
...
@@ -546,7 +546,7 @@ void main() {
bool
completed
;
completed
=
false
;
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'flutter/assets'
,
(
ByteData
?
message
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'flutter/assets'
,
(
ByteData
?
message
)
async
{
expect
(
utf8
.
decode
(
message
!.
buffer
.
asUint8List
()),
'test'
);
completed
=
true
;
return
ByteData
(
5
);
// 0x0000000000
...
...
@@ -573,7 +573,7 @@ void main() {
});
expect
(
data
,
isFalse
);
expect
(
completed
,
isTrue
);
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'flutter/assets'
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'flutter/assets'
,
null
);
});
test
(
'Service extensions - exit'
,
()
async
{
...
...
packages/flutter/test/material/adaptive_text_selection_toolbar_test.dart
View file @
07c548c6
...
...
@@ -16,7 +16,7 @@ void main() {
setUp
(()
async
{
TestWidgetsFlutterBinding
.
ensureInitialized
();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
,
);
...
...
packages/flutter/test/material/feedback_test.dart
View file @
07c548c6
...
...
@@ -27,14 +27,14 @@ void main () {
setUp
(()
{
semanticEvents
=
<
Map
<
String
,
Object
>>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
(
dynamic
message
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
(
dynamic
message
)
async
{
final
Map
<
dynamic
,
dynamic
>
typedMessage
=
message
as
Map
<
dynamic
,
dynamic
>;
semanticEvents
.
add
(
typedMessage
.
cast
<
String
,
Object
>());
});
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
null
);
});
testWidgets
(
'forTap'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/material/feedback_tester.dart
View file @
07c548c6
...
...
@@ -11,7 +11,7 @@ import 'package:flutter_test/flutter_test.dart';
/// cannot be used in combination with other classes that do the same.
class
FeedbackTester
{
FeedbackTester
()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
_handler
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
_handler
);
}
/// Number of times haptic feedback was requested (vibration).
...
...
@@ -34,7 +34,7 @@ class FeedbackTester {
/// Stops tracking.
void
dispose
()
{
assert
(
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
SystemChannels
.
platform
.
name
,
_handler
));
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
assert
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
SystemChannels
.
platform
.
name
,
_handler
));
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
}
}
packages/flutter/test/material/search_test.dart
View file @
07c548c6
...
...
@@ -17,12 +17,12 @@ void main() {
setUp
(()
async
{
// Fill the clipboard so that the Paste option is available in the text
// selection menu.
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
await
Clipboard
.
setData
(
const
ClipboardData
(
text:
'Clipboard data'
));
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
testWidgets
(
'Changing query moves cursor to the end of query'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/material/text_field_test.dart
View file @
07c548c6
...
...
@@ -176,7 +176,7 @@ void main() {
setUp
(()
async
{
debugResetSemanticsIdCounter
();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
,
);
...
...
@@ -186,7 +186,7 @@ void main() {
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
,
);
...
...
packages/flutter/test/material/text_form_field_test.dart
View file @
07c548c6
...
...
@@ -17,7 +17,7 @@ import '../widgets/editable_text_utils.dart';
void
main
(
)
{
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
MockClipboard
mockClipboard
=
MockClipboard
();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
setUp
(()
async
{
// Fill the clipboard so that the Paste option is available in the text
...
...
packages/flutter/test/material/text_selection_test.dart
View file @
07c548c6
...
...
@@ -20,7 +20,7 @@ void main() {
final
MockClipboard
mockClipboard
=
MockClipboard
();
setUp
(()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
,
...
...
@@ -31,7 +31,7 @@ void main() {
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
,
);
...
...
packages/flutter/test/semantics/semantics_service_test.dart
View file @
07c548c6
...
...
@@ -17,7 +17,7 @@ void main() {
log
.
add
(
message
);
}
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
handleMessage
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
handleMessage
);
await
SemanticsService
.
announce
(
'announcement 1'
,
TextDirection
.
ltr
);
await
SemanticsService
.
announce
(
'announcement 2'
,
TextDirection
.
rtl
,
assertiveness:
Assertiveness
.
assertive
);
...
...
packages/flutter/test/services/browser_context_menu_test.dart
View file @
07c548c6
...
...
@@ -41,15 +41,15 @@ void main() {
group
(
'disableContextMenu'
,
()
{
// Make sure the context menu is enabled (default) after the test.
tearDown
(()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
(
MethodCall
methodCall
)
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
(
MethodCall
methodCall
)
{
return
null
;
});
await
BrowserContextMenu
.
enableContextMenu
();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
null
);
});
test
(
'disableContextMenu calls its platform channel method'
,
()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -58,13 +58,13 @@ void main() {
isMethodCall
(
'disableContextMenu'
,
arguments:
null
),
]);
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
null
);
});
});
group
(
'enableContextMenu'
,
()
{
test
(
'enableContextMenu calls its platform channel method'
,
()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -73,7 +73,7 @@ void main() {
isMethodCall
(
'enableContextMenu'
,
arguments:
null
),
]);
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
contextMenu
,
null
);
});
});
},
...
...
packages/flutter/test/services/default_binary_messenger_test.dart
View file @
07c548c6
...
...
@@ -53,7 +53,7 @@ void main() {
test
(
'can check the mock handler'
,
()
{
Future
<
ByteData
?>
handler
(
ByteData
?
call
)
=>
Future
<
ByteData
?>.
value
();
final
TestDefaultBinaryMessenger
messenger
=
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
;
final
TestDefaultBinaryMessenger
messenger
=
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
;
expect
(
messenger
.
checkMockMessageHandler
(
'test_channel'
,
null
),
true
);
expect
(
messenger
.
checkMockMessageHandler
(
'test_channel'
,
handler
),
false
);
...
...
packages/flutter/test/services/deferred_component_test.dart
View file @
07c548c6
...
...
@@ -11,7 +11,7 @@ void main() {
test
(
'installDeferredComponent test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
deferredComponent
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
deferredComponent
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -28,7 +28,7 @@ void main() {
test
(
'uninstallDeferredComponent test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
deferredComponent
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
deferredComponent
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
packages/flutter/test/services/fake_platform_views.dart
View file @
07c548c6
...
...
@@ -151,7 +151,7 @@ class FakeAndroidViewController implements AndroidViewController {
class
FakeAndroidPlatformViewsController
{
FakeAndroidPlatformViewsController
()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform_views
,
_onMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform_views
,
_onMethodCall
);
}
Iterable
<
FakeAndroidPlatformView
>
get
views
=>
_views
.
values
;
...
...
@@ -370,7 +370,7 @@ class FakeAndroidPlatformViewsController {
class
FakeIosPlatformViewsController
{
FakeIosPlatformViewsController
()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform_views
,
_onMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform_views
,
_onMethodCall
);
}
Iterable
<
FakeUiKitView
>
get
views
=>
_views
.
values
;
...
...
@@ -473,7 +473,7 @@ class FakeIosPlatformViewsController {
class
FakeHtmlPlatformViewsController
{
FakeHtmlPlatformViewsController
()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform_views
,
_onMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform_views
,
_onMethodCall
);
}
Iterable
<
FakeHtmlPlatformView
>
get
views
=>
_views
.
values
;
...
...
packages/flutter/test/services/haptic_feedback_test.dart
View file @
07c548c6
...
...
@@ -11,7 +11,7 @@ void main() {
test
(
'Haptic feedback control test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -26,7 +26,7 @@ void main() {
Future
<
void
>
callAndVerifyHapticFunction
(
Future
<
void
>
Function
()
hapticFunction
,
String
platformMethodArgument
)
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
packages/flutter/test/services/platform_channel_test.dart
View file @
07c548c6
This diff is collapsed.
Click to expand it.
packages/flutter/test/services/platform_messages_test.dart
View file @
07c548c6
...
...
@@ -14,18 +14,18 @@ void main() {
test
(
'Mock binary message handler control test'
,
()
async
{
final
List
<
ByteData
?>
log
=
<
ByteData
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'test1'
,
(
ByteData
?
message
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'test1'
,
(
ByteData
?
message
)
async
{
log
.
add
(
message
);
return
null
;
});
final
ByteData
message
=
ByteData
(
2
)..
setUint16
(
0
,
0xABCD
);
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
send
(
'test1'
,
message
);
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
send
(
'test1'
,
message
);
expect
(
log
,
equals
(<
ByteData
>[
message
]));
log
.
clear
();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'test1'
,
null
);
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
send
(
'test1'
,
message
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'test1'
,
null
);
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
send
(
'test1'
,
message
);
expect
(
log
,
isEmpty
);
});
}
packages/flutter/test/services/raw_keyboard_test.dart
View file @
07c548c6
This diff is collapsed.
Click to expand it.
packages/flutter/test/services/system_chrome_test.dart
View file @
07c548c6
...
...
@@ -12,7 +12,7 @@ void main() {
testWidgets
(
'SystemChrome overlay style test'
,
(
WidgetTester
tester
)
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -70,7 +70,7 @@ void main() {
test
(
'setPreferredOrientations control test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -89,7 +89,7 @@ void main() {
test
(
'setApplicationSwitcherDescription control test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -108,7 +108,7 @@ void main() {
test
(
'setApplicationSwitcherDescription missing plugin'
,
()
async
{
final
List
<
ByteData
?>
log
=
<
ByteData
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'flutter/platform'
,
(
ByteData
?
message
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMessageHandler
(
'flutter/platform'
,
(
ByteData
?
message
)
async
{
log
.
add
(
message
);
return
null
;
});
...
...
@@ -120,10 +120,11 @@ void main() {
expect
(
log
,
isNotEmpty
);
});
test
(
'setEnabledSystemUIMode control test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -152,7 +153,7 @@ void main() {
test
(
'setEnabledSystemUIMode passes correct overlays for manual configuration'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -169,7 +170,7 @@ void main() {
test
(
'setSystemUIChangeCallback control test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
packages/flutter/test/services/system_navigator_test.dart
View file @
07c548c6
...
...
@@ -18,7 +18,7 @@ void main() {
}
test
(
'System navigator control test - platform messages'
,
()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -27,11 +27,11 @@ void main() {
isMethodCall
(
'SystemNavigator.pop'
,
arguments:
null
),
]);
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
test
(
'System navigator control test - navigation messages'
,
()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
navigation
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
navigation
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
@@ -56,6 +56,6 @@ void main() {
isMethodCall
(
'routeInformationUpdated'
,
arguments:
<
String
,
dynamic
>{
'location'
:
'a'
,
'state'
:
true
,
'replace'
:
true
}),
]);
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
navigation
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
navigation
,
null
);
});
}
packages/flutter/test/services/system_sound_test.dart
View file @
07c548c6
...
...
@@ -12,7 +12,7 @@ void main() {
test
(
'System sound control test'
,
()
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
(
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
return
null
;
});
...
...
packages/flutter/test/widgets/editable_text_shortcuts_test.dart
View file @
07c548c6
...
...
@@ -26,12 +26,12 @@ void main() {
final
MockClipboard
mockClipboard
=
MockClipboard
();
setUp
(()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
await
Clipboard
.
setData
(
const
ClipboardData
(
text:
'empty'
));
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
const
String
testText
=
...
...
packages/flutter/test/widgets/router_test.dart
View file @
07c548c6
...
...
@@ -823,8 +823,7 @@ testWidgets('ChildBackButtonDispatcher take priority recursively', (WidgetTester
testWidgets
(
'PlatformRouteInformationProvider updates route information'
,
(
WidgetTester
tester
)
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
navigation
,
(
MethodCall
methodCall
)
async
{
...
...
packages/flutter/test/widgets/scrollable_selection_test.dart
View file @
07c548c6
...
...
@@ -27,12 +27,12 @@ void main() {
final
MockClipboard
mockClipboard
=
MockClipboard
();
setUp
(()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
await
Clipboard
.
setData
(
const
ClipboardData
(
text:
'empty'
));
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
testWidgets
(
'mouse can select multiple widgets'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/widgets/selectable_region_test.dart
View file @
07c548c6
...
...
@@ -28,12 +28,12 @@ void main() {
final
MockClipboard
mockClipboard
=
MockClipboard
();
setUp
(()
async
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
await
Clipboard
.
setData
(
const
ClipboardData
(
text:
'empty'
));
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
group
(
'SelectableRegion'
,
()
{
...
...
packages/flutter/test/widgets/selectable_text_test.dart
View file @
07c548c6
...
...
@@ -146,7 +146,7 @@ void main() {
setUp
(()
async
{
debugResetSemanticsIdCounter
();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
,
);
...
...
@@ -156,7 +156,7 @@ void main() {
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
,
);
...
...
packages/flutter/test/widgets/text_selection_test.dart
View file @
07c548c6
...
...
@@ -1374,11 +1374,11 @@ void main() {
group
(
'when Clipboard fails'
,
()
{
setUp
(()
{
final
MockClipboard
mockClipboard
=
MockClipboard
(
hasStringsThrows:
true
);
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
test
(
'Clipboard API failure is gracefully recovered from'
,
()
async
{
...
...
@@ -1394,11 +1394,11 @@ void main() {
final
MockClipboard
mockClipboard
=
MockClipboard
();
setUp
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
mockClipboard
.
handleMethodCall
);
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
test
(
'update sets value based on clipboard contents'
,
()
async
{
...
...
packages/flutter_test/lib/src/binding.dart
View file @
07c548c6
...
...
@@ -99,7 +99,7 @@ mixin TestDefaultBinaryMessengerBinding on BindingBase, ServicesBinding {
}
/// The current [TestDefaultBinaryMessengerBinding], if one has been created.
static
TestDefaultBinaryMessengerBinding
?
get
instance
=>
_instance
;
static
TestDefaultBinaryMessengerBinding
get
instance
=>
BindingBase
.
checkInstance
(
_instance
)
;
static
TestDefaultBinaryMessengerBinding
?
_instance
;
@override
...
...
@@ -775,10 +775,10 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
assert
(
inTest
);
// Set the handler only if there is currently none.
if
(
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
if
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
SystemChannels
.
accessibility
.
name
,
null
))
{
_announcementHandler
=
_handleAnnouncementMessage
;
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
_announcementHandler
);
}
...
...
@@ -1067,10 +1067,10 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
_parentZone
=
null
;
buildOwner
!.
focusManager
.
dispose
();
if
(
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
if
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
SystemChannels
.
accessibility
.
name
,
_announcementHandler
))
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
(
SystemChannels
.
accessibility
,
null
);
_announcementHandler
=
null
;
}
...
...
packages/flutter_test/lib/src/deprecated.dart
View file @
07c548c6
...
...
@@ -27,7 +27,7 @@ extension TestBinaryMessengerExtension on BinaryMessenger {
// 'This feature was deprecated after v2.1.0-10.0.pre.'
// )
void
setMockMessageHandler
(
String
channel
,
MessageHandler
?
handler
)
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMessageHandler
(
channel
,
handler
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMessageHandler
(
channel
,
handler
);
}
/// Shim for `TestDefaultBinaryMessenger.checkMockMessageHandler`.
...
...
@@ -38,7 +38,7 @@ extension TestBinaryMessengerExtension on BinaryMessenger {
// 'This feature was deprecated after v2.1.0-10.0.pre.'
// )
bool
checkMockMessageHandler
(
String
channel
,
Object
?
handler
)
{
return
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
channel
,
handler
);
return
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
channel
,
handler
);
}
}
...
...
@@ -59,7 +59,7 @@ extension TestBasicMessageChannelExtension<T> on BasicMessageChannel<T> {
// 'This feature was deprecated after v2.1.0-10.0.pre.'
// )
void
setMockMessageHandler
(
Future
<
T
>
Function
(
T
?
message
)?
handler
)
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
T
>(
this
,
handler
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
T
>(
this
,
handler
);
}
/// Shim for `TestDefaultBinaryMessenger.checkMockMessageHandler`.
...
...
@@ -71,7 +71,7 @@ extension TestBasicMessageChannelExtension<T> on BasicMessageChannel<T> {
// 'This feature was deprecated after v2.1.0-10.0.pre.'
// )
bool
checkMockMessageHandler
(
Object
?
handler
)
{
return
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
name
,
handler
);
return
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
name
,
handler
);
}
}
...
...
@@ -92,7 +92,7 @@ extension TestMethodChannelExtension on MethodChannel {
// 'This feature was deprecated after v2.1.0-10.0.pre.'
// )
void
setMockMethodCallHandler
(
Future
<
dynamic
>?
Function
(
MethodCall
call
)?
handler
)
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
this
,
handler
);
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
this
,
handler
);
}
/// Shim for `TestDefaultBinaryMessenger.checkMockMessageHandler`.
...
...
@@ -104,6 +104,6 @@ extension TestMethodChannelExtension on MethodChannel {
// 'This feature was deprecated after v2.1.0-10.0.pre.'
// )
bool
checkMockMethodCallHandler
(
Object
?
handler
)
{
return
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
name
,
handler
);
return
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
name
,
handler
);
}
}
packages/flutter_test/lib/src/event_simulation.dart
View file @
07c548c6
...
...
@@ -680,7 +680,7 @@ class KeyEventSimulator {
static
Future
<
bool
>
_simulateKeyEventByRawEvent
(
ValueGetter
<
Map
<
String
,
dynamic
>>
buildKeyData
)
async
{
return
TestAsyncUtils
.
guard
<
bool
>(()
async
{
final
Completer
<
bool
>
result
=
Completer
<
bool
>();
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
keyEvent
.
name
,
SystemChannels
.
keyEvent
.
codec
.
encodeMessage
(
buildKeyData
()),
(
ByteData
?
data
)
{
...
...
packages/flutter_test/lib/src/test_text_input.dart
View file @
07c548c6
...
...
@@ -205,7 +205,7 @@ class TestTextInput {
/// * [enterText], which is similar but takes only a String and resets the
/// selection.
void
updateEditingValue
(
TextEditingValue
value
)
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
@@ -229,7 +229,7 @@ class TestTextInput {
Future
<
void
>
receiveAction
(
TextInputAction
action
)
async
{
return
TestAsyncUtils
.
guard
(()
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
@@ -269,7 +269,7 @@ class TestTextInput {
/// example when using the [integration_test] library, there is a risk that
/// the real IME will become confused as to the current state of input.
void
closeConnection
()
{
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
@@ -284,7 +284,7 @@ class TestTextInput {
/// Simulates a scribble interaction starting.
Future
<
void
>
startScribbleInteraction
()
async
{
assert
(
isRegistered
);
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
@@ -299,7 +299,7 @@ class TestTextInput {
/// Simulates a Scribble focus.
Future
<
void
>
scribbleFocusElement
(
String
elementIdentifier
,
Offset
offset
)
async
{
assert
(
isRegistered
);
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
@@ -315,7 +315,7 @@ class TestTextInput {
Future
<
List
<
List
<
dynamic
>>>
scribbleRequestElementsInRect
(
Rect
rect
)
async
{
assert
(
isRegistered
);
List
<
List
<
dynamic
>>
response
=
<
List
<
dynamic
>>[];
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
@@ -334,7 +334,7 @@ class TestTextInput {
/// Simulates iOS inserting a UITextPlaceholder during a long press with the pencil.
Future
<
void
>
scribbleInsertPlaceholder
()
async
{
assert
(
isRegistered
);
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
@@ -349,7 +349,7 @@ class TestTextInput {
/// Simulates iOS removing a UITextPlaceholder after a long press with the pencil is released.
Future
<
void
>
scribbleRemovePlaceholder
()
async
{
assert
(
isRegistered
);
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
.
handlePlatformMessage
(
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
MethodCall
(
...
...
packages/flutter_test/lib/src/test_text_input_key_handler.dart
View file @
07c548c6
...
...
@@ -26,7 +26,7 @@ class MacOSTestTextInputKeyHandler extends TestTextInputKeyHandler {
final
int
client
;
Future
<
void
>
_sendSelectors
(
List
<
String
>
selectors
)
async
{
await
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
await
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
textInput
.
name
,
SystemChannels
.
textInput
.
codec
.
encodeMethodCall
(
...
...
packages/flutter_test/test/widget_tester_test.dart
View file @
07c548c6
...
...
@@ -827,7 +827,7 @@ void main() {
testWidgets
(
'Returns the list of announcements'
,
(
WidgetTester
tester
)
async
{
// Make sure the handler is properly set
expect
(
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
expect
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
SystemChannels
.
accessibility
.
name
,
null
),
isFalse
);
await
SemanticsService
.
announce
(
'announcement 1'
,
TextDirection
.
ltr
);
...
...
@@ -863,7 +863,7 @@ void main() {
log
.
add
(
message
);
}
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
handleMessage
);
...
...
@@ -883,14 +883,14 @@ void main() {
]));
// Remove the handler
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockDecodedMessageHandler
<
dynamic
>(
SystemChannels
.
accessibility
,
null
);
});
tearDown
(()
{
// Make sure that the handler is removed in [TestWidgetsFlutterBinding.postTest]
expect
(
TestDefaultBinaryMessengerBinding
.
instance
!
.
defaultBinaryMessenger
expect
(
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
checkMockMessageHandler
(
SystemChannels
.
accessibility
.
name
,
null
),
isTrue
);
});
});
...
...
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