| 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 Service::HandleIsolateMessage(isolate, service_msg); | 831 Service::HandleIsolateMessage(isolate, service_msg); |
| 832 handler.HandleNextMessage(); | 832 handler.HandleNextMessage(); |
| 833 ExpectSubstringF(handler.msg(), | 833 ExpectSubstringF(handler.msg(), |
| 834 "\"id\":\"objects\\/int-%" Pd "\"", | 834 "\"id\":\"objects\\/int-%" Pd "\"", |
| 835 b0.raw()->Size() + b1.raw()->Size()); | 835 b0.raw()->Size() + b1.raw()->Size()); |
| 836 // ... and list the instances of class B. | 836 // ... and list the instances of class B. |
| 837 service_msg = EvalF(h_lib, "[0, port, ['classes', '%" Pd "', 'instances']," | 837 service_msg = EvalF(h_lib, "[0, port, ['classes', '%" Pd "', 'instances']," |
| 838 "['limit'], ['3']]", class_b.id()); | 838 "['limit'], ['3']]", class_b.id()); |
| 839 Service::HandleIsolateMessage(isolate, service_msg); | 839 Service::HandleIsolateMessage(isolate, service_msg); |
| 840 handler.HandleNextMessage(); | 840 handler.HandleNextMessage(); |
| 841 ExpectSubstringF(handler.msg(), "\"type\":\"@Array\""); | 841 ExpectSubstringF(handler.msg(), "\"type\":\"InstanceSet\""); |
| 842 ExpectSubstringF(handler.msg(), "\"totalCount\":2"); |
| 843 ExpectSubstringF(handler.msg(), "\"sampleCount\":2"); |
| 842 // TODO(koda): Actually parse the response. | 844 // TODO(koda): Actually parse the response. |
| 843 static const intptr_t kInstanceListId = 0; | 845 static const intptr_t kInstanceListId = 0; |
| 844 ExpectSubstringF(handler.msg(), "\"id\":\"objects\\/%" Pd "\",\"length\":2", | 846 ExpectSubstringF(handler.msg(), "\"id\":\"objects\\/%" Pd "\",\"length\":2", |
| 845 kInstanceListId); | 847 kInstanceListId); |
| 846 Array& list = Array::Handle(); | 848 Array& list = Array::Handle(); |
| 847 list ^= isolate->object_id_ring()->GetObjectForId(kInstanceListId); | 849 list ^= isolate->object_id_ring()->GetObjectForId(kInstanceListId); |
| 848 EXPECT_EQ(2, list.Length()); | 850 EXPECT_EQ(2, list.Length()); |
| 849 // The list should contain {b0, b1}. | 851 // The list should contain {b0, b1}. |
| 850 EXPECT((list.At(0) == b0.raw() && list.At(1) == b1.raw()) || | 852 EXPECT((list.At(0) == b0.raw() && list.At(1) == b1.raw()) || |
| 851 (list.At(0) == b1.raw() && list.At(1) == b0.raw())); | 853 (list.At(0) == b1.raw() && list.At(1) == b0.raw())); |
| 852 // ... and if limit is 1, we one get one of them. | 854 // ... and if limit is 1, we one get one of them. |
| 853 service_msg = EvalF(h_lib, "[0, port, ['classes', '%" Pd "', 'instances']," | 855 service_msg = EvalF(h_lib, "[0, port, ['classes', '%" Pd "', 'instances']," |
| 854 "['limit'], ['1']]", class_b.id()); | 856 "['limit'], ['1']]", class_b.id()); |
| 855 Service::HandleIsolateMessage(isolate, service_msg); | 857 Service::HandleIsolateMessage(isolate, service_msg); |
| 856 handler.HandleNextMessage(); | 858 handler.HandleNextMessage(); |
| 857 ExpectSubstringF(handler.msg(), "\"length\":1"); | 859 ExpectSubstringF(handler.msg(), "\"totalCount\":2"); |
| 860 ExpectSubstringF(handler.msg(), "\"sampleCount\":1"); |
| 858 } | 861 } |
| 859 | 862 |
| 860 | 863 |
| 861 TEST_CASE(Service_Types) { | 864 TEST_CASE(Service_Types) { |
| 862 const char* kScript = | 865 const char* kScript = |
| 863 "var port;\n" // Set to our mock port by C++. | 866 "var port;\n" // Set to our mock port by C++. |
| 864 "\n" | 867 "\n" |
| 865 "class A<T> { }\n" | 868 "class A<T> { }\n" |
| 866 "\n" | 869 "\n" |
| 867 "main() {\n" | 870 "main() {\n" |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 service_msg = Eval(h_lib, "[0, port, ['profile'], ['tags'], ['hidden']]"); | 1531 service_msg = Eval(h_lib, "[0, port, ['profile'], ['tags'], ['hidden']]"); |
| 1529 Service::HandleIsolateMessage(isolate, service_msg); | 1532 Service::HandleIsolateMessage(isolate, service_msg); |
| 1530 handler.HandleNextMessage(); | 1533 handler.HandleNextMessage(); |
| 1531 // Expect error. | 1534 // Expect error. |
| 1532 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); | 1535 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); |
| 1533 } | 1536 } |
| 1534 | 1537 |
| 1535 #endif // !defined(TARGET_ARCH_ARM64) | 1538 #endif // !defined(TARGET_ARCH_ARM64) |
| 1536 | 1539 |
| 1537 } // namespace dart | 1540 } // namespace dart |
| OLD | NEW |