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

Side by Side Diff: runtime/vm/service_test.cc

Issue 140643006: Update documentation on Symbol. Make validation match. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | sdk/lib/core/symbol.dart » ('j') | sdk/lib/core/symbol.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 #include "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "vm/dart_api_impl.h" 6 #include "vm/dart_api_impl.h"
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/debugger.h" 8 #include "vm/debugger.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/message_handler.h" 10 #include "vm/message_handler.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 EXPECT_STREQ( 325 EXPECT_STREQ(
326 "{\"type\":\"Error\",\"text\":\"999999 is not a valid class id.\"," 326 "{\"type\":\"Error\",\"text\":\"999999 is not a valid class id.\","
327 "\"message\":{\"arguments\":[\"classes\",\"999999\"]," 327 "\"message\":{\"arguments\":[\"classes\",\"999999\"],"
328 "\"option_keys\":[],\"option_values\":[]}}", handler.msg()); 328 "\"option_keys\":[],\"option_values\":[]}}", handler.msg());
329 329
330 // Request the class A over the service. 330 // Request the class A over the service.
331 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "'], [], []]", cid); 331 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "'], [], []]", cid);
332 Service::HandleIsolateMessage(isolate, service_msg); 332 Service::HandleIsolateMessage(isolate, service_msg);
333 handler.HandleNextMessage(); 333 handler.HandleNextMessage();
334 EXPECT_STREQ( 334 EXPECT_STREQ(
335 "{\"type\":\"Class\",\"id\":\"classes\\/1009\",\"name\":\"A\"," 335 "{\"type\":\"Class\",\"id\":\"classes\\/1010\",\"name\":\"A\","
floitsch 2014/01/31 14:37:24 Lasse just committed a similar change. You might n
Lasse Reichstein Nielsen 2014/01/31 18:19:26 I know :)
336 "\"user_name\":\"A\",\"implemented\":false,\"abstract\":false," 336 "\"user_name\":\"A\",\"implemented\":false,\"abstract\":false,"
337 "\"patch\":false,\"finalized\":true,\"const\":false,\"super\":" 337 "\"patch\":false,\"finalized\":true,\"const\":false,\"super\":"
338 "{\"type\":\"@Class\",\"id\":\"classes\\/35\",\"name\":\"Object\"," 338 "{\"type\":\"@Class\",\"id\":\"classes\\/35\",\"name\":\"Object\","
339 "\"user_name\":\"Object\"},\"library\":{\"type\":\"@Library\",\"id\":" 339 "\"user_name\":\"Object\"},\"library\":{\"type\":\"@Library\",\"id\":"
340 "\"libraries\\/12\",\"name\":\"\",\"user_name\":\"dart:test-lib\"}," 340 "\"libraries\\/12\",\"name\":\"\",\"user_name\":\"dart:test-lib\"},"
341 "\"fields\":[{\"type\":\"@Field\",\"id\":\"classes\\/1009\\/fields\\/0\"," 341 "\"fields\":[{\"type\":\"@Field\",\"id\":\"classes\\/1010\\/fields\\/0\","
342 "\"name\":\"a\",\"user_name\":\"a\",\"owner\":{\"type\":\"@Class\"," 342 "\"name\":\"a\",\"user_name\":\"a\",\"owner\":{\"type\":\"@Class\","
343 "\"id\":\"classes\\/1009\",\"name\":\"A\",\"user_name\":\"A\"}," 343 "\"id\":\"classes\\/1010\",\"name\":\"A\",\"user_name\":\"A\"},"
344 "\"declared_type\":{\"type\":\"@Class\",\"id\":\"classes\\/106\"," 344 "\"declared_type\":{\"type\":\"@Class\",\"id\":\"classes\\/106\","
345 "\"name\":\"dynamic\",\"user_name\":\"dynamic\"},\"static\":false," 345 "\"name\":\"dynamic\",\"user_name\":\"dynamic\"},\"static\":false,"
346 "\"final\":false,\"const\":false}],\"functions\":[" 346 "\"final\":false,\"const\":false}],\"functions\":["
347 "{\"type\":\"@Function\",\"id\":\"classes\\/1009\\/functions\\/0\"," 347 "{\"type\":\"@Function\",\"id\":\"classes\\/1010\\/functions\\/0\","
348 "\"name\":\"get:a\",\"user_name\":\"A.a\"},{\"type\":\"@Function\"," 348 "\"name\":\"get:a\",\"user_name\":\"A.a\"},{\"type\":\"@Function\","
349 "\"id\":\"classes\\/1009\\/functions\\/1\",\"name\":\"set:a\"," 349 "\"id\":\"classes\\/1010\\/functions\\/1\",\"name\":\"set:a\","
350 "\"user_name\":\"A.a=\"},{\"type\":\"@Function\",\"id\":" 350 "\"user_name\":\"A.a=\"},{\"type\":\"@Function\",\"id\":"
351 "\"classes\\/1009\\/functions\\/2\",\"name\":\"b\",\"user_name\":\"A.b\"}" 351 "\"classes\\/1010\\/functions\\/2\",\"name\":\"b\",\"user_name\":\"A.b\"}"
352 ",{\"type\":\"@Function\",\"id\":\"classes\\/1009\\/functions\\/3\"," 352 ",{\"type\":\"@Function\",\"id\":\"classes\\/1010\\/functions\\/3\","
353 "\"name\":\"c\",\"user_name\":\"A.c\"},{\"type\":\"@Function\",\"id\":" 353 "\"name\":\"c\",\"user_name\":\"A.c\"},{\"type\":\"@Function\",\"id\":"
354 "\"classes\\/1009\\/functions\\/4\",\"name\":\"A.\",\"user_name\":" 354 "\"classes\\/1010\\/functions\\/4\",\"name\":\"A.\",\"user_name\":"
355 "\"A.A\"}]}", 355 "\"A.A\"}]}",
356 handler.msg()); 356 handler.msg());
357 357
358 // Request function 0 from class A. 358 // Request function 0 from class A.
359 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '0']," 359 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '0'],"
360 "[], []]", cid); 360 "[], []]", cid);
361 Service::HandleIsolateMessage(isolate, service_msg); 361 Service::HandleIsolateMessage(isolate, service_msg);
362 handler.HandleNextMessage(); 362 handler.HandleNextMessage();
363 EXPECT_STREQ( 363 EXPECT_STREQ(
364 "{\"type\":\"Function\",\"id\":\"classes\\/1009\\/functions\\/0\",\"name\":" 364 "{\"type\":\"Function\",\"id\":\"classes\\/1010\\/functions\\/0\",\"name\":"
365 "\"get:a\",\"user_name\":\"A.a\",\"is_static\":false,\"is_const\":false," 365 "\"get:a\",\"user_name\":\"A.a\",\"is_static\":false,\"is_const\":false,"
366 "\"is_optimizable\":true,\"is_inlinable\":false,\"kind\":" 366 "\"is_optimizable\":true,\"is_inlinable\":false,\"kind\":"
367 "\"kImplicitGetter\",\"unoptimized_code\":{\"type\":\"null\"}," 367 "\"kImplicitGetter\",\"unoptimized_code\":{\"type\":\"null\"},"
368 "\"usage_counter\":0,\"optimized_call_site_count\":0,\"code\":" 368 "\"usage_counter\":0,\"optimized_call_site_count\":0,\"code\":"
369 "{\"type\":\"null\"},\"deoptimizations\":0}", handler.msg()); 369 "{\"type\":\"null\"},\"deoptimizations\":0}", handler.msg());
370 370
371 // Request field 0 from class A. 371 // Request field 0 from class A.
372 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '0']," 372 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '0'],"
373 "[], []]", cid); 373 "[], []]", cid);
374 Service::HandleIsolateMessage(isolate, service_msg); 374 Service::HandleIsolateMessage(isolate, service_msg);
375 handler.HandleNextMessage(); 375 handler.HandleNextMessage();
376 EXPECT_STREQ( 376 EXPECT_STREQ(
377 "{\"type\":\"Field\",\"id\":\"classes\\/1009\\/fields\\/0\",\"name\":\"a\"," 377 "{\"type\":\"Field\",\"id\":\"classes\\/1010\\/fields\\/0\",\"name\":\"a\","
378 "\"user_name\":\"a\",\"owner\":{\"type\":\"@Class\",\"id\":" 378 "\"user_name\":\"a\",\"owner\":{\"type\":\"@Class\",\"id\":"
379 "\"classes\\/1009\",\"name\":\"A\",\"user_name\":\"A\"},\"declared_type\":" 379 "\"classes\\/1010\",\"name\":\"A\",\"user_name\":\"A\"},\"declared_type\":"
380 "{\"type\":\"@Class\",\"id\":\"classes\\/106\",\"name\":\"dynamic\"," 380 "{\"type\":\"@Class\",\"id\":\"classes\\/106\",\"name\":\"dynamic\","
381 "\"user_name\":\"dynamic\"},\"static\":false,\"final\":false,\"const\":" 381 "\"user_name\":\"dynamic\"},\"static\":false,\"final\":false,\"const\":"
382 "false,\"guard_nullable\":true,\"guard_class\":{\"type\":\"@Class\"," 382 "false,\"guard_nullable\":true,\"guard_class\":{\"type\":\"@Class\","
383 "\"id\":\"classes\\/105\",\"name\":\"Null\",\"user_name\":\"Null\"}," 383 "\"id\":\"classes\\/105\",\"name\":\"Null\",\"user_name\":\"Null\"},"
384 "\"guard_length\":\"variable\"}", handler.msg()); 384 "\"guard_length\":\"variable\"}", handler.msg());
385 385
386 // Invalid sub command. 386 // Invalid sub command.
387 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'huh', '0']," 387 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'huh', '0'],"
388 "[], []]", cid); 388 "[], []]", cid);
389 Service::HandleIsolateMessage(isolate, service_msg); 389 Service::HandleIsolateMessage(isolate, service_msg);
390 handler.HandleNextMessage(); 390 handler.HandleNextMessage();
391 EXPECT_STREQ( 391 EXPECT_STREQ(
392 "{\"type\":\"Error\",\"text\":\"Invalid sub collection huh\",\"message\":" 392 "{\"type\":\"Error\",\"text\":\"Invalid sub collection huh\",\"message\":"
393 "{\"arguments\":[\"classes\",\"1009\",\"huh\",\"0\"],\"option_keys\":[]," 393 "{\"arguments\":[\"classes\",\"1010\",\"huh\",\"0\"],\"option_keys\":[],"
394 "\"option_values\":[]}}", handler.msg()); 394 "\"option_values\":[]}}", handler.msg());
395 395
396 // Invalid field request. 396 // Invalid field request.
397 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '9']," 397 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '9'],"
398 "[], []]", cid); 398 "[], []]", cid);
399 Service::HandleIsolateMessage(isolate, service_msg); 399 Service::HandleIsolateMessage(isolate, service_msg);
400 handler.HandleNextMessage(); 400 handler.HandleNextMessage();
401 EXPECT_STREQ( 401 EXPECT_STREQ(
402 "{\"type\":\"Error\",\"text\":\"Field 9 not found\"," 402 "{\"type\":\"Error\",\"text\":\"Field 9 not found\","
403 "\"message\":{\"arguments\":[\"classes\",\"1009\",\"fields\",\"9\"]," 403 "\"message\":{\"arguments\":[\"classes\",\"1010\",\"fields\",\"9\"],"
404 "\"option_keys\":[],\"option_values\":[]}}", handler.msg()); 404 "\"option_keys\":[],\"option_values\":[]}}", handler.msg());
405 405
406 // Invalid function request. 406 // Invalid function request.
407 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9']," 407 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9'],"
408 "[], []]", cid); 408 "[], []]", cid);
409 Service::HandleIsolateMessage(isolate, service_msg); 409 Service::HandleIsolateMessage(isolate, service_msg);
410 handler.HandleNextMessage(); 410 handler.HandleNextMessage();
411 EXPECT_STREQ( 411 EXPECT_STREQ(
412 "{\"type\":\"Error\",\"text\":\"Function 9 not found\"," 412 "{\"type\":\"Error\",\"text\":\"Function 9 not found\","
413 "\"message\":{\"arguments\":[\"classes\",\"1009\",\"functions\",\"9\"]," 413 "\"message\":{\"arguments\":[\"classes\",\"1010\",\"functions\",\"9\"],"
414 "\"option_keys\":[],\"option_values\":[]}}", handler.msg()); 414 "\"option_keys\":[],\"option_values\":[]}}", handler.msg());
415 415
416 416
417 // Invalid field subcommand. 417 // Invalid field subcommand.
418 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '9', 'x']" 418 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '9', 'x']"
419 ",[], []]", cid); 419 ",[], []]", cid);
420 Service::HandleIsolateMessage(isolate, service_msg); 420 Service::HandleIsolateMessage(isolate, service_msg);
421 handler.HandleNextMessage(); 421 handler.HandleNextMessage();
422 EXPECT_STREQ( 422 EXPECT_STREQ(
423 "{\"type\":\"Error\",\"text\":\"Command too long\",\"message\":" 423 "{\"type\":\"Error\",\"text\":\"Command too long\",\"message\":"
424 "{\"arguments\":[\"classes\",\"1009\",\"fields\",\"9\",\"x\"]," 424 "{\"arguments\":[\"classes\",\"1010\",\"fields\",\"9\",\"x\"],"
425 "\"option_keys\":[],\"option_values\":[]}}", 425 "\"option_keys\":[],\"option_values\":[]}}",
426 handler.msg()); 426 handler.msg());
427 427
428 // Invalid function request. 428 // Invalid function request.
429 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9'," 429 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9',"
430 "'x'], [], []]", cid); 430 "'x'], [], []]", cid);
431 Service::HandleIsolateMessage(isolate, service_msg); 431 Service::HandleIsolateMessage(isolate, service_msg);
432 handler.HandleNextMessage(); 432 handler.HandleNextMessage();
433 EXPECT_STREQ( 433 EXPECT_STREQ(
434 "{\"type\":\"Error\",\"text\":\"Command too long\",\"message\":" 434 "{\"type\":\"Error\",\"text\":\"Command too long\",\"message\":"
435 "{\"arguments\":[\"classes\",\"1009\",\"functions\",\"9\",\"x\"]," 435 "{\"arguments\":[\"classes\",\"1010\",\"functions\",\"9\",\"x\"],"
436 "\"option_keys\":[],\"option_values\":[]}}", 436 "\"option_keys\":[],\"option_values\":[]}}",
437 handler.msg()); 437 handler.msg());
438 } 438 }
439 439
440 440
441 TEST_CASE(Service_Code) { 441 TEST_CASE(Service_Code) {
442 const char* kScript = 442 const char* kScript =
443 "var port;\n" // Set to our mock port by C++. 443 "var port;\n" // Set to our mock port by C++.
444 "\n" 444 "\n"
445 "class A {\n" 445 "class A {\n"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 handler.HandleNextMessage(); 619 handler.HandleNextMessage();
620 EXPECT_SUBSTRING( 620 EXPECT_SUBSTRING(
621 "{\"source\":\"dart:test-lib\",\"script\":{" 621 "{\"source\":\"dart:test-lib\",\"script\":{"
622 "\"type\":\"@Script\",\"id\":\"scripts\\/dart%3Atest-lib\"," 622 "\"type\":\"@Script\",\"id\":\"scripts\\/dart%3Atest-lib\","
623 "\"name\":\"dart:test-lib\",\"user_name\":\"dart:test-lib\"," 623 "\"name\":\"dart:test-lib\",\"user_name\":\"dart:test-lib\","
624 "\"kind\":\"script\"},\"hits\":" 624 "\"kind\":\"script\"},\"hits\":"
625 "[3,0,3,1,5,1,5,1,5,1,6,1,6,1]}", handler.msg()); 625 "[3,0,3,1,5,1,5,1,5,1,6,1,6,1]}", handler.msg());
626 } 626 }
627 627
628 } // namespace dart 628 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/core/symbol.dart » ('j') | sdk/lib/core/symbol.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698