Add listen command and basic test, and don’t do unnecessary repeated work when listening or poking the android server.
This commit is contained in:
34
packages/flutter_tools/test/listen_test.dart
Normal file
34
packages/flutter_tools/test/listen_test.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
// 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 stop_test;
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:sky_tools/src/application_package.dart';
|
||||
import 'package:sky_tools/src/listen.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'src/common.dart';
|
||||
|
||||
main() => defineTests();
|
||||
|
||||
defineTests() {
|
||||
group('listen', () {
|
||||
test('returns 0 when no device is connected', () {
|
||||
ApplicationPackageFactory.srcPath = './';
|
||||
ApplicationPackageFactory.setBuildPath(
|
||||
BuildType.prebuilt, BuildPlatform.android, './');
|
||||
|
||||
MockAndroidDevice android = new MockAndroidDevice();
|
||||
when(android.isConnected()).thenReturn(false);
|
||||
ListenCommand command =
|
||||
new ListenCommand(android: android, singleRun: true);
|
||||
|
||||
CommandRunner runner = new CommandRunner('test_flutter', '')
|
||||
..addCommand(command);
|
||||
runner.run(['listen']).then((int code) => expect(code, equals(0)));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user