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

Side by Side Diff: runtime/observatory/tests/service/capture_stdio_test.dart

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. Created 3 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
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 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override 4 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:developer'; 7 import 'dart:developer';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'package:observatory/service_io.dart'; 9 import 'package:observatory/service_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 import 'service_test_common.dart'; 11 import 'service_test_common.dart';
12 import 'test_helper.dart'; 12 import 'test_helper.dart';
13 13
14 void test() { 14 void test() {
15 debugger(); 15 debugger();
16 stdout.write('stdout'); 16 stdout.write('stdout');
17 17
18 debugger(); 18 debugger();
19 print('print'); 19 print('print');
20 20
21 debugger(); 21 debugger();
22 stderr.write('stderr'); 22 stderr.write('stderr');
23 } 23 }
24 24
25 var tests = [ 25 var tests = [
26 hasStoppedAtBreakpoint, 26 hasStoppedAtBreakpoint,
27
28 (Isolate isolate) async { 27 (Isolate isolate) async {
29 Completer completer = new Completer(); 28 Completer completer = new Completer();
30 var stdoutSub; 29 var stdoutSub;
31 stdoutSub = await isolate.vm.listenEventStream( 30 stdoutSub = await isolate.vm.listenEventStream(VM.kStdoutStream,
32 VM.kStdoutStream, 31 (ServiceEvent event) {
33 (ServiceEvent event) { 32 expect(event.kind, equals('WriteEvent'));
34 expect(event.kind, equals('WriteEvent')); 33 expect(event.bytesAsString, equals('stdout'));
35 expect(event.bytesAsString, equals('stdout')); 34 stdoutSub.cancel().then((_) {
36 stdoutSub.cancel().then((_) { 35 completer.complete();
37 completer.complete();
38 });
39 }); 36 });
37 });
40 await isolate.resume(); 38 await isolate.resume();
41 await completer.future; 39 await completer.future;
42 }, 40 },
43
44 hasStoppedAtBreakpoint, 41 hasStoppedAtBreakpoint,
45
46 (Isolate isolate) async { 42 (Isolate isolate) async {
47 Completer completer = new Completer(); 43 Completer completer = new Completer();
48 var stdoutSub; 44 var stdoutSub;
49 int eventNumber = 1; 45 int eventNumber = 1;
50 stdoutSub = await isolate.vm.listenEventStream( 46 stdoutSub = await isolate.vm.listenEventStream(VM.kStdoutStream,
51 VM.kStdoutStream, 47 (ServiceEvent event) {
52 (ServiceEvent event) { 48 expect(event.kind, equals('WriteEvent'));
53 expect(event.kind, equals('WriteEvent')); 49 if (eventNumber == 1) {
54 if (eventNumber == 1) { 50 expect(event.bytesAsString, equals('print'));
55 expect(event.bytesAsString, equals('print')); 51 } else if (eventNumber == 2) {
56 } else if (eventNumber == 2) { 52 expect(event.bytesAsString, equals('\n'));
57 expect(event.bytesAsString, equals('\n')); 53 stdoutSub.cancel().then((_) {
58 stdoutSub.cancel().then((_) { 54 completer.complete();
59 completer.complete(); 55 });
60 }); 56 } else {
61 } else { 57 expect(true, false);
62 expect(true, false); 58 }
63 } 59 eventNumber++;
64 eventNumber++; 60 });
65 });
66 await isolate.resume(); 61 await isolate.resume();
67 await completer.future; 62 await completer.future;
68 }, 63 },
69
70 hasStoppedAtBreakpoint, 64 hasStoppedAtBreakpoint,
71
72 (Isolate isolate) async { 65 (Isolate isolate) async {
73 Completer completer = new Completer(); 66 Completer completer = new Completer();
74 var stderrSub; 67 var stderrSub;
75 stderrSub = await isolate.vm.listenEventStream( 68 stderrSub = await isolate.vm.listenEventStream(VM.kStderrStream,
76 VM.kStderrStream, 69 (ServiceEvent event) {
77 (ServiceEvent event) { 70 expect(event.kind, equals('WriteEvent'));
78 expect(event.kind, equals('WriteEvent')); 71 expect(event.bytesAsString, equals('stderr'));
79 expect(event.bytesAsString, equals('stderr')); 72 stderrSub.cancel().then((_) {
80 stderrSub.cancel().then((_) { 73 completer.complete();
81 completer.complete();
82 });
83 }); 74 });
75 });
84 await isolate.resume(); 76 await isolate.resume();
85 await completer.future; 77 await completer.future;
86 }, 78 },
87 ]; 79 ];
88 80
89
90 main(args) => runIsolateTests(args, tests, testeeConcurrent: test); 81 main(args) => runIsolateTests(args, tests, testeeConcurrent: test);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698