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
e6971136
Unverified
Commit
e6971136
authored
Dec 14, 2021
by
godofredoc
Committed by
GitHub
Dec 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a home method to device classes. (#95103)
parent
70fea6d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
devices.dart
dev/devicelab/lib/framework/devices.dart
+18
-0
framework.dart
dev/devicelab/lib/framework/framework.dart
+4
-0
No files found.
dev/devicelab/lib/framework/devices.dart
View file @
e6971136
...
@@ -124,6 +124,9 @@ abstract class Device {
...
@@ -124,6 +124,9 @@ abstract class Device {
/// Send the device to sleep mode.
/// Send the device to sleep mode.
Future
<
void
>
sendToSleep
();
Future
<
void
>
sendToSleep
();
/// Emulates pressing the home button.
Future
<
void
>
home
();
/// Emulates pressing the power button, toggling the device's on/off state.
/// Emulates pressing the power button, toggling the device's on/off state.
Future
<
void
>
togglePower
();
Future
<
void
>
togglePower
();
...
@@ -470,6 +473,12 @@ class AndroidDevice extends Device {
...
@@ -470,6 +473,12 @@ class AndroidDevice extends Device {
await
togglePower
();
await
togglePower
();
}
}
/// Sends `KEYCODE_HOME` (3), which causes the device to go to the home screen.
@override
Future
<
void
>
home
()
async
{
await
shellExec
(
'input'
,
const
<
String
>[
'keyevent'
,
'3'
]);
}
/// Sends `KEYCODE_POWER` (26), which causes the device to toggle its mode
/// Sends `KEYCODE_POWER` (26), which causes the device to toggle its mode
/// between awake and asleep.
/// between awake and asleep.
@override
@override
...
@@ -895,6 +904,9 @@ class IosDevice extends Device {
...
@@ -895,6 +904,9 @@ class IosDevice extends Device {
@override
@override
Future
<
void
>
sendToSleep
()
async
{}
Future
<
void
>
sendToSleep
()
async
{}
@override
Future
<
void
>
home
()
async
{}
@override
@override
Future
<
void
>
togglePower
()
async
{}
Future
<
void
>
togglePower
()
async
{}
...
@@ -945,6 +957,9 @@ class FuchsiaDevice extends Device {
...
@@ -945,6 +957,9 @@ class FuchsiaDevice extends Device {
@override
@override
Future
<
void
>
sendToSleep
()
async
{}
Future
<
void
>
sendToSleep
()
async
{}
@override
Future
<
void
>
home
()
async
{}
@override
@override
Future
<
void
>
togglePower
()
async
{}
Future
<
void
>
togglePower
()
async
{}
...
@@ -1011,6 +1026,9 @@ class FakeDevice extends Device {
...
@@ -1011,6 +1026,9 @@ class FakeDevice extends Device {
@override
@override
Future
<
void
>
sendToSleep
()
async
{}
Future
<
void
>
sendToSleep
()
async
{}
@override
Future
<
void
>
home
()
async
{}
@override
@override
Future
<
void
>
togglePower
()
async
{}
Future
<
void
>
togglePower
()
async
{}
...
...
dev/devicelab/lib/framework/framework.dart
View file @
e6971136
...
@@ -144,6 +144,10 @@ class _TaskRunner {
...
@@ -144,6 +144,10 @@ class _TaskRunner {
}
}
final
Device
?
device
=
await
_getWorkingDeviceIfAvailable
();
final
Device
?
device
=
await
_getWorkingDeviceIfAvailable
();
// Some tests assume the phone is in home
await
device
?.
home
();
late
TaskResult
result
;
late
TaskResult
result
;
IOSink
?
sink
;
IOSink
?
sink
;
try
{
try
{
...
...
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