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

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 9182001: OOB messages and general message refactor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_api_state.h" 9 #include "vm/dart_api_state.h"
10 #include "vm/thread.h" 10 #include "vm/thread.h"
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 EXPECT_EQ(iso_2, Dart_CurrentIsolate()); 967 EXPECT_EQ(iso_2, Dart_CurrentIsolate());
968 Dart_ShutdownIsolate(); 968 Dart_ShutdownIsolate();
969 EXPECT(NULL == Dart_CurrentIsolate()); 969 EXPECT(NULL == Dart_CurrentIsolate());
970 Dart_EnterIsolate(iso_1); 970 Dart_EnterIsolate(iso_1);
971 EXPECT_EQ(iso_1, Dart_CurrentIsolate()); 971 EXPECT_EQ(iso_1, Dart_CurrentIsolate());
972 Dart_ShutdownIsolate(); 972 Dart_ShutdownIsolate();
973 EXPECT(NULL == Dart_CurrentIsolate()); 973 EXPECT(NULL == Dart_CurrentIsolate());
974 } 974 }
975 975
976 976
977 static bool MyPostMessageCallback(Dart_Isolate dest_isolate, 977 static void MyMessageNotifyCallback(Dart_Isolate dest_isolate) {
978 Dart_Port send_port,
979 Dart_Port reply_port,
980 Dart_Message message) {
981 return true;
982 }
983
984
985 static void MyClosePortCallback(Dart_Isolate dest_isolate,
986 Dart_Port port) {
987 } 978 }
988 979
989 980
990 UNIT_TEST_CASE(SetMessageCallbacks) { 981 UNIT_TEST_CASE(SetMessageCallbacks) {
991 Dart_Isolate dart_isolate = TestCase::CreateTestIsolate(); 982 Dart_Isolate dart_isolate = TestCase::CreateTestIsolate();
992 Dart_SetMessageCallbacks(&MyPostMessageCallback, &MyClosePortCallback); 983 Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback);
993 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); 984 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
994 EXPECT_EQ(&MyPostMessageCallback, isolate->post_message_callback()); 985 EXPECT_EQ(&MyMessageNotifyCallback, isolate->message_notify_callback());
995 EXPECT_EQ(&MyClosePortCallback, isolate->close_port_callback());
996 Dart_ShutdownIsolate(); 986 Dart_ShutdownIsolate();
997 } 987 }
998 988
999 989
1000 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. 990 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests.
1001 991
1002 TEST_CASE(FieldAccess) { 992 TEST_CASE(FieldAccess) {
1003 const char* kScriptChars = 993 const char* kScriptChars =
1004 "class Fields {\n" 994 "class Fields {\n"
1005 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n" 995 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n"
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 // We should have received the expected number of interrupts. 2961 // We should have received the expected number of interrupts.
2972 EXPECT_EQ(kInterruptCount, interrupt_count); 2962 EXPECT_EQ(kInterruptCount, interrupt_count);
2973 2963
2974 // Give the spawned thread enough time to properly exit. 2964 // Give the spawned thread enough time to properly exit.
2975 Isolate::SetInterruptCallback(saved); 2965 Isolate::SetInterruptCallback(saved);
2976 } 2966 }
2977 2967
2978 #endif // TARGET_ARCH_IA32. 2968 #endif // TARGET_ARCH_IA32.
2979 2969
2980 } // namespace dart 2970 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698