mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
30720bd148
* Change async stubbing to use thenAnswer.
Mockito now prohibits calling thenReturn with Futures and Streams. dart-lang/mockito#79
* Update all Mockito deps to 3.0.0.
* Revert "Update all Mockito deps to 3.0.0."
This reverts commit e8ab9d37c3
.
I did not correctly update the mockito dep, and there's no easy way to update to 3.0 alpha right now.
* Change thenAnswer((_) => to thenAnswer((invocation) =>
* Add Invocation type to thenAnswer lambdas
42 lines
1.4 KiB
Dart
42 lines
1.4 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.
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:flutter_tools/src/cache.dart';
|
|
import 'package:flutter_tools/src/commands/stop.dart';
|
|
import 'package:mockito/mockito.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
import 'src/common.dart';
|
|
import 'src/context.dart';
|
|
import 'src/mocks.dart';
|
|
|
|
void main() {
|
|
group('stop', () {
|
|
setUpAll(() {
|
|
Cache.disableLocking();
|
|
});
|
|
|
|
testUsingContext('returns 0 when Android is connected and ready to be stopped', () async {
|
|
final StopCommand command = new StopCommand();
|
|
applyMocksToCommand(command);
|
|
final MockAndroidDevice device = new MockAndroidDevice();
|
|
when(device.stopApp(any)).thenAnswer((Invocation invocation) => new Future<bool>.value(true));
|
|
testDeviceManager.addDevice(device);
|
|
await createTestCommandRunner(command).run(<String>['stop']);
|
|
});
|
|
|
|
testUsingContext('returns 0 when iOS is connected and ready to be stopped', () async {
|
|
final StopCommand command = new StopCommand();
|
|
applyMocksToCommand(command);
|
|
final MockIOSDevice device = new MockIOSDevice();
|
|
when(device.stopApp(any)).thenAnswer((Invocation invocation) => new Future<bool>.value(true));
|
|
testDeviceManager.addDevice(device);
|
|
|
|
await createTestCommandRunner(command).run(<String>['stop']);
|
|
});
|
|
});
|
|
}
|