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

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

Issue 1159003002: Make several service protocol RPCs private. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/service/service.md ('k') | no next file » | no next file with comments »
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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_debugger_api.h" 7 #include "include/dart_debugger_api.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 Array& service_msg = Array::Handle(); 452 Array& service_msg = Array::Handle();
453 // Note: If we ever introduce old space compaction, this test might fail. 453 // Note: If we ever introduce old space compaction, this test might fail.
454 uword start_addr = RawObject::ToAddr(str.raw()); 454 uword start_addr = RawObject::ToAddr(str.raw());
455 // Expect to find 'str', also from internal addresses. 455 // Expect to find 'str', also from internal addresses.
456 for (int offset = 0; offset < kObjectAlignment; ++offset) { 456 for (int offset = 0; offset < kObjectAlignment; ++offset) {
457 uword addr = start_addr + offset; 457 uword addr = start_addr + offset;
458 char buf[1024]; 458 char buf[1024];
459 bool ref = offset % 2 == 0; 459 bool ref = offset % 2 == 0;
460 OS::SNPrint(buf, sizeof(buf), 460 OS::SNPrint(buf, sizeof(buf),
461 (ref 461 (ref
462 ? "[0, port, '0', 'getObjectByAddress', " 462 ? "[0, port, '0', '_getObjectByAddress', "
463 "['address', 'ref'], ['%" Px "', 'true']]" 463 "['address', 'ref'], ['%" Px "', 'true']]"
464 : "[0, port, '0', 'getObjectByAddress', " 464 : "[0, port, '0', '_getObjectByAddress', "
465 "['address'], ['%" Px "']]"), 465 "['address'], ['%" Px "']]"),
466 addr); 466 addr);
467 service_msg = Eval(lib, buf); 467 service_msg = Eval(lib, buf);
468 Service::HandleIsolateMessage(isolate, service_msg); 468 Service::HandleIsolateMessage(isolate, service_msg);
469 handler.HandleNextMessage(); 469 handler.HandleNextMessage();
470 EXPECT_SUBSTRING(ref ? "\"type\":\"@String\"" : 470 EXPECT_SUBSTRING(ref ? "\"type\":\"@String\"" :
471 "\"type\":\"String\"", 471 "\"type\":\"String\"",
472 handler.msg()); 472 handler.msg());
473 EXPECT_SUBSTRING("foobar", handler.msg()); 473 EXPECT_SUBSTRING("foobar", handler.msg());
474 } 474 }
475 // Expect null when no object is found. 475 // Expect null when no object is found.
476 service_msg = Eval(lib, "[0, port, '0', 'getObjectByAddress', " 476 service_msg = Eval(lib, "[0, port, '0', '_getObjectByAddress', "
477 "['address'], ['7']]"); 477 "['address'], ['7']]");
478 Service::HandleIsolateMessage(isolate, service_msg); 478 Service::HandleIsolateMessage(isolate, service_msg);
479 handler.HandleNextMessage(); 479 handler.HandleNextMessage();
480 // TODO(turnidge): Should this be a ServiceException instead? 480 // TODO(turnidge): Should this be a ServiceException instead?
481 EXPECT_SUBSTRING("{\"type\":\"Sentinel\",\"kind\":\"Free\"," 481 EXPECT_SUBSTRING("{\"type\":\"Sentinel\",\"kind\":\"Free\","
482 "\"valueAsString\":\"<free>\"", 482 "\"valueAsString\":\"<free>\"",
483 handler.msg()); 483 handler.msg());
484 } 484 }
485 485
486 486
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 EXPECT_VALID(result); 604 EXPECT_VALID(result);
605 605
606 // Build a mock message handler and wrap it in a dart port. 606 // Build a mock message handler and wrap it in a dart port.
607 ServiceTestMessageHandler handler; 607 ServiceTestMessageHandler handler;
608 Dart_Port port_id = PortMap::CreatePort(&handler); 608 Dart_Port port_id = PortMap::CreatePort(&handler);
609 Dart_Handle port = Api::NewHandle(isolate, SendPort::New(port_id)); 609 Dart_Handle port = Api::NewHandle(isolate, SendPort::New(port_id));
610 EXPECT_VALID(port); 610 EXPECT_VALID(port);
611 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port)); 611 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
612 612
613 Array& service_msg = Array::Handle(); 613 Array& service_msg = Array::Handle();
614 service_msg = Eval(lib, "[0, port, '0', 'getCpuProfile', [], []]"); 614 service_msg = Eval(lib, "[0, port, '0', '_getCpuProfile', [], []]");
615 Service::HandleIsolateMessage(isolate, service_msg); 615 Service::HandleIsolateMessage(isolate, service_msg);
616 handler.HandleNextMessage(); 616 handler.HandleNextMessage();
617 // Expect error (tags required). 617 // Expect error (tags required).
618 EXPECT_SUBSTRING("\"error\"", handler.msg()); 618 EXPECT_SUBSTRING("\"error\"", handler.msg());
619 619
620 service_msg = 620 service_msg =
621 Eval(lib, "[0, port, '0', 'getCpuProfile', ['tags'], ['None']]"); 621 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['None']]");
622 Service::HandleIsolateMessage(isolate, service_msg); 622 Service::HandleIsolateMessage(isolate, service_msg);
623 handler.HandleNextMessage(); 623 handler.HandleNextMessage();
624 // Expect profile 624 // Expect profile
625 EXPECT_SUBSTRING("\"type\":\"_CpuProfile\"", handler.msg()); 625 EXPECT_SUBSTRING("\"type\":\"_CpuProfile\"", handler.msg());
626 626
627 service_msg = 627 service_msg =
628 Eval(lib, "[0, port, '0', 'getCpuProfile', ['tags'], ['Bogus']]"); 628 Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]");
629 Service::HandleIsolateMessage(isolate, service_msg); 629 Service::HandleIsolateMessage(isolate, service_msg);
630 handler.HandleNextMessage(); 630 handler.HandleNextMessage();
631 // Expect error. 631 // Expect error.
632 EXPECT_SUBSTRING("\"error\"", handler.msg()); 632 EXPECT_SUBSTRING("\"error\"", handler.msg());
633 } 633 }
634 634
635 #endif // !defined(TARGET_ARCH_ARM64) 635 #endif // !defined(TARGET_ARCH_ARM64)
636 636
637 } // namespace dart 637 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service/service.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698