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

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

Issue 9325022: Decode the Dart message into a Dart_CMessage structure before calling the native port callback (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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) 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/utils.h" 7 #include "platform/utils.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 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 Dart_NewString(""), 2882 Dart_NewString(""),
2883 Dart_NewString("main"), 2883 Dart_NewString("main"),
2884 0, 2884 0,
2885 NULL); 2885 NULL);
2886 EXPECT_VALID(result); 2886 EXPECT_VALID(result);
2887 } 2887 }
2888 2888
2889 2889
2890 void NewNativePort_send123(Dart_Port dest_port_id, 2890 void NewNativePort_send123(Dart_Port dest_port_id,
2891 Dart_Port reply_port_id, 2891 Dart_Port reply_port_id,
2892 uint8_t* data) { 2892 Dart_CMessage* message) {
2893 // Gets a null message.
2894 EXPECT_NOTNULL(message);
2895 EXPECT_EQ(Dart_CObject::kNull, message->root->type);
2896
2893 intptr_t response = 123; 2897 intptr_t response = 123;
2894 Dart_PostIntArray(reply_port_id, 1, &response); 2898 Dart_PostIntArray(reply_port_id, 1, &response);
2895 } 2899 }
2896 2900
2897 2901
2898 void NewNativePort_send321(Dart_Port dest_port_id, 2902 void NewNativePort_send321(Dart_Port dest_port_id,
2899 Dart_Port reply_port_id, 2903 Dart_Port reply_port_id,
2900 uint8_t* data) { 2904 Dart_CMessage* message) {
2905 // Gets a null message.
2906 EXPECT_NOTNULL(message);
2907 EXPECT_EQ(Dart_CObject::kNull, message->root->type);
2908
2901 intptr_t response = 321; 2909 intptr_t response = 321;
2902 Dart_PostIntArray(reply_port_id, 1, &response); 2910 Dart_PostIntArray(reply_port_id, 1, &response);
2903 } 2911 }
2904 2912
2905 2913
2906 UNIT_TEST_CASE(NewNativePort) { 2914 UNIT_TEST_CASE(NewNativePort) {
2907 // Create a port with a bogus handler. 2915 // Create a port with a bogus handler.
2908 Dart_Port error_port = Dart_NewNativePort("Foo", NULL, true); 2916 Dart_Port error_port = Dart_NewNativePort("Foo", NULL, true);
2909 EXPECT_EQ(kIllegalPort, error_port); 2917 EXPECT_EQ(kIllegalPort, error_port);
2910 2918
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 // We should have received the expected number of interrupts. 3225 // We should have received the expected number of interrupts.
3218 EXPECT_EQ(kInterruptCount, interrupt_count); 3226 EXPECT_EQ(kInterruptCount, interrupt_count);
3219 3227
3220 // Give the spawned thread enough time to properly exit. 3228 // Give the spawned thread enough time to properly exit.
3221 Isolate::SetInterruptCallback(saved); 3229 Isolate::SetInterruptCallback(saved);
3222 } 3230 }
3223 3231
3224 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3232 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3225 3233
3226 } // namespace dart 3234 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698