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

Side by Side Diff: lib/src/utils.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) 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 test.utils; 5 library test.utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert';
8 import 'dart:math' as math; 9 import 'dart:math' as math;
9 10
10 import 'package:crypto/crypto.dart'; 11 import 'package:crypto/crypto.dart';
11 import 'package:path/path.dart' as p; 12 import 'package:path/path.dart' as p;
12 import 'package:shelf/shelf.dart' as shelf; 13 import 'package:shelf/shelf.dart' as shelf;
13 import 'package:stack_trace/stack_trace.dart'; 14 import 'package:stack_trace/stack_trace.dart';
14 15
15 import 'backend/operating_system.dart'; 16 import 'backend/operating_system.dart';
16 import 'util/path_handler.dart'; 17 import 'util/path_handler.dart';
17 18
18 /// A typedef for a possibly-asynchronous function. 19 /// A typedef for a possibly-asynchronous function.
19 /// 20 ///
20 /// The return type should only ever by [Future] or void. 21 /// The return type should only ever by [Future] or void.
21 typedef AsyncFunction(); 22 typedef AsyncFunction();
22 23
23 /// A typedef for a zero-argument callback function. 24 /// A typedef for a zero-argument callback function.
24 typedef void Callback(); 25 typedef void Callback();
25 26
27 /// A converter that decodes bytes using UTF-8 and splits them on newlines.
28 final lineSplitter = UTF8.decoder.fuse(const LineSplitter());
29
26 /// A regular expression to match the exception prefix that some exceptions' 30 /// A regular expression to match the exception prefix that some exceptions'
27 /// [Object.toString] values contain. 31 /// [Object.toString] values contain.
28 final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): '); 32 final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): ');
29 33
30 /// Directories that are specific to OS X. 34 /// Directories that are specific to OS X.
31 /// 35 ///
32 /// This is used to try to distinguish OS X and Linux in [currentOSGuess]. 36 /// This is used to try to distinguish OS X and Linux in [currentOSGuess].
33 final _macOSDirectories = new Set<String>.from([ 37 final _macOSDirectories = new Set<String>.from([
34 "/Applications", 38 "/Applications",
35 "/Library", 39 "/Library",
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 339 }
336 } 340 }
337 341
338 /// Returns middleware that nests all requests beneath the URL prefix [beneath]. 342 /// Returns middleware that nests all requests beneath the URL prefix [beneath].
339 shelf.Middleware nestingMiddleware(String beneath) { 343 shelf.Middleware nestingMiddleware(String beneath) {
340 return (handler) { 344 return (handler) {
341 var pathHandler = new PathHandler()..add(beneath, handler); 345 var pathHandler = new PathHandler()..add(beneath, handler);
342 return pathHandler.handler; 346 return pathHandler.handler;
343 }; 347 };
344 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698