Basic sky_tools list command, Android implementation, and test.

This commit is contained in:
Ian Fischer
2015-09-30 15:24:39 -07:00
parent b8085cd033
commit d07ca92995
6 changed files with 131 additions and 7 deletions

View File

@@ -18,14 +18,14 @@ defineTests() {
test('stores the requested id', () {
String deviceID = '1234';
AndroidDevice android = new AndroidDevice(deviceID);
AndroidDevice android = new AndroidDevice(id: deviceID);
expect(android.id, equals(deviceID));
});
test('correctly creates only one of each requested device id', () {
String deviceID = '1234';
AndroidDevice a1 = new AndroidDevice(deviceID);
AndroidDevice a2 = new AndroidDevice(deviceID);
AndroidDevice a1 = new AndroidDevice(id: deviceID);
AndroidDevice a2 = new AndroidDevice(id: deviceID);
expect(a1, equals(a2));
});
});

View File

@@ -0,0 +1,30 @@
// 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 list_test;
import 'package:args/command_runner.dart';
import 'package:mockito/mockito.dart';
import 'package:sky_tools/src/list.dart';
import 'package:test/test.dart';
import 'src/common.dart';
main() => defineTests();
defineTests() {
group('list', () {
test('returns 0 when called', () {
MockAndroidDevice android = new MockAndroidDevice();
// Avoid relying on adb being installed on the test system.
// Instead, cause the test to run the echo command.
when(android.adbPath).thenReturn('echo');
ListCommand command = new ListCommand(android);
CommandRunner runner = new CommandRunner('test_flutter', '')
..addCommand(command);
runner.run(['list']).then((int code) => expect(code, equals(0)));
});
});
}