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
b5a47d71
Commit
b5a47d71
authored
Sep 09, 2016
by
Yegor
Committed by
GitHub
Sep 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
driver: fix covariant closures; make them private (#5782)
parent
4d80f3cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
27 deletions
+34
-27
extension.dart
packages/flutter_driver/lib/src/extension.dart
+34
-27
No files found.
packages/flutter_driver/lib/src/extension.dart
View file @
b5a47d71
...
...
@@ -60,14 +60,14 @@ class FlutterDriverExtension {
FlutterDriverExtension
()
{
_commandHandlers
.
addAll
(<
String
,
CommandHandlerCallback
>{
'get_health'
:
getHealth
,
// ignore: map_value_type_not_assignable, #5771
'tap'
:
tap
,
// ignore: map_value_type_not_assignable, #5771
'get_text'
:
getText
,
// ignore: map_value_type_not_assignable, #5771
'scroll'
:
scroll
,
// ignore: map_value_type_not_assignable, #5771
'scrollIntoView'
:
scrollIntoView
,
// ignore: map_value_type_not_assignable, #5771
'setInputText'
:
_setInputText
,
// ignore: map_value_type_not_assignable, #5771
'submitInputText'
:
_submitInputText
,
// ignore: map_value_type_not_assignable, #5771
'waitFor'
:
waitFor
,
// ignore: map_value_type_not_assignable, #5771
'get_health'
:
_getHealth
,
'tap'
:
_tap
,
'get_text'
:
_getText
,
'scroll'
:
_scroll
,
'scrollIntoView'
:
_scrollIntoView
,
'setInputText'
:
_setInputText
,
'submitInputText'
:
_submitInputText
,
'waitFor'
:
_waitFor
,
});
_commandDeserializers
.
addAll
(<
String
,
CommandDeserializerCallback
>{
...
...
@@ -123,7 +123,7 @@ class FlutterDriverExtension {
return
_onFrameReadyStream
;
}
Future
<
Health
>
getHealth
(
GetHealth
command
)
async
=>
new
Health
(
HealthStatus
.
ok
);
Future
<
Health
>
_getHealth
(
Command
command
)
async
=>
new
Health
(
HealthStatus
.
ok
);
/// Runs `finder` repeatedly until it finds one or more [Element]s, or times out.
///
...
...
@@ -179,23 +179,26 @@ class FlutterDriverExtension {
return
constructor
(
finder
);
}
Future
<
TapResult
>
tap
(
Tap
command
)
async
{
prober
.
tap
(
await
_waitForElement
(
_createFinder
(
command
.
finder
)));
Future
<
TapResult
>
_tap
(
Command
command
)
async
{
Tap
tapCommand
=
command
;
prober
.
tap
(
await
_waitForElement
(
_createFinder
(
tapCommand
.
finder
)));
return
new
TapResult
();
}
Future
<
WaitForResult
>
waitFor
(
WaitFor
command
)
async
{
if
((
await
_waitForElement
(
_createFinder
(
command
.
finder
))).
evaluate
().
isNotEmpty
)
Future
<
WaitForResult
>
_waitFor
(
Command
command
)
async
{
WaitFor
waitForCommand
=
command
;
if
((
await
_waitForElement
(
_createFinder
(
waitForCommand
.
finder
))).
evaluate
().
isNotEmpty
)
return
new
WaitForResult
();
else
return
null
;
}
Future
<
ScrollResult
>
scroll
(
Scroll
command
)
async
{
Finder
target
=
await
_waitForElement
(
_createFinder
(
command
.
finder
));
final
int
totalMoves
=
command
.
duration
.
inMicroseconds
*
command
.
frequency
~/
Duration
.
MICROSECONDS_PER_SECOND
;
Offset
delta
=
new
Offset
(
command
.
dx
,
command
.
dy
)
/
totalMoves
.
toDouble
();
Duration
pause
=
command
.
duration
~/
totalMoves
;
Future
<
ScrollResult
>
_scroll
(
Command
command
)
async
{
Scroll
scrollCommand
=
command
;
Finder
target
=
await
_waitForElement
(
_createFinder
(
scrollCommand
.
finder
));
final
int
totalMoves
=
scrollCommand
.
duration
.
inMicroseconds
*
scrollCommand
.
frequency
~/
Duration
.
MICROSECONDS_PER_SECOND
;
Offset
delta
=
new
Offset
(
scrollCommand
.
dx
,
scrollCommand
.
dy
)
/
totalMoves
.
toDouble
();
Duration
pause
=
scrollCommand
.
duration
~/
totalMoves
;
Point
startLocation
=
prober
.
getCenter
(
target
);
Point
currentLocation
=
startLocation
;
TestPointer
pointer
=
new
TestPointer
(
1
);
...
...
@@ -214,28 +217,32 @@ class FlutterDriverExtension {
return
new
ScrollResult
();
}
Future
<
ScrollResult
>
scrollIntoView
(
ScrollIntoView
command
)
async
{
Finder
target
=
await
_waitForElement
(
_createFinder
(
command
.
finder
));
Future
<
ScrollResult
>
_scrollIntoView
(
Command
command
)
async
{
ScrollIntoView
scrollIntoViewCommand
=
command
;
Finder
target
=
await
_waitForElement
(
_createFinder
(
scrollIntoViewCommand
.
finder
));
await
Scrollable
.
ensureVisible
(
target
.
evaluate
().
single
);
return
new
ScrollResult
();
}
Future
<
SetInputTextResult
>
_setInputText
(
SetInputText
command
)
async
{
Finder
target
=
await
_waitForElement
(
_createFinder
(
command
.
finder
));
Future
<
SetInputTextResult
>
_setInputText
(
Command
command
)
async
{
SetInputText
setInputTextCommand
=
command
;
Finder
target
=
await
_waitForElement
(
_createFinder
(
setInputTextCommand
.
finder
));
Input
input
=
target
.
evaluate
().
single
.
widget
;
input
.
onChanged
(
new
InputValue
(
text:
c
ommand
.
text
));
input
.
onChanged
(
new
InputValue
(
text:
setInputTextC
ommand
.
text
));
return
new
SetInputTextResult
();
}
Future
<
SubmitInputTextResult
>
_submitInputText
(
SubmitInputText
command
)
async
{
Finder
target
=
await
_waitForElement
(
_createFinder
(
command
.
finder
));
Future
<
SubmitInputTextResult
>
_submitInputText
(
Command
command
)
async
{
SubmitInputText
submitInputTextCommand
=
command
;
Finder
target
=
await
_waitForElement
(
_createFinder
(
submitInputTextCommand
.
finder
));
Input
input
=
target
.
evaluate
().
single
.
widget
;
input
.
onSubmitted
(
input
.
value
);
return
new
SubmitInputTextResult
(
input
.
value
.
text
);
}
Future
<
GetTextResult
>
getText
(
GetText
command
)
async
{
Finder
target
=
await
_waitForElement
(
_createFinder
(
command
.
finder
));
Future
<
GetTextResult
>
_getText
(
Command
command
)
async
{
GetText
getTextCommand
=
command
;
Finder
target
=
await
_waitForElement
(
_createFinder
(
getTextCommand
.
finder
));
// TODO(yjbanov): support more ways to read text
Text
text
=
target
.
evaluate
().
single
.
widget
;
return
new
GetTextResult
(
text
.
data
);
...
...
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