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
11bf7f06
Unverified
Commit
11bf7f06
authored
Jul 06, 2020
by
Jenn Magder
Committed by
GitHub
Jul 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take screenshots of wirelessly paired iOS devices (#60623)
parent
60deae85
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
6 deletions
+45
-6
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+2
-2
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+8
-1
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+35
-3
No files found.
packages/flutter_tools/lib/src/ios/devices.dart
View file @
11bf7f06
...
...
@@ -509,11 +509,11 @@ class IOSDevice extends Device {
void
clearLogs
()
{
}
@override
bool
get
supportsScreenshot
=>
_iMobileDevice
.
isInstalled
&&
interfaceType
==
IOSDeviceInterface
.
usb
;
bool
get
supportsScreenshot
=>
_iMobileDevice
.
isInstalled
;
@override
Future
<
void
>
takeScreenshot
(
File
outputFile
)
async
{
await
_iMobileDevice
.
takeScreenshot
(
outputFile
,
id
);
await
_iMobileDevice
.
takeScreenshot
(
outputFile
,
id
,
interfaceType
);
}
@override
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
11bf7f06
...
...
@@ -24,6 +24,7 @@ import '../macos/xcode.dart';
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
import
'code_signing.dart'
;
import
'devices.dart'
;
import
'migrations/ios_migrator.dart'
;
import
'migrations/project_base_configuration_migration.dart'
;
import
'migrations/remove_framework_link_and_embedding_migration.dart'
;
...
...
@@ -66,13 +67,19 @@ class IMobileDevice {
}
/// Captures a screenshot to the specified outputFile.
Future
<
void
>
takeScreenshot
(
File
outputFile
,
String
deviceID
)
{
Future
<
void
>
takeScreenshot
(
File
outputFile
,
String
deviceID
,
IOSDeviceInterface
interfaceType
,
)
{
return
_processUtils
.
run
(
<
String
>[
_idevicescreenshotPath
,
outputFile
.
path
,
'--udid'
,
deviceID
,
if
(
interfaceType
==
IOSDeviceInterface
.
network
)
'--network'
,
],
throwOnError:
true
,
environment:
Map
<
String
,
String
>.
fromEntries
(
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
11bf7f06
...
...
@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/globals.dart'
as
globals
;
import
'package:flutter_tools/src/ios/devices.dart'
;
import
'package:flutter_tools/src/ios/mac.dart'
;
import
'package:flutter_tools/src/ios/xcodeproj.dart'
;
import
'package:flutter_tools/src/project.dart'
;
...
...
@@ -85,10 +86,14 @@ void main() {
logger:
logger
,
);
expect
(()
async
=>
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
,
'1234'
),
throwsA
(
anything
));
expect
(()
async
=>
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
,
'1234'
,
IOSDeviceInterface
.
usb
,
),
throwsA
(
anything
));
});
testWithoutContext
(
'idevicescreenshot captures and returns screenshot'
,
()
async
{
testWithoutContext
(
'idevicescreenshot captures and returns
USB
screenshot'
,
()
async
{
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
),
workingDirectory:
null
)).
thenAnswer
(
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
...
...
@@ -100,12 +105,39 @@ void main() {
logger:
logger
,
);
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
,
'1234'
);
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
,
'1234'
,
IOSDeviceInterface
.
usb
,
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputPath
,
'--udid'
,
'1234'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
workingDirectory:
null
,
));
});
testWithoutContext
(
'idevicescreenshot captures and returns network screenshot'
,
()
async
{
when
(
mockOutputFile
.
path
).
thenReturn
(
outputPath
);
when
(
mockProcessManager
.
run
(
any
,
environment:
anyNamed
(
'environment'
),
workingDirectory:
null
)).
thenAnswer
(
(
Invocation
invocation
)
=>
Future
<
ProcessResult
>.
value
(
ProcessResult
(
4
,
0
,
''
,
''
)));
final
IMobileDevice
iMobileDevice
=
IMobileDevice
(
artifacts:
mockArtifacts
,
cache:
mockCache
,
processManager:
mockProcessManager
,
logger:
logger
,
);
await
iMobileDevice
.
takeScreenshot
(
mockOutputFile
,
'1234'
,
IOSDeviceInterface
.
network
,
);
verify
(
mockProcessManager
.
run
(<
String
>[
idevicescreenshotPath
,
outputPath
,
'--udid'
,
'1234'
,
'--network'
],
environment:
<
String
,
String
>{
'DYLD_LIBRARY_PATH'
:
libimobiledevicePath
},
workingDirectory:
null
,
));
});
});
});
...
...
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