| 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_tools_api.h" | 7 #include "include/dart_tools_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" |
| 11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
| 12 #include "vm/message_handler.h" | 12 #include "vm/message_handler.h" |
| 13 #include "vm/object_id_ring.h" | 13 #include "vm/object_id_ring.h" |
| 14 #include "vm/os.h" | 14 #include "vm/os.h" |
| 15 #include "vm/port.h" | 15 #include "vm/port.h" |
| 16 #include "vm/profiler.h" | |
| 17 #include "vm/safepoint.h" | 16 #include "vm/safepoint.h" |
| 18 #include "vm/service.h" | 17 #include "vm/service.h" |
| 19 #include "vm/unit_test.h" | 18 #include "vm/unit_test.h" |
| 20 | 19 |
| 21 namespace dart { | 20 namespace dart { |
| 22 | 21 |
| 23 // This flag is used in the Service_Flags test below. | 22 // This flag is used in the Service_Flags test below. |
| 24 DEFINE_FLAG(bool, service_testing_flag, false, "Comment"); | 23 DEFINE_FLAG(bool, service_testing_flag, false, "Comment"); |
| 25 | 24 |
| 26 #ifndef PRODUCT | 25 #ifndef PRODUCT |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 service_msg = Eval(lib, "[0, port, '0', 'beta', [], []]"); | 718 service_msg = Eval(lib, "[0, port, '0', 'beta', [], []]"); |
| 720 HandleIsolateMessage(isolate, service_msg); | 719 HandleIsolateMessage(isolate, service_msg); |
| 721 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); | 720 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); |
| 722 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"error\":beta,\"id\":\"0\"}", | 721 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"error\":beta,\"id\":\"0\"}", |
| 723 handler.msg()); | 722 handler.msg()); |
| 724 } | 723 } |
| 725 | 724 |
| 726 // TODO(zra): Remove when tests are ready to enable. | 725 // TODO(zra): Remove when tests are ready to enable. |
| 727 #if !defined(TARGET_ARCH_ARM64) | 726 #if !defined(TARGET_ARCH_ARM64) |
| 728 | 727 |
| 729 static void EnableProfiler() { | |
| 730 if (!FLAG_profiler) { | |
| 731 FLAG_profiler = true; | |
| 732 Profiler::InitOnce(); | |
| 733 } | |
| 734 } | |
| 735 | |
| 736 TEST_CASE(Service_Profile) { | 728 TEST_CASE(Service_Profile) { |
| 737 EnableProfiler(); | |
| 738 const char* kScript = | 729 const char* kScript = |
| 739 "var port;\n" // Set to our mock port by C++. | 730 "var port;\n" // Set to our mock port by C++. |
| 740 "\n" | 731 "\n" |
| 741 "var x = 7;\n" | 732 "var x = 7;\n" |
| 742 "main() {\n" | 733 "main() {\n" |
| 743 " x = x * x;\n" | 734 " x = x * x;\n" |
| 744 " x = x / 13;\n" | 735 " x = x / 13;\n" |
| 745 "}"; | 736 "}"; |
| 746 | 737 |
| 747 Isolate* isolate = thread->isolate(); | 738 Isolate* isolate = thread->isolate(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 778 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); | 769 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); |
| 779 // Expect error. | 770 // Expect error. |
| 780 EXPECT_SUBSTRING("\"error\"", handler.msg()); | 771 EXPECT_SUBSTRING("\"error\"", handler.msg()); |
| 781 } | 772 } |
| 782 | 773 |
| 783 #endif // !defined(TARGET_ARCH_ARM64) | 774 #endif // !defined(TARGET_ARCH_ARM64) |
| 784 | 775 |
| 785 #endif // !PRODUCT | 776 #endif // !PRODUCT |
| 786 | 777 |
| 787 } // namespace dart | 778 } // namespace dart |
| OLD | NEW |