Fix missing await (#9617)

Fixes #9612
This commit is contained in:
Todd Volkert 2017-04-26 13:14:31 -07:00 committed by GitHub
parent 0f900116f0
commit e2cd78358f
2 changed files with 5 additions and 3 deletions

View File

@ -655,7 +655,7 @@ Future<Map<String, dynamic>> _deviceToMap(Device device) async {
'id': device.id,
'name': device.name,
'platform': getNameForTargetPlatform(await device.targetPlatform),
'emulator': device.isLocalEmulator
'emulator': await device.isLocalEmulator,
};
}

View File

@ -2,6 +2,8 @@
// 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:file/memory.dart';
import 'package:flutter_tools/src/android/android_device.dart';
import 'package:flutter_tools/src/base/common.dart';
@ -242,7 +244,7 @@ void main() {
testUsingContext('uses existing emulator', () async {
withMockDevice();
when(mockDevice.name).thenReturn('mock-simulator');
when(mockDevice.isLocalEmulator).thenReturn(true);
when(mockDevice.isLocalEmulator).thenReturn(new Future<bool>.value(true));
final Device device = await findTargetDevice();
expect(device.name, 'mock-simulator');
@ -254,7 +256,7 @@ void main() {
testUsingContext('uses existing Android device if and there are no simulators', () async {
mockDevice = new MockAndroidDevice();
when(mockDevice.name).thenReturn('mock-android-device');
when(mockDevice.isLocalEmulator).thenReturn(false);
when(mockDevice.isLocalEmulator).thenReturn(new Future<bool>.value(false));
withMockDevice(mockDevice);
final Device device = await findTargetDevice();