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

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

Issue 2466363003: Allow Platform.executable for JIT app snapshots. (Closed)
Patch Set: . Created 4 years, 1 month 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 // OtherResources=http_client_stays_alive_test.dart
6
5 import 'dart:io'; 7 import 'dart:io';
6 8
7 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
8 10
9 // NOTE: This test tries to ensure that an HttpClient will close it's 11 // NOTE: This test tries to ensure that an HttpClient will close it's
10 // underlying idle connections after [HttpClient.idleTimeout]. 12 // underlying idle connections after [HttpClient.idleTimeout].
11 // 13 //
12 // The main script spawns a server and a subprocess which does a connection back 14 // The main script spawns a server and a subprocess which does a connection back
13 // to it. 15 // to it.
14 // The subprocess is expected to shut down its idle sockets after 16 // The subprocess is expected to shut down its idle sockets after
(...skipping 17 matching lines...) Expand all
32 HttpServer.bind('127.0.0.1', 0).then((server) { 34 HttpServer.bind('127.0.0.1', 0).then((server) {
33 var url = 'http://127.0.0.1:${server.port}/'; 35 var url = 'http://127.0.0.1:${server.port}/';
34 36
35 server.idleTimeout = const Duration(hours: 1); 37 server.idleTimeout = const Duration(hours: 1);
36 38
37 var subscription = server.listen((HttpRequest request) { 39 var subscription = server.listen((HttpRequest request) {
38 return request.response..write('hello world')..close(); 40 return request.response..write('hello world')..close();
39 }); 41 });
40 42
41 var sw = new Stopwatch()..start(); 43 var sw = new Stopwatch()..start();
42 var arguments = packageOptions()..add(Platform.script.toString())..add(url); 44 var script = Platform.script.resolve('http_client_stays_alive_test.dart')
45 .toFilePath();
46 var arguments = packageOptions()..add(script)..add(url);
43 Process.run(Platform.executable, arguments).then((res) { 47 Process.run(Platform.executable, arguments).then((res) {
44 subscription.cancel(); 48 subscription.cancel();
45 if (res.exitCode != 0) { 49 if (res.exitCode != 0) {
46 throw "Child exited with ${res.exitCode} instead of 0. " 50 throw "Child exited with ${res.exitCode} instead of 0. "
47 "(stdout: ${res.stdout}, stderr: ${res.stderr})"; 51 "(stdout: ${res.stdout}, stderr: ${res.stderr})";
48 } 52 }
49 var seconds = sw.elapsed.inSeconds; 53 var seconds = sw.elapsed.inSeconds;
50 // NOTE: There is a slight chance this will cause flakiness, but there is 54 // NOTE: There is a slight chance this will cause flakiness, but there is
51 // no other good way of testing correctness of timing-dependent code 55 // no other good way of testing correctness of timing-dependent code
52 // form the outside. 56 // form the outside.
(...skipping 21 matching lines...) Expand all
74 .then((_) => print('drained client request')); 78 .then((_) => print('drained client request'));
75 } 79 }
76 80
77 void main(List<String> args) { 81 void main(List<String> args) {
78 if (args.length == 1) { 82 if (args.length == 1) {
79 runClientProcess(args.first); 83 runClientProcess(args.first);
80 } else { 84 } else {
81 runServerProcess(); 85 runServerProcess();
82 } 86 }
83 } 87 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_test.dart ('k') | tests/standalone/io/http_server_close_response_after_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698