Chromium Code Reviews| Index: runtime/vm/service_test.cc |
| diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc |
| index 31efafc915864179d618b3a9375d612a71d321cf..03be4bbc1b434b7a18756a66f6d2776965268c39 100644 |
| --- a/runtime/vm/service_test.cc |
| +++ b/runtime/vm/service_test.cc |
| @@ -506,6 +506,7 @@ TEST_CASE(Service_EmbedderRootHandler) { |
| EXPECT_STREQ("{\"result\":beta, \"id\":\"0\"}", handler.msg()); |
| } |
| + |
| TEST_CASE(Service_EmbedderIsolateHandler) { |
| const char* kScript = |
| "var port;\n" // Set to our mock port by C++. |
| @@ -544,6 +545,33 @@ TEST_CASE(Service_EmbedderIsolateHandler) { |
| } |
| +static uint8_t* AllocMsg(const char* str) { |
| + return reinterpret_cast<uint8_t*>(strdup(str)); |
| +} |
| + |
| + |
| +TEST_CASE(Service_MessageQueue) { |
| + MessageQueue queue; |
| + EXPECT(queue.IsEmpty()); |
| + |
| + Dart_Port port = 1; |
| + |
| + const char* str1 = "msg1"; |
| + |
| + // Add a message. |
| + Message* msg1 = new Message( |
| + port, AllocMsg(str1), strlen(str1) + 1, Message::kNormalPriority); |
| + queue.Enqueue(msg1, false); |
| + EXPECT(queue.Length() == 1); |
| + EXPECT(!queue.IsEmpty()); |
| + |
| + // Print MessageQueue to JSON. |
| + JSONStream stream; |
| + queue.PrintJSON(&stream); |
| + // Expect a @IsolateMessage type. |
| + EXPECT_SUBSTRING("\"type\":\"IsolateMessage\"", stream.ToCString()); |
| +} |
|
turnidge
2015/05/04 17:47:13
In addition to this test, we should test this code
Cutch
2015/05/04 19:56:52
Acknowledged.
|
| + |
| // TODO(zra): Remove when tests are ready to enable. |
| #if !defined(TARGET_ARCH_ARM64) |