Files
packages/script/tool/test/mocks.dart
stuartmorgan 6141051fa2 Add missing licenses, and add a check (#3720)
Adds a new CI check that all code files have a copyright+license block (and that it's one we are expecting to see).

Fixes the ~350 files (!) that did not have them. This includes all of the files in the .../example/ directories, following the example of flutter/flutter. (This does mean some manual intervention will be needed when generating new example directories in the future, but it's one-time per example.)

Also standardized some variants that used different line breaks than most of the rest of the repo (likely added since I standardized them all a while ago, but didn't add a check for at the time to enforce going forward), to simplify the checks.

Fixes flutter/flutter#77114
2021-03-16 17:50:51 -04:00

38 lines
1.0 KiB
Dart

// Copyright 2019 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 'dart:io' as io;
import 'package:file/file.dart';
import 'package:mockito/mockito.dart';
class MockProcess extends Mock implements io.Process {
final Completer<int> exitCodeCompleter = Completer<int>();
final StreamController<List<int>> stdoutController =
StreamController<List<int>>();
final StreamController<List<int>> stderrController =
StreamController<List<int>>();
final MockIOSink stdinMock = MockIOSink();
@override
Future<int> get exitCode => exitCodeCompleter.future;
@override
Stream<List<int>> get stdout => stdoutController.stream;
@override
Stream<List<int>> get stderr => stderrController.stream;
@override
IOSink get stdin => stdinMock;
}
class MockIOSink extends Mock implements IOSink {
List<String> lines = <String>[];
@override
void writeln([Object obj = ""]) => lines.add(obj);
}