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

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

Issue 2237953002: Fail gracefully when attempting to evaluate against a VM internal class such a Field. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 4 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 | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/eval_internal_class_test.dart
diff --git a/runtime/observatory/tests/service/eval_internal_class_test.dart b/runtime/observatory/tests/service/eval_internal_class_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5f3fad497449cb298e3b5d67ac1781c448d5ce82
--- /dev/null
+++ b/runtime/observatory/tests/service/eval_internal_class_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2016, 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.
+
+import 'dart:async';
+import 'dart:developer';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'service_test_common.dart';
+import 'test_helper.dart';
+
+var tests = [
+
+(Isolate isolate) async {
+ Library root = await isolate.rootLibrary.load();
+
+ Class classLibrary = await root.clazz.load();
+ print(classLibrary);
+ var result = await classLibrary.evaluate('3 + 4');
+ print(result);
+ expect(result is DartError, isTrue);
+ expect(result.message, contains('Cannot evaluate'));
+
+ Class classClass = await classLibrary.clazz.load();
+ print(classClass);
+ result = await classClass.evaluate('3 + 4');
+ print(result);
+ expect(result is DartError, isTrue);
+ expect(result.message, contains('Cannot evaluate'));
+
+ var someArray = await root.evaluate("new List(2)");
+ print(someArray);
+ expect(someArray is Instance, isTrue);
+ Class classArray = await someArray.clazz.load();
+ print(classArray);
+ result = await classArray.evaluate('3 + 4');
+ print(result);
+ expect(result is Instance, isTrue);
+ expect(result.valueAsString, equals('7'));
+},
+
+];
+
+main(args) => runIsolateTests(args, tests);
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698