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

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

Issue 217323006: Redo allocationprofile options (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« 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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "vm/dart_api_impl.h" 6 #include "vm/dart_api_impl.h"
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/debugger.h" 8 #include "vm/debugger.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/message_handler.h" 10 #include "vm/message_handler.h"
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 Dart_Handle port = 1107 Dart_Handle port =
1108 Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id)); 1108 Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id));
1109 EXPECT_VALID(port); 1109 EXPECT_VALID(port);
1110 EXPECT_VALID(Dart_SetField(h_lib, NewString("port"), port)); 1110 EXPECT_VALID(Dart_SetField(h_lib, NewString("port"), port));
1111 1111
1112 Instance& service_msg = Instance::Handle(); 1112 Instance& service_msg = Instance::Handle();
1113 service_msg = Eval(h_lib, "[port, ['allocationprofile'], [], []]"); 1113 service_msg = Eval(h_lib, "[port, ['allocationprofile'], [], []]");
1114 Service::HandleIsolateMessage(isolate, service_msg); 1114 Service::HandleIsolateMessage(isolate, service_msg);
1115 handler.HandleNextMessage(); 1115 handler.HandleNextMessage();
1116 EXPECT_SUBSTRING("\"type\":\"AllocationProfile\"", handler.msg()); 1116 EXPECT_SUBSTRING("\"type\":\"AllocationProfile\"", handler.msg());
1117
1118 // Too long.
1119 service_msg = Eval(h_lib, "[port, ['allocationprofile', 'foo'], [], []]");
1120 Service::HandleIsolateMessage(isolate, service_msg);
1121 handler.HandleNextMessage();
1122 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
1123
1124 // Bad gc option.
1125 service_msg = Eval(h_lib, "[port, ['allocationprofile'], ['gc'], ['cat']]");
1126 Service::HandleIsolateMessage(isolate, service_msg);
1127 handler.HandleNextMessage();
1128 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
1129
1130 // Bad reset option.
1131 service_msg = Eval(h_lib, "[port, ['allocationprofile'], ['reset'], ['ff']]");
1132 Service::HandleIsolateMessage(isolate, service_msg);
1133 handler.HandleNextMessage();
1134 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
1135
1136 // Good reset.
1137 service_msg =
1138 Eval(h_lib, "[port, ['allocationprofile'], ['reset'], ['true']]");
1139 Service::HandleIsolateMessage(isolate, service_msg);
1140 handler.HandleNextMessage();
1141 EXPECT_SUBSTRING("\"type\":\"AllocationProfile\"", handler.msg());
1142
1143 // Good GC.
1144 service_msg =
1145 Eval(h_lib, "[port, ['allocationprofile'], ['gc'], ['full']]");
1146 Service::HandleIsolateMessage(isolate, service_msg);
1147 handler.HandleNextMessage();
1148 EXPECT_SUBSTRING("\"type\":\"AllocationProfile\"", handler.msg());
1149
1150 // Good GC and reset.
1151 service_msg = Eval(h_lib,
1152 "[port, ['allocationprofile'], ['gc', 'reset'], ['full', 'true']]");
1153 Service::HandleIsolateMessage(isolate, service_msg);
1154 handler.HandleNextMessage();
1155 EXPECT_SUBSTRING("\"type\":\"AllocationProfile\"", handler.msg());
1117 } 1156 }
1118 1157
1119 1158
1120 TEST_CASE(Service_HeapMap) { 1159 TEST_CASE(Service_HeapMap) {
1121 const char* kScript = 1160 const char* kScript =
1122 "var port;\n" // Set to our mock port by C++. 1161 "var port;\n" // Set to our mock port by C++.
1123 "\n" 1162 "\n"
1124 "main() {\n" 1163 "main() {\n"
1125 "}"; 1164 "}";
1126 1165
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 EXPECT_SUBSTRING("\"type\":\"Profile\"", handler.msg()); 1369 EXPECT_SUBSTRING("\"type\":\"Profile\"", handler.msg());
1331 1370
1332 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]"); 1371 service_msg = Eval(h_lib, "[port, ['profile'], ['tags'], ['hidden']]");
1333 Service::HandleIsolateMessage(isolate, service_msg); 1372 Service::HandleIsolateMessage(isolate, service_msg);
1334 handler.HandleNextMessage(); 1373 handler.HandleNextMessage();
1335 // Expect error. 1374 // Expect error.
1336 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg()); 1375 EXPECT_SUBSTRING("\"type\":\"Error\"", handler.msg());
1337 } 1376 }
1338 1377
1339 } // namespace dart 1378 } // 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