Implement takeScreenshot and add driver test for Fuchsia (#48611)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/framework/adb.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/integration_tests.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.fuchsia;
|
||||
await task(createFlutterDriverScreenshotTest());
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"program": {
|
||||
"data": "data/flutter_driver_screenshot_test"
|
||||
},
|
||||
"sandbox": {
|
||||
"services": [
|
||||
"fuchsia.cobalt.LoggerFactory",
|
||||
"fuchsia.fonts.Provider",
|
||||
"fuchsia.logger.LogSink",
|
||||
"fuchsia.modular.Clipboard",
|
||||
"fuchsia.modular.ContextWriter",
|
||||
"fuchsia.modular.DeviceMap",
|
||||
"fuchsia.modular.ModuleContext",
|
||||
"fuchsia.sys.Environment",
|
||||
"fuchsia.sys.Launcher",
|
||||
"fuchsia.testing.runner.TestRunner",
|
||||
"fuchsia.ui.input.ImeService",
|
||||
"fuchsia.ui.policy.Presenter",
|
||||
"fuchsia.ui.scenic.Scenic"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -71,28 +71,20 @@ class _MyHomePageState extends State<_MyHomePage> {
|
||||
Future<String> _handleDriverMessage(String message) async {
|
||||
switch (message) {
|
||||
case 'device_model':
|
||||
String target;
|
||||
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
switch (Theme.of(context).platform) {
|
||||
case TargetPlatform.iOS:
|
||||
target = 'ios';
|
||||
break;
|
||||
case TargetPlatform.android:
|
||||
target = 'android';
|
||||
break;
|
||||
default:
|
||||
target = 'unsupported';
|
||||
break;
|
||||
}
|
||||
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
if (target == 'ios') {
|
||||
final IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
|
||||
if (iosDeviceInfo.isPhysicalDevice) {
|
||||
return iosDeviceInfo.utsname.machine;
|
||||
} else {
|
||||
final IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
|
||||
if (iosDeviceInfo.isPhysicalDevice) {
|
||||
return iosDeviceInfo.utsname.machine;
|
||||
}
|
||||
return 'sim_' + iosDeviceInfo.name;
|
||||
}
|
||||
} else if (target == 'android') {
|
||||
return (await deviceInfo.androidInfo).model;
|
||||
case TargetPlatform.android:
|
||||
return (await deviceInfo.androidInfo).model;
|
||||
case TargetPlatform.fuchsia:
|
||||
return 'fuchsia';
|
||||
default:
|
||||
return 'unsupported';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user