Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 part of unittest; | |
| 6 | |
| 7 /// Class for encapsulating test environment state. | |
| 8 /// This is used by the withTestEnvironment method to support multiple | |
| 9 /// invocations of the unittest library with the same application | |
| 10 /// instance. | |
| 11 class TestEnvironment { | |
|
kevmoo
2014/11/11 15:09:16
Does this class need to be public? Is it exposed a
wibling
2014/11/11 15:16:34
Good point. I have made it private.
| |
| 12 Configuration config = null; | |
| 13 | |
| 14 // We use a 'dummy' context for the top level to eliminate null | |
| 15 // checks when querying the context. This allows us to easily | |
| 16 // support top-level setUp/tearDown functions as well. | |
| 17 final rootContext = new _GroupContext(); | |
| 18 _GroupContext currentContext; | |
| 19 | |
| 20 /// Represents the index of the currently running test case | |
| 21 /// == -1 implies the test system is not running | |
| 22 /// == [number of test cases] is a short-lived state flagging that the last | |
| 23 /// test has completed | |
| 24 int currentTestCaseIndex = -1; | |
| 25 | |
| 26 /// Whether the framework is in an initialized state. | |
| 27 bool initialized = false; | |
| 28 | |
| 29 /// Time since we last gave non-sync code a chance to be scheduled. | |
| 30 int lastBreath = new DateTime.now().millisecondsSinceEpoch; | |
| 31 | |
| 32 /// The set of tests to run can be restricted by using [solo_test] and | |
| 33 /// [solo_group]. | |
| 34 /// As groups can be nested we use a counter to keep track of the nest level | |
| 35 /// of soloing, and a flag to tell if we have seen any solo tests. | |
| 36 int soloNestingLevel = 0; | |
| 37 bool soloTestSeen = false; | |
| 38 | |
| 39 final List<TestCase> testCases = new List<TestCase>(); | |
| 40 | |
| 41 String uncaughtErrorMessage = null; | |
| 42 | |
| 43 TestEnvironment() { | |
| 44 currentContext = rootContext; | |
| 45 } | |
| 46 } | |
| OLD | NEW |