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

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

Issue 1149373006: Add getVersion and setLibraryDebuggable RPCs to the service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: when all is said and done Created 5 years, 7 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/tests/service/get_version_rpc_test.dart ('k') | 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/set_library_debuggable_rpc_test.dart
diff --git a/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0f9aa400ee28b8abf47cfcfe9c5ea8b98c521b03
--- /dev/null
+++ b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
@@ -0,0 +1,62 @@
+// 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
+
+library set_library_debuggable_rpc_test;
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+import 'test_helper.dart';
+
+var tests = [
+ (Isolate isolate) async {
+ var result;
+
+ // debuggable defaults to true.
+ var getObjectParams = {
+ 'objectId': isolate.rootLibrary.id,
+ };
+ result = await isolate.invokeRpcNoUpgrade('getObject',
+ getObjectParams);
+ expect(result['debuggable'], equals(true));
+
+ // Change debuggable to false.
+ var setDebugParams = {
+ 'libraryId': isolate.rootLibrary.id,
+ 'isDebuggable': false,
+ };
+ result = await isolate.invokeRpcNoUpgrade('setLibraryDebuggable',
+ setDebugParams);
+ expect(result['type'], equals('Success'));
+
+ // Verify.
+ result = await isolate.invokeRpcNoUpgrade('getObject',
+ getObjectParams);
+ expect(result['debuggable'], equals(false));
+
+ },
+
+ // invalid library.
+ (Isolate isolate) async {
+ var params = {
+ 'libraryId': 'libraries/9999999',
+ 'isDebuggable': false,
+ };
+ bool caughtException;
+ try {
+ await isolate.invokeRpcNoUpgrade('setLibraryDebuggable', params);
+ expect(false, isTrue, reason:'Unreachable');
+ } on ServerRpcException catch(e) {
+ caughtException = true;
+ expect(e.code, equals(ServerRpcException.kInvalidParams));
+ expect(e.message,
+ "setLibraryDebuggable: "
+ "invalid 'libraryId' parameter: libraries/9999999");
+ }
+ expect(caughtException, isTrue);
+ },
+];
+
+main(args) async => runIsolateTests(args, tests);
« no previous file with comments | « runtime/observatory/tests/service/get_version_rpc_test.dart ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698