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

Unified Diff: runtime/vm/service_test.cc

Issue 1371193005: VM restart + shutdown fixes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: more code review Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/service_isolate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service_test.cc
diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc
index 0bae8ad5da5080f1c9c9ffe91d318f5b2fcd97ce..406dfbb46c7be4e05c48c2772faa5cad1f37d6a1 100644
--- a/runtime/vm/service_test.cc
+++ b/runtime/vm/service_test.cc
@@ -29,7 +29,7 @@ class ServiceTestMessageHandler : public MessageHandler {
free(_msg);
}
- bool HandleMessage(Message* message) {
+ MessageStatus HandleMessage(Message* message) {
if (_msg != NULL) {
free(_msg);
}
@@ -41,7 +41,7 @@ class ServiceTestMessageHandler : public MessageHandler {
String& response = String::Handle();
response ^= response_obj.raw();
_msg = strdup(response.ToCString());
- return true;
+ return kOK;
}
const char* msg() const { return _msg; }
@@ -191,7 +191,7 @@ TEST_CASE(Service_Code) {
service_msg =
Eval(lib, "[0, port, '0', 'getObject', ['objectId'], ['code/0']]");
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_SUBSTRING("\"error\"", handler.msg());
// The following test checks that a code object can be found only
@@ -201,7 +201,7 @@ TEST_CASE(Service_Code) {
compile_timestamp,
entry);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_SUBSTRING("\"type\":\"Code\"", handler.msg());
{
// Only perform a partial match.
@@ -222,7 +222,7 @@ TEST_CASE(Service_Code) {
compile_timestamp,
address);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_SUBSTRING("\"error\"", handler.msg());
// Request code object at (compile_timestamp - 1)-code.EntryPoint()
@@ -233,7 +233,7 @@ TEST_CASE(Service_Code) {
compile_timestamp - 1,
address);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_SUBSTRING("\"error\"", handler.msg());
// Request native code at address. Expect the null code object back.
@@ -242,7 +242,7 @@ TEST_CASE(Service_Code) {
"['objectId'], ['code/native-%" Px "']]",
address);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// TODO(turnidge): It is pretty broken to return an Instance here. Fix.
EXPECT_SUBSTRING("\"kind\":\"Null\"",
handler.msg());
@@ -252,7 +252,7 @@ TEST_CASE(Service_Code) {
"['code/native%" Px "']]",
address);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_SUBSTRING("\"error\"", handler.msg());
}
@@ -295,7 +295,7 @@ TEST_CASE(Service_TokenStream) {
service_msg = EvalF(lib, "[0, port, '0', 'getObject', "
"['objectId'], ['objects/%" Pd "']]", id);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// Check type.
EXPECT_SUBSTRING("\"type\":\"Object\"", handler.msg());
@@ -357,7 +357,7 @@ TEST_CASE(Service_PcDescriptors) {
service_msg = EvalF(lib, "[0, port, '0', 'getObject', "
"['objectId'], ['objects/%" Pd "']]", id);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// Check type.
EXPECT_SUBSTRING("\"type\":\"Object\"", handler.msg());
EXPECT_SUBSTRING("\"_vmType\":\"PcDescriptors\"", handler.msg());
@@ -418,7 +418,7 @@ TEST_CASE(Service_LocalVarDescriptors) {
service_msg = EvalF(lib, "[0, port, '0', 'getObject', "
"['objectId'], ['objects/%" Pd "']]", id);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// Check type.
EXPECT_SUBSTRING("\"type\":\"Object\"", handler.msg());
EXPECT_SUBSTRING("\"_vmType\":\"LocalVarDescriptors\"", handler.msg());
@@ -463,7 +463,7 @@ TEST_CASE(Service_Address) {
addr);
service_msg = Eval(lib, buf);
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_SUBSTRING(ref ? "\"type\":\"@Instance\"" :
"\"type\":\"Instance\"",
handler.msg());
@@ -474,7 +474,7 @@ TEST_CASE(Service_Address) {
service_msg = Eval(lib, "[0, port, '0', '_getObjectByAddress', "
"['address'], ['7']]");
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// TODO(turnidge): Should this be a ServiceException instead?
EXPECT_SUBSTRING("{\"type\":\"Sentinel\",\"kind\":\"Free\","
"\"valueAsString\":\"<free>\"",
@@ -532,12 +532,12 @@ TEST_CASE(Service_EmbedderRootHandler) {
Array& service_msg = Array::Handle();
service_msg = Eval(lib, "[0, port, '\"', 'alpha', [], []]");
Service::HandleRootMessage(service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"result\":alpha,\"id\":\"\\\"\"}",
handler.msg());
service_msg = Eval(lib, "[0, port, 1, 'beta', [], []]");
Service::HandleRootMessage(service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"result\":beta,\"id\":1}",
handler.msg());
}
@@ -572,12 +572,12 @@ TEST_CASE(Service_EmbedderIsolateHandler) {
Array& service_msg = Array::Handle();
service_msg = Eval(lib, "[0, port, '0', 'alpha', [], []]");
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"result\":alpha,\"id\":\"0\"}",
handler.msg());
service_msg = Eval(lib, "[0, port, '0', 'beta', [], []]");
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"result\":beta,\"id\":\"0\"}",
handler.msg());
}
@@ -611,21 +611,21 @@ TEST_CASE(Service_Profile) {
Array& service_msg = Array::Handle();
service_msg = Eval(lib, "[0, port, '0', '_getCpuProfile', [], []]");
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// Expect error (tags required).
EXPECT_SUBSTRING("\"error\"", handler.msg());
service_msg =
Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['None']]");
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// Expect profile
EXPECT_SUBSTRING("\"type\":\"_CpuProfile\"", handler.msg());
service_msg =
Eval(lib, "[0, port, '0', '_getCpuProfile', ['tags'], ['Bogus']]");
Service::HandleIsolateMessage(isolate, service_msg);
- handler.HandleNextMessage();
+ EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
// Expect error.
EXPECT_SUBSTRING("\"error\"", handler.msg());
}
« no previous file with comments | « runtime/vm/service_isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698