flutter/packages/flutter_tools/test/install_test.dart
Ian Fischer 0cc758d24e Set up plumbing for getting relevant paths to the right places without too much global state.
`dart bin/sky_tools.dart --debug --sky-src-path=/path/to/sky/src/ install` now works.
2015-09-22 11:17:39 -07:00

36 lines
1.1 KiB
Dart

// 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.
library install_test;
import 'package:mockito/mockito.dart';
import 'package:sky_tools/src/install.dart';
import 'package:sky_tools/src/application_package.dart';
import 'package:test/test.dart';
import 'src/common.dart';
main() => defineTests();
defineTests() {
group('install', () {
test('returns 0 when Android is connected and ready for an install', () {
ApplicationPackageFactory.srcPath = './';
ApplicationPackageFactory.setBuildPath(
BuildType.prebuilt, BuildPlatform.android, './');
MockAndroidDevice android = new MockAndroidDevice();
when(android.isConnected()).thenReturn(true);
when(android.installApp(any)).thenReturn(true);
InstallCommandHandler handler = new InstallCommandHandler(android);
MockArgResults results = new MockArgResults();
when(results['help']).thenReturn(false);
handler
.processArgResults(results)
.then((int code) => expect(code, equals(0)));
});
});
}