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

Side by Side Diff: pkg/scheduled_test/test/scheduled_server_test.dart

Issue 12678011: Miscellaneous small improvements for scheduled_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Miscellaneous additional fixes. 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) 2013, 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 library scheduled_server_test; 5 library scheduled_server_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import '../../../pkg/http/lib/http.dart' as http; 10 import '../../../pkg/http/lib/http.dart' as http;
(...skipping 17 matching lines...) Expand all
28 errors = currentSchedule.errors; 28 errors = currentSchedule.errors;
29 }); 29 });
30 30
31 var server = new ScheduledServer(); 31 var server = new ScheduledServer();
32 expect(server.url.then((url) => http.read(url.resolve('/hello'))), 32 expect(server.url.then((url) => http.read(url.resolve('/hello'))),
33 completion(equals('Hello, test!'))); 33 completion(equals('Hello, test!')));
34 }); 34 });
35 35
36 test('test 2', () { 36 test('test 2', () {
37 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 37 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
38 expect(errors.length, equals(2)); 38 // TODO(nweiz): There can be three errors due to issue 9151. The
39 // HttpParserException is reported without a stack trace, and so when it's
40 // wrapped twice it registers as a different exception each time (because
41 // it's given an ad-hoc stack trace). Always expect two exceptions when
42 // issue 9151 is fixed.
43 expect(errors.length, inInclusiveRange(2, 3));
39 expect(errors[0].error, equals("'scheduled server 0' received GET /hello " 44 expect(errors[0].error, equals("'scheduled server 0' received GET /hello "
40 "when no more requests were expected.")); 45 "when no more requests were expected."));
41 expect(errors[1].error, new isInstanceOf<HttpParserException>()); 46 expect(errors[1].error, new isInstanceOf<HttpParserException>());
47 if (errors[2] != null) {
48 expect(errors[2].error, new isInstanceOf<HttpParserException>());
49 }
42 }); 50 });
43 }, passing: ['test 2']); 51 }, passing: ['test 2']);
44 52
45 expectTestsPass("a handler runs when it's hit", () { 53 expectTestsPass("a handler runs when it's hit", () {
46 test('test', () { 54 test('test', () {
47 var server = new ScheduledServer(); 55 var server = new ScheduledServer();
48 expect(server.url.then((url) => http.read(url.resolve('/hello'))), 56 expect(server.url.then((url) => http.read(url.resolve('/hello'))),
49 completion(equals('Hello, test!'))); 57 completion(equals('Hello, test!')));
50 58
51 server.handle('GET', '/hello', (request) { 59 server.handle('GET', '/hello', (request) {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 }); 304 });
297 305
298 test('test 2', () { 306 test('test 2', () {
299 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); 307 expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
300 expect(errors.length, equals(2)); 308 expect(errors.length, equals(2));
301 expect(errors[0].error, equals('oh no')); 309 expect(errors[0].error, equals('oh no'));
302 expect(errors[1].error, new isInstanceOf<HttpParserException>()); 310 expect(errors[1].error, new isInstanceOf<HttpParserException>());
303 }); 311 });
304 }, passing: ['test 2']); 312 }, passing: ['test 2']);
305 } 313 }
OLDNEW
« pkg/scheduled_test/lib/src/schedule_error.dart ('K') | « pkg/scheduled_test/lib/src/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698