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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 8297004: Allow embedders to provide custom message delivery for an isolate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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
Index: runtime/vm/dart_api_impl_test.cc
===================================================================
--- runtime/vm/dart_api_impl_test.cc (revision 448)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -448,6 +448,37 @@
}
+static bool MyPostMessageCallback(Dart_Isolate dest_isolate,
+ Dart_Port send_port,
+ Dart_Port reply_port,
+ Dart_Message message) {
+ return true;
+}
+
+
+UNIT_TEST_CASE(SetPostMessageCallback) {
+ Dart_Isolate dart_isolate = Dart_CreateIsolate(NULL, NULL);
+ Dart_SetPostMessageCallback(&MyPostMessageCallback);
+ Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
+ EXPECT_EQ(&MyPostMessageCallback, isolate->post_message_callback());
+ Dart_ShutdownIsolate();
+}
+
+
+static void MyClosePortCallback(Dart_Isolate dest_isolate,
+ Dart_Port port) {
+}
+
+
+UNIT_TEST_CASE(SetClosePortCallback) {
+ Dart_Isolate dart_isolate = Dart_CreateIsolate(NULL, NULL);
+ Dart_SetClosePortCallback(&MyClosePortCallback);
+ Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
+ EXPECT_EQ(&MyClosePortCallback, isolate->close_port_callback());
+ Dart_ShutdownIsolate();
+}
+
+
#if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests.
UNIT_TEST_CASE(FieldAccess) {

Powered by Google App Engine
This is Rietveld 408576698