Chromium Code Reviews| 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 829 EXPECT(!class_b.IsNull()); | 829 EXPECT(!class_b.IsNull()); |
| 830 const Instance& b0 = Instance::Handle(Instance::New(class_b)); | 830 const Instance& b0 = Instance::Handle(Instance::New(class_b)); |
| 831 const Instance& b1 = Instance::Handle(Instance::New(class_b)); | 831 const Instance& b1 = Instance::Handle(Instance::New(class_b)); |
| 832 service_msg = EvalF(h_lib, "[0, port, ['classes', '%" Pd "', 'retained']," | 832 service_msg = EvalF(h_lib, "[0, port, ['classes', '%" Pd "', 'retained']," |
| 833 "[], []]", class_b.id()); | 833 "[], []]", class_b.id()); |
| 834 Service::HandleIsolateMessage(isolate, service_msg); | 834 Service::HandleIsolateMessage(isolate, service_msg); |
| 835 handler.HandleNextMessage(); | 835 handler.HandleNextMessage(); |
| 836 ExpectSubstringF(handler.msg(), | 836 ExpectSubstringF(handler.msg(), |
| 837 "\"id\":\"objects\\/int-%" Pd "\"", | 837 "\"id\":\"objects\\/int-%" Pd "\"", |
| 838 b0.raw()->Size() + b1.raw()->Size()); | 838 b0.raw()->Size() + b1.raw()->Size()); |
| 839 // ... and list the instances of class B. | |
| 840 service_msg = EvalF(h_lib, "[0, port, ['classes', '%" Pd "', 'instances']," | |
| 841 "['limit'], ['3']]", class_b.id()); | |
| 842 Service::HandleIsolateMessage(isolate, service_msg); | |
| 843 handler.HandleNextMessage(); | |
| 844 ExpectSubstringF(handler.msg(), "\"type\":\"@Array\""); | |
| 845 // TODO(koda): Actually parse the response. | |
| 846 static const intptr_t kInstanceListId = 0; | |
| 847 ExpectSubstringF(handler.msg(), "\"id\":\"objects\\/%" Pd "\",\"length\":2", | |
| 848 kInstanceListId); | |
| 849 Array& list = Array::Handle(); | |
| 850 list ^= isolate->object_id_ring()->GetObjectForId(kInstanceListId); | |
| 851 EXPECT_EQ(2, list.Length()); | |
|
Cutch
2014/06/18 17:23:07
Might be good idea to have a test which verifies t
koda
2014/06/18 20:55:32
Done.
| |
| 852 // The list should contain {b0, b1}. | |
| 853 EXPECT((list.At(0) == b0.raw() && list.At(1) == b1.raw()) || | |
| 854 (list.At(0) == b1.raw() && list.At(1) == b0.raw())); | |
| 839 } | 855 } |
| 840 | 856 |
| 841 | 857 |
| 842 TEST_CASE(Service_Types) { | 858 TEST_CASE(Service_Types) { |
| 843 const char* kScript = | 859 const char* kScript = |
| 844 "var port;\n" // Set to our mock port by C++. | 860 "var port;\n" // Set to our mock port by C++. |
| 845 "\n" | 861 "\n" |
| 846 "class A<T> { }\n" | 862 "class A<T> { }\n" |
| 847 "\n" | 863 "\n" |
| 848 "main() {\n" | 864 "main() {\n" |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1509 service_msg = Eval(h_lib, "[0, port, ['profile'], ['tags'], ['hidden']]"); | 1525 service_msg = Eval(h_lib, "[0, port, ['profile'], ['tags'], ['hidden']]"); |
| 1510 Service::HandleIsolateMessage(isolate, service_msg); | 1526 Service::HandleIsolateMessage(isolate, service_msg); |
| 1511 handler.HandleNextMessage(); | 1527 handler.HandleNextMessage(); |
| 1512 // Expect error. | 1528 // Expect error. |
| 1513 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); | 1529 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); |
| 1514 } | 1530 } |
| 1515 | 1531 |
| 1516 #endif // !defined(TARGET_ARCH_ARM64) | 1532 #endif // !defined(TARGET_ARCH_ARM64) |
| 1517 | 1533 |
| 1518 } // namespace dart | 1534 } // namespace dart |
| OLD | NEW |