| OLD | NEW |
| 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 "\n" | 630 "\n" |
| 631 "class A {\n" | 631 "class A {\n" |
| 632 " var a;\n" | 632 " var a;\n" |
| 633 " static var cobra = 11235;\n" | 633 " static var cobra = 11235;\n" |
| 634 " dynamic b() {}\n" | 634 " dynamic b() {}\n" |
| 635 " dynamic c() {\n" | 635 " dynamic c() {\n" |
| 636 " var d = () { b(); };\n" | 636 " var d = () { b(); };\n" |
| 637 " return d;\n" | 637 " return d;\n" |
| 638 " }\n" | 638 " }\n" |
| 639 "}\n" | 639 "}\n" |
| 640 "class B { static int i = 42; }\n" |
| 640 "main() {\n" | 641 "main() {\n" |
| 641 " var z = new A();\n" | 642 " var z = new A();\n" |
| 642 " var x = z.c();\n" | 643 " var x = z.c();\n" |
| 643 " x();\n" | 644 " x();\n" |
| 645 " ++B.i;\n" |
| 644 "}"; | 646 "}"; |
| 645 | 647 |
| 646 Isolate* isolate = Isolate::Current(); | 648 Isolate* isolate = Isolate::Current(); |
| 647 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL); | 649 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL); |
| 648 EXPECT_VALID(h_lib); | 650 EXPECT_VALID(h_lib); |
| 649 Library& lib = Library::Handle(); | 651 Library& lib = Library::Handle(); |
| 650 lib ^= Api::UnwrapHandle(h_lib); | 652 lib ^= Api::UnwrapHandle(h_lib); |
| 651 EXPECT(!lib.IsNull()); | 653 EXPECT(!lib.IsNull()); |
| 652 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); | 654 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); |
| 653 EXPECT_VALID(result); | 655 EXPECT_VALID(result); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 // Invalid function request. | 765 // Invalid function request. |
| 764 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9'," | 766 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9'," |
| 765 "'x'], [], []]", cid); | 767 "'x'], [], []]", cid); |
| 766 Service::HandleIsolateMessage(isolate, service_msg); | 768 Service::HandleIsolateMessage(isolate, service_msg); |
| 767 handler.HandleNextMessage(); | 769 handler.HandleNextMessage(); |
| 768 ExpectSubstringF(handler.msg(), | 770 ExpectSubstringF(handler.msg(), |
| 769 "{\"type\":\"Error\",\"id\":\"\",\"message\":\"Command too long\"," | 771 "{\"type\":\"Error\",\"id\":\"\",\"message\":\"Command too long\"," |
| 770 "\"request\":" | 772 "\"request\":" |
| 771 "{\"arguments\":[\"classes\",\"%" Pd "\",\"functions\",\"9\",\"x\"]," | 773 "{\"arguments\":[\"classes\",\"%" Pd "\",\"functions\",\"9\",\"x\"]," |
| 772 "\"option_keys\":[],\"option_values\":[]}}", cid); | 774 "\"option_keys\":[],\"option_values\":[]}}", cid); |
| 775 |
| 776 // Retained size of all instances of class B. |
| 777 const Class& class_b = Class::Handle(GetClass(lib, "B")); |
| 778 EXPECT(!class_b.IsNull()); |
| 779 const Instance& b0 = Instance::Handle(Instance::New(class_b)); |
| 780 const Instance& b1 = Instance::Handle(Instance::New(class_b)); |
| 781 service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'retained']," |
| 782 "[], []]", class_b.id()); |
| 783 Service::HandleIsolateMessage(isolate, service_msg); |
| 784 handler.HandleNextMessage(); |
| 785 ExpectSubstringF(handler.msg(), |
| 786 "\"id\":\"objects\\/int-%" Pd "\"", |
| 787 b0.raw()->Size() + b1.raw()->Size()); |
| 773 } | 788 } |
| 774 | 789 |
| 775 | 790 |
| 776 TEST_CASE(Service_Types) { | 791 TEST_CASE(Service_Types) { |
| 777 const char* kScript = | 792 const char* kScript = |
| 778 "var port;\n" // Set to our mock port by C++. | 793 "var port;\n" // Set to our mock port by C++. |
| 779 "\n" | 794 "\n" |
| 780 "class A<T> { }\n" | 795 "class A<T> { }\n" |
| 781 "\n" | 796 "\n" |
| 782 "main() {\n" | 797 "main() {\n" |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]"); | 1405 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]"); |
| 1391 Service::HandleIsolateMessage(isolate, service_msg); | 1406 Service::HandleIsolateMessage(isolate, service_msg); |
| 1392 handler.HandleNextMessage(); | 1407 handler.HandleNextMessage(); |
| 1393 // Expect error. | 1408 // Expect error. |
| 1394 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); | 1409 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); |
| 1395 } | 1410 } |
| 1396 | 1411 |
| 1397 #endif // !defined(TARGET_ARCH_ARM64) | 1412 #endif // !defined(TARGET_ARCH_ARM64) |
| 1398 | 1413 |
| 1399 } // namespace dart | 1414 } // namespace dart |
| OLD | NEW |