mirror of
https://github.com/flutter/flutter
synced 2024-10-14 04:02:56 +00:00
686d8f8a22
* Upgrade everything except matcher. * Roll matcher (and test) * Adjust tests that depend on flutter:test directly to depend on a shim * Require use of package:test shim and remove other references to package:test
44 lines
1.1 KiB
Dart
44 lines
1.1 KiB
Dart
// Copyright 2017 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 'package:flutter_tools/src/base/process.dart';
|
|
|
|
import '../src/common.dart';
|
|
import '../src/context.dart';
|
|
|
|
void main() {
|
|
group('shutdownHooks', () {
|
|
testUsingContext('runInExpectedOrder', () async {
|
|
int i = 1;
|
|
int serializeRecording1;
|
|
int serializeRecording2;
|
|
int postProcessRecording;
|
|
int cleanup;
|
|
|
|
addShutdownHook(() async {
|
|
serializeRecording1 = i++;
|
|
}, ShutdownStage.SERIALIZE_RECORDING);
|
|
|
|
addShutdownHook(() async {
|
|
cleanup = i++;
|
|
}, ShutdownStage.CLEANUP);
|
|
|
|
addShutdownHook(() async {
|
|
postProcessRecording = i++;
|
|
}, ShutdownStage.POST_PROCESS_RECORDING);
|
|
|
|
addShutdownHook(() async {
|
|
serializeRecording2 = i++;
|
|
}, ShutdownStage.SERIALIZE_RECORDING);
|
|
|
|
await runShutdownHooks();
|
|
|
|
expect(serializeRecording1, lessThanOrEqualTo(2));
|
|
expect(serializeRecording2, lessThanOrEqualTo(2));
|
|
expect(postProcessRecording, 3);
|
|
expect(cleanup, 4);
|
|
});
|
|
});
|
|
}
|