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

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

Issue 2992893002: Reapply "[vm] Don't enable the profiler by default. Enable the profiler at startup with --observe, … (Closed)
Patch Set: native symbol resolver Created 3 years, 4 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.cc ('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_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"
16 #include "vm/safepoint.h" 17 #include "vm/safepoint.h"
17 #include "vm/service.h" 18 #include "vm/service.h"
18 #include "vm/unit_test.h" 19 #include "vm/unit_test.h"
19 20
20 namespace dart { 21 namespace dart {
21 22
22 // This flag is used in the Service_Flags test below. 23 // This flag is used in the Service_Flags test below.
23 DEFINE_FLAG(bool, service_testing_flag, false, "Comment"); 24 DEFINE_FLAG(bool, service_testing_flag, false, "Comment");
24 25
25 #ifndef PRODUCT 26 #ifndef PRODUCT
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 service_msg = Eval(lib, "[0, port, '0', 'beta', [], []]"); 719 service_msg = Eval(lib, "[0, port, '0', 'beta', [], []]");
719 HandleIsolateMessage(isolate, service_msg); 720 HandleIsolateMessage(isolate, service_msg);
720 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); 721 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
721 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"error\":beta,\"id\":\"0\"}", 722 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"error\":beta,\"id\":\"0\"}",
722 handler.msg()); 723 handler.msg());
723 } 724 }
724 725
725 // TODO(zra): Remove when tests are ready to enable. 726 // TODO(zra): Remove when tests are ready to enable.
726 #if !defined(TARGET_ARCH_ARM64) 727 #if !defined(TARGET_ARCH_ARM64)
727 728
729 static void EnableProfiler() {
730 if (!FLAG_profiler) {
731 FLAG_profiler = true;
732 Profiler::InitOnce();
733 }
734 }
735
728 TEST_CASE(Service_Profile) { 736 TEST_CASE(Service_Profile) {
737 EnableProfiler();
729 const char* kScript = 738 const char* kScript =
730 "var port;\n" // Set to our mock port by C++. 739 "var port;\n" // Set to our mock port by C++.
731 "\n" 740 "\n"
732 "var x = 7;\n" 741 "var x = 7;\n"
733 "main() {\n" 742 "main() {\n"
734 " x = x * x;\n" 743 " x = x * x;\n"
735 " x = x / 13;\n" 744 " x = x / 13;\n"
736 "}"; 745 "}";
737 746
738 Isolate* isolate = thread->isolate(); 747 Isolate* isolate = thread->isolate();
(...skipping 30 matching lines...) Expand all
769 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); 778 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
770 // Expect error. 779 // Expect error.
771 EXPECT_SUBSTRING("\"error\"", handler.msg()); 780 EXPECT_SUBSTRING("\"error\"", handler.msg());
772 } 781 }
773 782
774 #endif // !defined(TARGET_ARCH_ARM64) 783 #endif // !defined(TARGET_ARCH_ARM64)
775 784
776 #endif // !PRODUCT 785 #endif // !PRODUCT
777 786
778 } // namespace dart 787 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698