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

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

Issue 2962593002: Added Editor stream and sendObjectToEditor RPC into Service Protocol (Closed)
Patch Set: Added explanation comment Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/observatory_sources.gypi ('k') | runtime/vm/service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/send_object_to_editor_rpc_test.dart
diff --git a/runtime/observatory/tests/service/send_object_to_editor_rpc_test.dart b/runtime/observatory/tests/service/send_object_to_editor_rpc_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ffe43e1b31e0af81ae7c24caa67abbf6f073c789
--- /dev/null
+++ b/runtime/observatory/tests/service/send_object_to_editor_rpc_test.dart
@@ -0,0 +1,57 @@
+// 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=--error_on_bad_type --error_on_bad_override
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'dart:async';
+
+import 'test_helper.dart';
+
+class _TestClass {
+ _TestClass(this.x, this.y);
+ var x;
+ var y;
+}
+
+var myVar;
+
+eval(Isolate isolate, String expression) async {
+ // Silence analyzer.
+ new _TestClass(null, null);
+ Map params = {
+ 'targetId': isolate.rootLibrary.id,
+ 'expression': expression,
+ };
+ return await isolate.invokeRpcNoUpgrade('evaluate', params);
+}
+
+var tests = [
+ (Isolate isolate) async {
+ var identifier = 'random string';
+ // One instance of _TestClass retained.
+ var evalResult = await eval(isolate, 'myVar = new _TestClass(null, null)');
+ var params = {
+ 'editor': identifier,
+ 'objectId': evalResult['class']['id'],
+ };
+
+ var done = new Completer();
+ var stream = await isolate.vm.getEventStream('_Editor');
+
+ stream.listen((ServiceEvent e) {
+ expect(e.kind, equals('_EditorObjectSelected'));
+ expect(e.editor, equals(identifier));
+ expect(e.object, isNotNull);
+ expect(e.object.id, equals(evalResult['class']['id']));
+ done.complete();
+ });
+
+ await isolate.invokeRpcNoUpgrade('_sendObjectToEditor', params);
+
+ await done.future;
+ },
+];
+
+main(args) async => runIsolateTests(args, tests);
« no previous file with comments | « runtime/observatory/observatory_sources.gypi ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698