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

Side by Side Diff: test/runner/pub_serve_test.dart

Issue 1187103004: Allow Suites to be added to an Engine over time. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 @TestOn("vm") 5 @TestOn("vm")
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 import 'package:test/src/util/exit_codes.dart' as exit_codes; 10 import 'package:test/src/util/exit_codes.dart' as exit_codes;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 test("gracefully handles pub serve running on the wrong directory for " 129 test("gracefully handles pub serve running on the wrong directory for "
130 "VM tests", () async { 130 "VM tests", () async {
131 new Directory(p.join(_sandbox, "web")).createSync(); 131 new Directory(p.join(_sandbox, "web")).createSync();
132 132
133 var pair = await startPubServe(args: ['web'], workingDirectory: _sandbox); 133 var pair = await startPubServe(args: ['web'], workingDirectory: _sandbox);
134 try { 134 try {
135 var result = runTest(['--pub-serve=${pair.last}'], 135 var result = runTest(['--pub-serve=${pair.last}'],
136 workingDirectory: _sandbox); 136 workingDirectory: _sandbox);
137 expect(result.stdout, allOf([ 137 expect(result.stdout, allOf([
138 contains('-1: load error'), 138 contains('-1: ${p.join("test", "my_test.dart")}: load error'),
139 contains('Failed to load "${p.join("test", "my_test.dart")}":'), 139 contains('Failed to load "${p.join("test", "my_test.dart")}":'),
140 contains('404 Not Found'), 140 contains('404 Not Found'),
141 contains('Make sure "pub serve" is serving the test/ directory.') 141 contains('Make sure "pub serve" is serving the test/ directory.')
142 ])); 142 ]));
143 expect(result.exitCode, equals(1)); 143 expect(result.exitCode, equals(1));
144 } finally { 144 } finally {
145 pair.first.kill(); 145 pair.first.kill();
146 } 146 }
147 }); 147 });
148 148
149 test("gracefully handles pub serve running on the wrong directory for " 149 test("gracefully handles pub serve running on the wrong directory for "
150 "browser tests", () async { 150 "browser tests", () async {
151 new Directory(p.join(_sandbox, "web")).createSync(); 151 new Directory(p.join(_sandbox, "web")).createSync();
152 152
153 var pair = await startPubServe(args: ['web'], workingDirectory: _sandbox); 153 var pair = await startPubServe(args: ['web'], workingDirectory: _sandbox);
154 try { 154 try {
155 var result = runTest(['--pub-serve=${pair.last}', '-p', 'chrome'], 155 var result = runTest(['--pub-serve=${pair.last}', '-p', 'chrome'],
156 workingDirectory: _sandbox); 156 workingDirectory: _sandbox);
157 expect(result.stdout, allOf([ 157 expect(result.stdout, allOf([
158 contains('-1: load error'), 158 contains('-1: ${p.join("test", "my_test.dart")}: load error'),
159 contains('Failed to load "${p.join("test", "my_test.dart")}":'), 159 contains('Failed to load "${p.join("test", "my_test.dart")}":'),
160 contains('404 Not Found'), 160 contains('404 Not Found'),
161 contains('Make sure "pub serve" is serving the test/ directory.') 161 contains('Make sure "pub serve" is serving the test/ directory.')
162 ])); 162 ]));
163 expect(result.exitCode, equals(1)); 163 expect(result.exitCode, equals(1));
164 } finally { 164 } finally {
165 pair.first.kill(); 165 pair.first.kill();
166 } 166 }
167 }); 167 });
168 168
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } finally { 293 } finally {
294 pair.first.kill(); 294 pair.first.kill();
295 } 295 }
296 }); 296 });
297 }); 297 });
298 298
299 test("gracefully handles pub serve not running for VM tests", () { 299 test("gracefully handles pub serve not running for VM tests", () {
300 var result = runTest(['--pub-serve=54321'], 300 var result = runTest(['--pub-serve=54321'],
301 workingDirectory: _sandbox); 301 workingDirectory: _sandbox);
302 expect(result.stdout, allOf([ 302 expect(result.stdout, allOf([
303 contains('-1: load error'), 303 contains('-1: ${p.join("test", "my_test.dart")}: load error'),
304 contains(''' 304 contains('''
305 Failed to load "${p.join("test", "my_test.dart")}": 305 Failed to load "${p.join("test", "my_test.dart")}":
306 Error getting http://localhost:54321/my_test.dart.vm_test.dart: Connection ref used 306 Error getting http://localhost:54321/my_test.dart.vm_test.dart: Connection ref used
307 Make sure "pub serve" is running.''') 307 Make sure "pub serve" is running.''')
308 ])); 308 ]));
309 expect(result.exitCode, equals(1)); 309 expect(result.exitCode, equals(1));
310 }); 310 });
311 311
312 test("gracefully handles pub serve not running for browser tests", () { 312 test("gracefully handles pub serve not running for browser tests", () {
313 var result = runTest(['--pub-serve=54321', '-p', 'chrome'], 313 var result = runTest(['--pub-serve=54321', '-p', 'chrome'],
314 workingDirectory: _sandbox); 314 workingDirectory: _sandbox);
315 var message = Platform.isWindows 315 var message = Platform.isWindows
316 ? 'The remote computer refused the network connection.' 316 ? 'The remote computer refused the network connection.'
317 : 'Connection refused (errno '; 317 : 'Connection refused (errno ';
318 318
319 expect(result.stdout, allOf([ 319 expect(result.stdout, allOf([
320 contains('-1: load error'), 320 contains('-1: ${p.join("test", "my_test.dart")}: load error'),
321 contains('Failed to load "${p.join("test", "my_test.dart")}":'), 321 contains('Failed to load "${p.join("test", "my_test.dart")}":'),
322 contains('Error getting http://localhost:54321/my_test.dart.browser_test' 322 contains('Error getting http://localhost:54321/my_test.dart.browser_test'
323 '.dart.js.map: $message'), 323 '.dart.js.map: $message'),
324 contains('Make sure "pub serve" is running.') 324 contains('Make sure "pub serve" is running.')
325 ])); 325 ]));
326 expect(result.exitCode, equals(1)); 326 expect(result.exitCode, equals(1));
327 }); 327 });
328 328
329 test("gracefully handles a test file not being in test/", () { 329 test("gracefully handles a test file not being in test/", () {
330 new File(p.join(_sandbox, 'test/my_test.dart')) 330 new File(p.join(_sandbox, 'test/my_test.dart'))
331 .copySync(p.join(_sandbox, 'my_test.dart')); 331 .copySync(p.join(_sandbox, 'my_test.dart'));
332 332
333 var result = runTest(['--pub-serve=54321', 'my_test.dart'], 333 var result = runTest(['--pub-serve=54321', 'my_test.dart'],
334 workingDirectory: _sandbox); 334 workingDirectory: _sandbox);
335 expect(result.stdout, allOf([ 335 expect(result.stdout, allOf([
336 contains('-1: load error'), 336 contains('-1: load error'),
337 contains( 337 contains(
338 'Failed to load "my_test.dart": When using "pub serve", all test ' 338 'Failed to load "my_test.dart": When using "pub serve", all test '
339 'files must be in test/.\n') 339 'files must be in test/.\n')
340 ])); 340 ]));
341 expect(result.exitCode, equals(1)); 341 expect(result.exitCode, equals(1));
342 }); 342 });
343 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698