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

Unified Diff: runtime/observatory/tests/service/capture_stdio_test.dart

Issue 1232193003: Provide stdout and stderr output in the Observatory debugger. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: before commit Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/capture_stdio_test.dart
diff --git a/runtime/observatory/tests/service/capture_stdio_test.dart b/runtime/observatory/tests/service/capture_stdio_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d131a7fe75bee019134fc83ae9b69dcad42a3348
--- /dev/null
+++ b/runtime/observatory/tests/service/capture_stdio_test.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--compile-all --error_on_bad_type --error_on_bad_override
+
+import 'dart:async';
+import 'dart:developer';
+import 'dart:io';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'test_helper.dart';
+
+void test() {
+ debugger();
+ stdout.write('stdout');
+
+ debugger();
+ print('print');
+
+ debugger();
+ stderr.write('stderr');
+}
+
+var tests = [
+ hasStoppedAtBreakpoint,
+
+ (Isolate isolate) async {
+ Completer completer = new Completer();
+ var stdoutSub;
+ stdoutSub = await isolate.vm.listenEventStream(
+ VM.kStdoutStream,
+ (ServiceEvent event) {
+ expect(event.kind, equals('WriteEvent'));
+ expect(event.bytesAsString, equals('stdout'));
+ cancelFutureSubscription(stdoutSub).then((_) {
+ completer.complete();
+ });
+ });
+ await isolate.resume();
+ await completer.future;
+ },
+
+ hasStoppedAtBreakpoint,
+
+ (Isolate isolate) async {
+ Completer completer = new Completer();
+ var stdoutSub;
+ int eventNumber = 1;
+ stdoutSub = await isolate.vm.listenEventStream(
+ VM.kStdoutStream,
+ (ServiceEvent event) {
+ expect(event.kind, equals('WriteEvent'));
+ if (eventNumber == 1) {
+ expect(event.bytesAsString, equals('print'));
+ } else if (eventNumber == 2) {
+ expect(event.bytesAsString, equals('\n'));
+ cancelFutureSubscription(stdoutSub).then((_) {
+ completer.complete();
+ });
+ } else {
+ expect(true, false);
+ }
+ eventNumber++;
+ });
+ await isolate.resume();
+ await completer.future;
+ },
+
+ hasStoppedAtBreakpoint,
+
+ (Isolate isolate) async {
+ Completer completer = new Completer();
+ var stderrSub;
+ stderrSub = await isolate.vm.listenEventStream(
+ VM.kStderrStream,
+ (ServiceEvent event) {
+ expect(event.kind, equals('WriteEvent'));
+ expect(event.bytesAsString, equals('stderr'));
+ cancelFutureSubscription(stderrSub).then((_) {
+ completer.complete();
+ });
+ });
+ await isolate.resume();
+ await completer.future;
+ },
+];
+
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: test);
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698