• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import 'dart:async';
6import '../base/io.dart' show Process;
7
8/// Callbacks for reporting progress while running tests.
9abstract class TestWatcher {
10  /// Called after a child process starts.
11  ///
12  /// If startPaused was true, the caller needs to resume in Observatory to
13  /// start running the tests.
14  void handleStartedProcess(ProcessEvent event) { }
15
16  /// Called after the tests finish but before the process exits.
17  ///
18  /// The child process won't exit until this method completes.
19  /// Not called if the process died.
20  Future<void> handleFinishedTest(ProcessEvent event) async { }
21
22  /// Called when the test process crashed before connecting to test harness.
23  Future<void> handleTestCrashed(ProcessEvent event) async { }
24
25  /// Called if we timed out waiting for the test process to connect to test
26  /// harness.
27  Future<void> handleTestTimedOut(ProcessEvent event) async { }
28}
29
30/// Describes a child process started during testing.
31class ProcessEvent {
32  ProcessEvent(this.childIndex, this.process, [this.observatoryUri]);
33
34  /// The index assigned when the child process was launched.
35  ///
36  /// Indexes are assigned consecutively starting from zero.
37  /// When debugging, there should only be one child process so this will
38  /// always be zero.
39  final int childIndex;
40
41  final Process process;
42
43  /// The observatory URL or null if not debugging.
44  final Uri observatoryUri;
45}
46