Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: tests/utils/dependency_graph_test.dart

Issue 22156002: Fix in test_runner_test, moved dependency_graph_test to standalone/io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/test_runner_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, 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 import 'package:expect/expect.dart';
6
7 import '../../tools/testing/dart/dependency_graph.dart' as graph;
8
9 main() {
10 var dgraph = new graph.Graph();
11 var numberOfEvents = 0;
12 var eventAssertions = [];
13
14 graph.Node newNode(int i, List deps) {
15 graph.Node node = dgraph.newNode(i, deps);
16 Expect.isTrue(node.userData == i);
17 Expect.isTrue(dgraph.nodes.contains(node));
18 for (var dep in deps) {
19 Expect.isTrue(node.dependencies.contains(dep));
20 Expect.isTrue(dep.neededFor.contains(node));
21 }
22
23 numberOfEvents++;
24 eventAssertions.add((event) {
25 Expect.isTrue(event is graph.NodeAddedEvent);
26 Expect.isTrue(event.node == node);
27 });
28
29 return node;
30 }
31
32 changeState(graph.Node node, graph.NodeState newState) {
33 var oldState = node.state;
34
35 dgraph.changeState(node, newState);
36 Expect.isTrue(node.state == newState);
37
38 numberOfEvents++;
39 eventAssertions.add((event) {
40 Expect.isTrue(event is graph.StateChangedEvent);
41 Expect.isTrue(event.node == node);
42 Expect.isTrue(event.from == oldState);
43 Expect.isTrue(event.to == newState);
44 });
45 }
46
47 var node1, node2, node3;
48
49 node1 = newNode(1, []);
50 changeState(node1, graph.NodeState.Processing);
51 node2 = newNode(2, [node1]);
52 changeState(node1, graph.NodeState.Successful);
53 node3 = newNode(3, [node1, node2]);
54 changeState(node2, graph.NodeState.Failed);
55 changeState(node3, graph.NodeState.UnableToRun);
56
57 dgraph.events.take(numberOfEvents).toList().then((events) {
58 for (var i=0; i<events.length; i++) {
59 eventAssertions[i](events[i]);
60 }
61 });
62 }
OLDNEW
« no previous file with comments | « tests/standalone/io/test_runner_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698