flutter/packages/flutter_tools/test/commands/install_test.dart

39 lines
1.4 KiB
Dart
Raw Normal View History

2015-09-11 22:00:02 +00:00
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
2015-11-10 21:18:34 +00:00
import 'package:flutter_tools/src/commands/install.dart';
2017-03-10 21:53:22 +00:00
import 'package:mockito/mockito.dart';
2015-09-11 22:00:02 +00:00
import '../src/common.dart';
import '../src/context.dart';
import '../src/mocks.dart';
2015-09-11 23:12:27 +00:00
void main() {
2015-09-11 22:00:02 +00:00
group('install', () {
testUsingContext('returns 0 when Android is connected and ready for an install', () async {
final InstallCommand command = InstallCommand();
applyMocksToCommand(command);
final MockAndroidDevice device = MockAndroidDevice();
when(device.isAppInstalled(any)).thenAnswer((_) async => false);
when(device.installApp(any)).thenAnswer((_) async => true);
2016-03-11 16:49:55 +00:00
testDeviceManager.addDevice(device);
await createTestCommandRunner(command).run(<String>['install']);
});
testUsingContext('returns 0 when iOS is connected and ready for an install', () async {
final InstallCommand command = InstallCommand();
applyMocksToCommand(command);
final MockIOSDevice device = MockIOSDevice();
when(device.isAppInstalled(any)).thenAnswer((_) async => false);
when(device.installApp(any)).thenAnswer((_) async => true);
2016-03-11 16:49:55 +00:00
testDeviceManager.addDevice(device);
await createTestCommandRunner(command).run(<String>['install']);
2015-09-11 22:00:02 +00:00
});
});
}