mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

This patch makes `flutter start` work without a clone of the engine git repository. Making this work pulled a relatively large refactor of how the commands interact with application packages and devices. Now commands that want to interact with application packages or devices inherit from a common base class that holds stores of those objects as members. In production, the commands download and connect to devices based on the build configuration stored on the FlutterCommandRunner. In testing, these fields are used to mock out the real application package and devices.
31 lines
900 B
Dart
31 lines
900 B
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 trace_test;
|
|
|
|
import 'package:args/command_runner.dart';
|
|
import 'package:mockito/mockito.dart';
|
|
import 'package:sky_tools/src/commands/trace.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
import 'src/mocks.dart';
|
|
|
|
main() => defineTests();
|
|
|
|
defineTests() {
|
|
group('trace', () {
|
|
test('returns 1 when no Android device is connected', () {
|
|
TraceCommand command = new TraceCommand();
|
|
applyMocksToCommand(command);
|
|
MockDeviceStore mockDevices = command.devices;
|
|
|
|
when(mockDevices.android.isConnected()).thenReturn(false);
|
|
|
|
CommandRunner runner = new CommandRunner('test_flutter', '')
|
|
..addCommand(command);
|
|
runner.run(['trace']).then((int code) => expect(code, equals(1)));
|
|
});
|
|
});
|
|
}
|