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

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

Issue 1133733005: Use words please. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: also rename service rpc 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 unified diff | Download patch | Annotate | Revision Log
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 library get_object_rpc_test; 6 library get_object_rpc_test;
7 7
8 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 import 'test_helper.dart'; 11 import 'test_helper.dart';
12 12
13 class _DummyClass { 13 class _DummyClass {
14 static var dummyVar = 11; 14 static var dummyVar = 11;
15 void dummyFunction() { 15 void dummyFunction() {
16 } 16 }
17 } 17 }
18 18
19 class _DummySubClass extends _DummyClass { 19 class _DummySubClass extends _DummyClass {
20 } 20 }
21 21
22 void warmup() { 22 void warmup() {
23 // Silence analyzer. 23 // Silence analyzer.
24 new _DummySubClass(); 24 new _DummySubClass();
25 new _DummyClass().dummyFunction(); 25 new _DummyClass().dummyFunction();
26 } 26 }
27 27
28 eval(Isolate isolate, String expression) async { 28 eval(Isolate isolate, String expression) async {
29 Map params = { 29 Map params = {
30 'targetId': isolate.rootLib.id, 30 'targetId': isolate.rootLibrary.id,
31 'expression': expression, 31 'expression': expression,
32 }; 32 };
33 return await isolate.invokeRpcNoUpgrade('eval', params); 33 return await isolate.invokeRpcNoUpgrade('evaluate', params);
34 } 34 }
35 35
36 var tests = [ 36 var tests = [
37 // null object. 37 // null object.
38 (Isolate isolate) async { 38 (Isolate isolate) async {
39 var params = { 39 var params = {
40 'objectId': 'objects/null', 40 'objectId': 'objects/null',
41 }; 41 };
42 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 42 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
43 expect(result['type'], equals('null')); 43 expect(result['type'], equals('null'));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 expect(result['type'], equals('Sentinel')); 110 expect(result['type'], equals('Sentinel'));
111 expect(result['kind'], startsWith('Expired')); 111 expect(result['kind'], startsWith('Expired'));
112 expect(result['valueAsString'], equals('<expired>')); 112 expect(result['valueAsString'], equals('<expired>'));
113 expect(result['class'], isNull); 113 expect(result['class'], isNull);
114 expect(result['size'], isNull); 114 expect(result['size'], isNull);
115 }, 115 },
116 116
117 // library. 117 // library.
118 (Isolate isolate) async { 118 (Isolate isolate) async {
119 var params = { 119 var params = {
120 'objectId': isolate.rootLib.id, 120 'objectId': isolate.rootLibrary.id,
121 }; 121 };
122 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 122 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
123 expect(result['type'], equals('Library')); 123 expect(result['type'], equals('Library'));
124 expect(result['id'], startsWith('libraries/')); 124 expect(result['id'], startsWith('libraries/'));
125 expect(result['name'], equals('get_object_rpc_test')); 125 expect(result['name'], equals('get_object_rpc_test'));
126 expect(result['url'], startsWith('file:')); 126 expect(result['url'], startsWith('file:'));
127 expect(result['url'], endsWith('get_object_rpc_test.dart')); 127 expect(result['url'], endsWith('get_object_rpc_test.dart'));
128 expect(result['imports'].length, isPositive); 128 expect(result['imports'].length, isPositive);
129 expect(result['imports'][0]['type'], equals('@Library')); 129 expect(result['imports'][0]['type'], equals('@Library'));
130 expect(result['scripts'].length, isPositive); 130 expect(result['scripts'].length, isPositive);
(...skipping 21 matching lines...) Expand all
152 expect(e.message, 152 expect(e.message,
153 "getObject: invalid 'objectId' parameter: libraries/9999999"); 153 "getObject: invalid 'objectId' parameter: libraries/9999999");
154 } 154 }
155 expect(caughtException, isTrue); 155 expect(caughtException, isTrue);
156 }, 156 },
157 157
158 // script. 158 // script.
159 (Isolate isolate) async { 159 (Isolate isolate) async {
160 // Get the library first. 160 // Get the library first.
161 var params = { 161 var params = {
162 'objectId': isolate.rootLib.id, 162 'objectId': isolate.rootLibrary.id,
163 }; 163 };
164 var libResult = await isolate.invokeRpcNoUpgrade('getObject', params); 164 var libResult = await isolate.invokeRpcNoUpgrade('getObject', params);
165 // Get the first script. 165 // Get the first script.
166 params = { 166 params = {
167 'objectId': libResult['scripts'][0]['id'], 167 'objectId': libResult['scripts'][0]['id'],
168 }; 168 };
169 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 169 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
170 expect(result['type'], equals('Script')); 170 expect(result['type'], equals('Script'));
171 expect(result['id'], startsWith('libraries/')); 171 expect(result['id'], startsWith('libraries/'));
172 expect(result['name'], startsWith('file:')); 172 expect(result['name'], startsWith('file:'));
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 caughtException = true; 415 caughtException = true;
416 expect(e.code, equals(ServerRpcException.kInvalidParams)); 416 expect(e.code, equals(ServerRpcException.kInvalidParams));
417 expect(e.message, 417 expect(e.message,
418 "getObject: invalid 'objectId' parameter: code/0"); 418 "getObject: invalid 'objectId' parameter: code/0");
419 } 419 }
420 expect(caughtException, isTrue); 420 expect(caughtException, isTrue);
421 }, 421 },
422 ]; 422 ];
423 423
424 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); 424 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698