| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/lockers.h" | 6 #include "vm/lockers.h" |
| 7 #include "vm/message_handler.h" | 7 #include "vm/message_handler.h" |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 #include "vm/port.h" | 9 #include "vm/port.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 | 32 |
| 33 class PortTestMessageHandler : public MessageHandler { | 33 class PortTestMessageHandler : public MessageHandler { |
| 34 public: | 34 public: |
| 35 PortTestMessageHandler() : notify_count(0) {} | 35 PortTestMessageHandler() : notify_count(0) {} |
| 36 | 36 |
| 37 void MessageNotify(Message::Priority priority) { | 37 void MessageNotify(Message::Priority priority) { |
| 38 notify_count++; | 38 notify_count++; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool HandleMessage(Message* message) { return true; } | 41 MessageStatus HandleMessage(Message* message) { return kOK; } |
| 42 | 42 |
| 43 int notify_count; | 43 int notify_count; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 | 46 |
| 47 TEST_CASE(PortMap_CreateAndCloseOnePort) { | 47 TEST_CASE(PortMap_CreateAndCloseOnePort) { |
| 48 PortTestMessageHandler handler; | 48 PortTestMessageHandler handler; |
| 49 Dart_Port port = PortMap::CreatePort(&handler); | 49 Dart_Port port = PortMap::CreatePort(&handler); |
| 50 EXPECT_NE(0, port); | 50 EXPECT_NE(0, port); |
| 51 EXPECT(PortMapTestPeer::IsActivePort(port)); | 51 EXPECT(PortMapTestPeer::IsActivePort(port)); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 const char* message = "msg"; | 160 const char* message = "msg"; |
| 161 intptr_t message_len = strlen(message) + 1; | 161 intptr_t message_len = strlen(message) + 1; |
| 162 | 162 |
| 163 EXPECT(!PortMap::PostMessage(new Message( | 163 EXPECT(!PortMap::PostMessage(new Message( |
| 164 port, reinterpret_cast<uint8_t*>(strdup(message)), message_len, | 164 port, reinterpret_cast<uint8_t*>(strdup(message)), message_len, |
| 165 Message::kNormalPriority))); | 165 Message::kNormalPriority))); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace dart | 168 } // namespace dart |
| OLD | NEW |