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

Side by Side Diff: tests/standalone/io/test_runner_test.dart

Issue 12417004: Update the test runner to use the new dart:io API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:isolate"; 5 import "dart:isolate";
6 import "dart:async"; 6 import "dart:async";
7 import "dart:utf"; 7 import "dart:utf";
8 import "../../../tools/testing/dart/test_runner.dart"; 8 import "../../../tools/testing/dart/test_runner.dart";
9 import "../../../tools/testing/dart/test_suite.dart"; 9 import "../../../tools/testing/dart/test_suite.dart";
10 import "../../../tools/testing/dart/status_file_parser.dart"; 10 import "../../../tools/testing/dart/status_file_parser.dart";
11 import "../../../tools/testing/dart/test_options.dart"; 11 import "../../../tools/testing/dart/test_options.dart";
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 TestCase _makeNormalTestCase(name, expectations) { 65 TestCase _makeNormalTestCase(name, expectations) {
66 var command = new Command(new Options().executable, 66 var command = new Command(new Options().executable,
67 [new Options().script, name]); 67 [new Options().script, name]);
68 return _makeTestCase(name, DEFAULT_TIMEOUT, command, expectations); 68 return _makeTestCase(name, DEFAULT_TIMEOUT, command, expectations);
69 } 69 }
70 70
71 _makeCrashTestCase(name, expectations) { 71 _makeCrashTestCase(name, expectations) {
72 var crashCommand = new Command(getProcessTestFileName(), 72 var crashCommand = new Command(getProcessTestFileName(),
73 ["0", "0", "1", "1"]); 73 ["0", "0", "1", "1"]);
74 // The crash test sometimes times out. Run it with a large timeout 74 // The crash test sometimes times out. Run it with a large timeout
75 // to help diagnose the delay. 75 // to help diagnose the delay.
76 // The test loads a new executable, which may sometimes take a long time. 76 // The test loads a new executable, which may sometimes take a long time.
77 // It involves a wait on the VM event loop, and possible system 77 // It involves a wait on the VM event loop, and possible system
78 // delays. 78 // delays.
79 return _makeTestCase(name, LONG_TIMEOUT, crashCommand, expectations); 79 return _makeTestCase(name, LONG_TIMEOUT, crashCommand, expectations);
80 } 80 }
81 81
82 _makeTestCase(name, timeout, command, expectations) { 82 _makeTestCase(name, timeout, command, expectations) {
83 var configuration = new TestOptionsParser() 83 var configuration = new TestOptionsParser()
84 .parse(['--timeout', '$timeout'])[0]; 84 .parse(['--timeout', '$timeout'])[0];
85 return new TestCase(name, 85 return new TestCase(name,
86 [command], 86 [command],
87 configuration, 87 configuration,
88 TestController.processCompletedTest, 88 TestController.processCompletedTest,
89 new Set<String>.from(expectations)); 89 new Set<String>.from(expectations));
90 } 90 }
91 } 91 }
92 92
93 void testProcessQueue() { 93 void testProcessQueue() {
94 var maxProcesses = 2; 94 var maxProcesses = 2;
95 var maxBrowserProcesses = maxProcesses; 95 var maxBrowserProcesses = maxProcesses;
96 new ProcessQueue(maxProcesses, maxBrowserProcesses, 96 new ProcessQueue(maxProcesses, maxBrowserProcesses,
97 new Date.now(), [new CustomTestSuite()], [], TestController.finished); 97 new DateTime.now(), [new CustomTestSuite()], [], TestController.finished);
98 } 98 }
99 99
100 void main() { 100 void main() {
101 // Run the test_runner_test if there are no command-line options. 101 // Run the test_runner_test if there are no command-line options.
102 // Otherwise, run one of the component tests that always pass, 102 // Otherwise, run one of the component tests that always pass,
103 // fail, or timeout. 103 // fail, or timeout.
104 var arguments = new Options().arguments; 104 var arguments = new Options().arguments;
105 if (arguments.isEmpty) { 105 if (arguments.isEmpty) {
106 testProcessQueue(); 106 testProcessQueue();
107 } else { 107 } else {
108 switch (arguments[0]) { 108 switch (arguments[0]) {
109 case 'pass': 109 case 'pass':
110 return; 110 return;
111 case 'fail-unexpected': 111 case 'fail-unexpected':
112 case 'fail': 112 case 'fail':
113 Expect.fail("This test always fails, to test the test scripts."); 113 Expect.fail("This test always fails, to test the test scripts.");
114 break; 114 break;
115 case 'timeout': 115 case 'timeout':
116 // Run for 10 seconds, then exit. This tests a 2 second timeout. 116 // Run for 10 seconds, then exit. This tests a 2 second timeout.
117 new Timer(new Duration(seconds: 10), (){ }); 117 new Timer(new Duration(seconds: 10), (){ });
118 break; 118 break;
119 default: 119 default:
120 throw "Unknown option ${arguments[0]} passed to test_runner_test"; 120 throw "Unknown option ${arguments[0]} passed to test_runner_test";
121 } 121 }
122 } 122 }
123 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698