Index: runtime/vm/service_test.cc |
=================================================================== |
--- runtime/vm/service_test.cc (revision 32801) |
+++ runtime/vm/service_test.cc (working copy) |
@@ -45,6 +45,12 @@ |
}; |
+static void ServiceIsolateMessage(Isolate* isolate, const Instance& msg) { |
+ NativeToVmTimerScope timer(isolate); |
+ Service::HandleIsolateMessage(isolate, msg); |
+} |
+ |
+ |
static RawInstance* Eval(Dart_Handle lib, const char* expr) { |
Dart_Handle result = Dart_EvaluateExpr(lib, NewString(expr)); |
EXPECT_VALID(result); |
@@ -130,7 +136,7 @@ |
// Get the isolate summary. |
service_msg = Eval(lib, "[port, [], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
JSONReader reader(handler.msg()); |
@@ -186,7 +192,7 @@ |
// Get the stacktrace. |
service_msg = Eval(lib, "[port, ['stacktrace'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ( |
"{\"type\":\"StackTrace\",\"members\":[]}", |
@@ -194,7 +200,7 @@ |
// Malformed request. |
service_msg = Eval(lib, "[port, ['stacktrace', 'jamboree'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ( |
"{\"type\":\"Error\",\"text\":\"Command too long\"," |
@@ -231,7 +237,7 @@ |
// Get the breakpoint list. |
service_msg = Eval(lib, "[port, ['debug', 'breakpoints'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ( |
"{\"type\":\"BreakpointList\",\"breakpoints\":[{" |
@@ -243,7 +249,7 @@ |
// Individual breakpoint. |
service_msg = Eval(lib, "[port, ['debug', 'breakpoints', '1'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ( |
"{\"type\":\"Breakpoint\",\"id\":1,\"enabled\":true," |
@@ -254,7 +260,7 @@ |
// Missing sub-command. |
service_msg = Eval(lib, "[port, ['debug'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ( |
"{\"type\":\"Error\"," |
@@ -265,7 +271,7 @@ |
// Unrecognized breakpoint. |
service_msg = Eval(lib, "[port, ['debug', 'breakpoints', '1111'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ("{\"type\":\"Error\"," |
"\"text\":\"Unrecognized breakpoint id 1111\"," |
@@ -277,7 +283,7 @@ |
// Command too long. |
service_msg = |
Eval(lib, "[port, ['debug', 'breakpoints', '1111', 'green'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ("{\"type\":\"Error\",\"text\":\"Command too long\"," |
"\"message\":{\"arguments\":[\"debug\",\"breakpoints\"," |
@@ -287,7 +293,7 @@ |
// Unrecognized subcommand. |
service_msg = Eval(lib, "[port, ['debug', 'nosferatu'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ("{\"type\":\"Error\"," |
"\"text\":\"Unrecognized subcommand 'nosferatu'\"," |
@@ -339,7 +345,7 @@ |
// Request an invalid class id. |
service_msg = Eval(h_lib, "[port, ['classes', '999999'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ( |
"{\"type\":\"Error\",\"text\":\"999999 is not a valid class id.\"," |
@@ -348,7 +354,7 @@ |
// Request the class A over the service. |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "'], [], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_SUBSTRING("\"type\":\"Class\"", handler.msg()); |
@@ -357,7 +363,7 @@ |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '0']," |
"[], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_SUBSTRING("\"type\":\"Function\"", handler.msg()); |
ExpectSubstringF(handler.msg(), |
@@ -367,7 +373,7 @@ |
// Request field 0 from class A. |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '0']," |
"[], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_SUBSTRING("\"type\":\"Field\"", handler.msg()); |
ExpectSubstringF(handler.msg(), |
@@ -377,7 +383,7 @@ |
// Invalid sub command. |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'huh', '0']," |
"[], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
ExpectSubstringF(handler.msg(), |
"{\"type\":\"Error\",\"text\":\"Invalid sub collection huh\",\"message\":" |
@@ -387,7 +393,7 @@ |
// Invalid field request. |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '9']," |
"[], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
ExpectSubstringF(handler.msg(), |
"{\"type\":\"Error\",\"text\":\"Field 9 not found\"," |
@@ -397,7 +403,7 @@ |
// Invalid function request. |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9']," |
"[], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
ExpectSubstringF(handler.msg(), |
"{\"type\":\"Error\",\"text\":\"Function 9 not found\"," |
@@ -408,7 +414,7 @@ |
// Invalid field subcommand. |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'fields', '9', 'x']" |
",[], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
ExpectSubstringF(handler.msg(), |
"{\"type\":\"Error\",\"text\":\"Command too long\",\"message\":" |
@@ -418,7 +424,7 @@ |
// Invalid function request. |
service_msg = EvalF(h_lib, "[port, ['classes', '%" Pd "', 'functions', '9'," |
"'x'], [], []]", cid); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
ExpectSubstringF(handler.msg(), |
"{\"type\":\"Error\",\"text\":\"Command too long\",\"message\":" |
@@ -476,7 +482,7 @@ |
// Request an invalid code object. |
service_msg = Eval(h_lib, "[port, ['code', '0'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_STREQ( |
"{\"type\":\"Error\",\"text\":\"Could not find code at 0\",\"message\":" |
@@ -488,7 +494,7 @@ |
// Request code object at code.EntryPoint() |
// Expect this to succeed as it is inside [entry, entry + size). |
service_msg = EvalF(h_lib, "[port, ['code', '%" Px "'], [], []]", entry); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
{ |
// Only perform a partial match. |
@@ -503,7 +509,7 @@ |
// Expect this to succeed as it is inside [entry, entry + size). |
uintptr_t address = entry + 16; |
service_msg = EvalF(h_lib, "[port, ['code', '%" Px "'], [], []]", address); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
{ |
// Only perform a partial match. |
@@ -518,7 +524,7 @@ |
// Expect this to succeed as it is inside [entry, entry + size). |
address = last - 1; |
service_msg = EvalF(h_lib, "[port, ['code', '%" Px "'], [], []]", address); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
{ |
// Only perform a partial match. |
@@ -533,7 +539,7 @@ |
// to fail as it's outside of [entry, entry + size). |
address = last; |
service_msg = EvalF(h_lib, "[port, ['code', '%" Px "'], [], []]", address); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
{ |
const intptr_t kBufferSize = 1024; |
@@ -604,7 +610,7 @@ |
Instance& service_msg = Instance::Handle(); |
service_msg = Eval(h_lib, "[port, ['coverage'], [], []]"); |
- Service::HandleIsolateMessage(isolate, service_msg); |
+ ServiceIsolateMessage(isolate, service_msg); |
handler.HandleNextMessage(); |
EXPECT_SUBSTRING( |
"{\"source\":\"dart:test-lib\",\"script\":{" |