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

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

Issue 2651633002: VM: [Kernel] Fix bootstraping when Kernel isolate is used. (Closed)
Patch Set: Created 3 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
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 "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_mirrors_api.h" 8 #include "include/dart_mirrors_api.h"
9 #include "include/dart_native_api.h" 9 #include "include/dart_native_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 7130 matching lines...) Expand 10 before | Expand all | Expand 10 after
7141 url = NewString("lib.dart"); 7141 url = NewString("lib.dart");
7142 source = NewString(kLibraryChars); 7142 source = NewString(kLibraryChars);
7143 Dart_LoadLibrary(url, Dart_Null(), source, 0, 0); 7143 Dart_LoadLibrary(url, Dart_Null(), source, 0, 0);
7144 Dart_FinalizeLoading(false); 7144 Dart_FinalizeLoading(false);
7145 7145
7146 result = Dart_Invoke(result, NewString("main"), 0, NULL); 7146 result = Dart_Invoke(result, NewString("main"), 0, NULL);
7147 EXPECT_VALID(result); 7147 EXPECT_VALID(result);
7148 } 7148 }
7149 7149
7150 7150
7151 void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject* message) { 7151 void NewNativePort_send123(Dart_Port dest_port_id,
7152 Dart_CObject* message,
7153 void* peer) {
7152 // Gets a send port message. 7154 // Gets a send port message.
7153 EXPECT_NOTNULL(message); 7155 EXPECT_NOTNULL(message);
7154 EXPECT_EQ(Dart_CObject_kArray, message->type); 7156 EXPECT_EQ(Dart_CObject_kArray, message->type);
7155 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); 7157 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type);
7156 7158
7159 // Check peer validity.
7160 EXPECT_NOTNULL(peer);
7161 EXPECT_EQ(0xDEADBEEF, *static_cast<intptr_t*>(peer));
7162 *static_cast<intptr_t*>(peer) = 123;
7163
7157 // Post integer value. 7164 // Post integer value.
7158 Dart_CObject* response = 7165 Dart_CObject* response =
7159 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject))); 7166 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject)));
7160 response->type = Dart_CObject_kInt32; 7167 response->type = Dart_CObject_kInt32;
7161 response->value.as_int32 = 123; 7168 response->value.as_int32 = 123;
7162 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id, 7169 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id,
7163 response); 7170 response);
7164 } 7171 }
7165 7172
7166 7173
7167 void NewNativePort_send321(Dart_Port dest_port_id, Dart_CObject* message) { 7174 void NewNativePort_send321(Dart_Port dest_port_id,
7175 Dart_CObject* message,
7176 void* peer) {
7168 // Gets a null message. 7177 // Gets a null message.
7169 EXPECT_NOTNULL(message); 7178 EXPECT_NOTNULL(message);
7170 EXPECT_EQ(Dart_CObject_kArray, message->type); 7179 EXPECT_EQ(Dart_CObject_kArray, message->type);
7171 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); 7180 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type);
7172 7181
7182 // Check peer validity.
7183 EXPECT_NOTNULL(peer);
7184 EXPECT_EQ(0xDEADBEEF, *static_cast<intptr_t*>(peer));
7185 *static_cast<intptr_t*>(peer) = 321;
7186
7173 // Post integer value. 7187 // Post integer value.
7174 Dart_CObject* response = 7188 Dart_CObject* response =
7175 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject))); 7189 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject)));
7176 response->type = Dart_CObject_kInt32; 7190 response->type = Dart_CObject_kInt32;
7177 response->value.as_int32 = 321; 7191 response->value.as_int32 = 321;
7178 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id, 7192 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id,
7179 response); 7193 response);
7180 } 7194 }
7181 7195
7182 7196
7183 TEST_CASE(IllegalNewSendPort) { 7197 TEST_CASE(IllegalNewSendPort) {
7184 Dart_Handle error = Dart_NewSendPort(ILLEGAL_PORT); 7198 Dart_Handle error = Dart_NewSendPort(ILLEGAL_PORT);
7185 EXPECT(Dart_IsError(error)); 7199 EXPECT(Dart_IsError(error));
7186 EXPECT(Dart_IsApiError(error)); 7200 EXPECT(Dart_IsApiError(error));
7187 } 7201 }
7188 7202
7189 7203
7190 TEST_CASE(IllegalPost) { 7204 TEST_CASE(IllegalPost) {
7191 Dart_Handle message = Dart_True(); 7205 Dart_Handle message = Dart_True();
7192 bool success = Dart_Post(ILLEGAL_PORT, message); 7206 bool success = Dart_Post(ILLEGAL_PORT, message);
7193 EXPECT(!success); 7207 EXPECT(!success);
7194 } 7208 }
7195 7209
7196 7210
7197 UNIT_TEST_CASE(NewNativePort) { 7211 UNIT_TEST_CASE(NewNativePort) {
7198 // Create a port with a bogus handler. 7212 // Create a port with a bogus handler.
7199 Dart_Port error_port = Dart_NewNativePort("Foo", NULL, true); 7213 Dart_Port error_port = Dart_NewNativePort("Foo", NULL, true, NULL);
7200 EXPECT_EQ(ILLEGAL_PORT, error_port); 7214 EXPECT_EQ(ILLEGAL_PORT, error_port);
7201 7215
7216 intptr_t peer1 = 0xDEADBEEF;
7202 // Create the port w/o a current isolate, just to make sure that works. 7217 // Create the port w/o a current isolate, just to make sure that works.
7203 Dart_Port port_id1 = 7218 Dart_Port port_id1 =
7204 Dart_NewNativePort("Port123", NewNativePort_send123, true); 7219 Dart_NewNativePort("Port123", NewNativePort_send123, true, &peer1);
7205 7220
7206 TestIsolateScope __test_isolate__; 7221 TestIsolateScope __test_isolate__;
7207 const char* kScriptChars = 7222 const char* kScriptChars =
7208 "import 'dart:isolate';\n" 7223 "import 'dart:isolate';\n"
7209 "void callPort(SendPort port) {\n" 7224 "void callPort(SendPort port) {\n"
7210 " var receivePort = new RawReceivePort();\n" 7225 " var receivePort = new RawReceivePort();\n"
7211 " var replyPort = receivePort.sendPort;\n" 7226 " var replyPort = receivePort.sendPort;\n"
7212 " port.send([replyPort]);\n" 7227 " port.send([replyPort]);\n"
7213 " receivePort.handler = (message) {\n" 7228 " receivePort.handler = (message) {\n"
7214 " receivePort.close();\n" 7229 " receivePort.close();\n"
7215 " throw new Exception(message);\n" 7230 " throw new Exception(message);\n"
7216 " };\n" 7231 " };\n"
7217 "}\n"; 7232 "}\n";
7218 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 7233 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
7219 Dart_EnterScope(); 7234 Dart_EnterScope();
7220 7235
7221 // Create a port w/ a current isolate, to make sure that works too. 7236 // Create a port w/ a current isolate, to make sure that works too.
7237 intptr_t peer2 = 0xDEADBEEF;
7222 Dart_Port port_id2 = 7238 Dart_Port port_id2 =
7223 Dart_NewNativePort("Port321", NewNativePort_send321, true); 7239 Dart_NewNativePort("Port321", NewNativePort_send321, true, &peer2);
7224 7240
7225 Dart_Handle send_port1 = Dart_NewSendPort(port_id1); 7241 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
7226 EXPECT_VALID(send_port1); 7242 EXPECT_VALID(send_port1);
7227 Dart_Handle send_port2 = Dart_NewSendPort(port_id2); 7243 Dart_Handle send_port2 = Dart_NewSendPort(port_id2);
7228 EXPECT_VALID(send_port2); 7244 EXPECT_VALID(send_port2);
7229 7245
7230 // Test first port. 7246 // Test first port.
7231 Dart_Handle dart_args[1]; 7247 Dart_Handle dart_args[1];
7232 dart_args[0] = send_port1; 7248 dart_args[0] = send_port1;
7233 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args); 7249 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
7234 EXPECT_VALID(result); 7250 EXPECT_VALID(result);
7235 result = Dart_RunLoop(); 7251 result = Dart_RunLoop();
7236 EXPECT(Dart_IsError(result)); 7252 EXPECT(Dart_IsError(result));
7237 EXPECT(Dart_ErrorHasException(result)); 7253 EXPECT(Dart_ErrorHasException(result));
7238 EXPECT_SUBSTRING("Exception: 123\n", Dart_GetError(result)); 7254 EXPECT_SUBSTRING("Exception: 123\n", Dart_GetError(result));
7255 EXPECT_EQ(123, peer1);
7239 7256
7240 // result second port. 7257 // result second port.
7241 dart_args[0] = send_port2; 7258 dart_args[0] = send_port2;
7242 result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args); 7259 result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
7243 EXPECT_VALID(result); 7260 EXPECT_VALID(result);
7244 result = Dart_RunLoop(); 7261 result = Dart_RunLoop();
7245 EXPECT(Dart_IsError(result)); 7262 EXPECT(Dart_IsError(result));
7246 EXPECT(Dart_ErrorHasException(result)); 7263 EXPECT(Dart_ErrorHasException(result));
7247 EXPECT_SUBSTRING("Exception: 321\n", Dart_GetError(result)); 7264 EXPECT_SUBSTRING("Exception: 321\n", Dart_GetError(result));
7265 EXPECT_EQ(321, peer2);
7248 7266
7249 Dart_ExitScope(); 7267 Dart_ExitScope();
7250 7268
7251 // Delete the native ports. 7269 // Delete the native ports.
7252 EXPECT(Dart_CloseNativePort(port_id1)); 7270 EXPECT(Dart_CloseNativePort(port_id1));
7253 EXPECT(Dart_CloseNativePort(port_id2)); 7271 EXPECT(Dart_CloseNativePort(port_id2));
7254 } 7272 }
7255 7273
7256 7274
7257 void NewNativePort_sendInteger123(Dart_Port dest_port_id, 7275 void NewNativePort_sendInteger123(Dart_Port dest_port_id,
7258 Dart_CObject* message) { 7276 Dart_CObject* message,
7277 void* peer) {
7259 // Gets a send port message. 7278 // Gets a send port message.
7260 EXPECT_NOTNULL(message); 7279 EXPECT_NOTNULL(message);
7261 EXPECT_EQ(Dart_CObject_kArray, message->type); 7280 EXPECT_EQ(Dart_CObject_kArray, message->type);
7262 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); 7281 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type);
7263 7282
7264 // Post integer value. 7283 // Post integer value.
7265 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id, 7284 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
7266 123); 7285 123);
7267 } 7286 }
7268 7287
7269 7288
7270 void NewNativePort_sendInteger321(Dart_Port dest_port_id, 7289 void NewNativePort_sendInteger321(Dart_Port dest_port_id,
7271 Dart_CObject* message) { 7290 Dart_CObject* message,
7291 void* peer) {
7272 // Gets a null message. 7292 // Gets a null message.
7273 EXPECT_NOTNULL(message); 7293 EXPECT_NOTNULL(message);
7274 EXPECT_EQ(Dart_CObject_kArray, message->type); 7294 EXPECT_EQ(Dart_CObject_kArray, message->type);
7275 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); 7295 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type);
7276 7296
7277 // Post integer value. 7297 // Post integer value.
7278 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id, 7298 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
7279 321); 7299 321);
7280 } 7300 }
7281 7301
7282 7302
7283 TEST_CASE(NativePortPostInteger) { 7303 TEST_CASE(NativePortPostInteger) {
7284 const char* kScriptChars = 7304 const char* kScriptChars =
7285 "import 'dart:isolate';\n" 7305 "import 'dart:isolate';\n"
7286 "void callPort(SendPort port) {\n" 7306 "void callPort(SendPort port) {\n"
7287 " var receivePort = new RawReceivePort();\n" 7307 " var receivePort = new RawReceivePort();\n"
7288 " var replyPort = receivePort.sendPort;\n" 7308 " var replyPort = receivePort.sendPort;\n"
7289 " port.send([replyPort]);\n" 7309 " port.send([replyPort]);\n"
7290 " receivePort.handler = (message) {\n" 7310 " receivePort.handler = (message) {\n"
7291 " receivePort.close();\n" 7311 " receivePort.close();\n"
7292 " throw new Exception(message);\n" 7312 " throw new Exception(message);\n"
7293 " };\n" 7313 " };\n"
7294 "}\n"; 7314 "}\n";
7295 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 7315 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
7296 Dart_EnterScope(); 7316 Dart_EnterScope();
7297 7317
7298 Dart_Port port_id1 = 7318 Dart_Port port_id1 =
7299 Dart_NewNativePort("Port123", NewNativePort_sendInteger123, true); 7319 Dart_NewNativePort("Port123", NewNativePort_sendInteger123, true, NULL);
7300 Dart_Port port_id2 = 7320 Dart_Port port_id2 =
7301 Dart_NewNativePort("Port321", NewNativePort_sendInteger321, true); 7321 Dart_NewNativePort("Port321", NewNativePort_sendInteger321, true, NULL);
7302 7322
7303 Dart_Handle send_port1 = Dart_NewSendPort(port_id1); 7323 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
7304 EXPECT_VALID(send_port1); 7324 EXPECT_VALID(send_port1);
7305 Dart_Handle send_port2 = Dart_NewSendPort(port_id2); 7325 Dart_Handle send_port2 = Dart_NewSendPort(port_id2);
7306 EXPECT_VALID(send_port2); 7326 EXPECT_VALID(send_port2);
7307 7327
7308 // Test first port. 7328 // Test first port.
7309 Dart_Handle dart_args[1]; 7329 Dart_Handle dart_args[1];
7310 dart_args[0] = send_port1; 7330 dart_args[0] = send_port1;
7311 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args); 7331 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
(...skipping 14 matching lines...) Expand all
7326 7346
7327 Dart_ExitScope(); 7347 Dart_ExitScope();
7328 7348
7329 // Delete the native ports. 7349 // Delete the native ports.
7330 EXPECT(Dart_CloseNativePort(port_id1)); 7350 EXPECT(Dart_CloseNativePort(port_id1));
7331 EXPECT(Dart_CloseNativePort(port_id2)); 7351 EXPECT(Dart_CloseNativePort(port_id2));
7332 } 7352 }
7333 7353
7334 7354
7335 void NewNativePort_nativeReceiveNull(Dart_Port dest_port_id, 7355 void NewNativePort_nativeReceiveNull(Dart_Port dest_port_id,
7336 Dart_CObject* message) { 7356 Dart_CObject* message,
7357 void* peer) {
7337 EXPECT_NOTNULL(message); 7358 EXPECT_NOTNULL(message);
7338 7359
7339 if ((message->type == Dart_CObject_kArray) && 7360 if ((message->type == Dart_CObject_kArray) &&
7340 (message->value.as_array.values[0]->type == Dart_CObject_kSendPort)) { 7361 (message->value.as_array.values[0]->type == Dart_CObject_kSendPort)) {
7341 // Post integer value. 7362 // Post integer value.
7342 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id, 7363 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
7343 123); 7364 123);
7344 } else { 7365 } else {
7345 EXPECT_EQ(message->type, Dart_CObject_kNull); 7366 EXPECT_EQ(message->type, Dart_CObject_kNull);
7346 } 7367 }
7347 } 7368 }
7348 7369
7349 7370
7350 TEST_CASE(NativePortReceiveNull) { 7371 TEST_CASE(NativePortReceiveNull) {
7351 const char* kScriptChars = 7372 const char* kScriptChars =
7352 "import 'dart:isolate';\n" 7373 "import 'dart:isolate';\n"
7353 "void callPort(SendPort port) {\n" 7374 "void callPort(SendPort port) {\n"
7354 " var receivePort = new RawReceivePort();\n" 7375 " var receivePort = new RawReceivePort();\n"
7355 " var replyPort = receivePort.sendPort;\n" 7376 " var replyPort = receivePort.sendPort;\n"
7356 " port.send(null);\n" 7377 " port.send(null);\n"
7357 " port.send([replyPort]);\n" 7378 " port.send([replyPort]);\n"
7358 " receivePort.handler = (message) {\n" 7379 " receivePort.handler = (message) {\n"
7359 " receivePort.close();\n" 7380 " receivePort.close();\n"
7360 " throw new Exception(message);\n" 7381 " throw new Exception(message);\n"
7361 " };\n" 7382 " };\n"
7362 "}\n"; 7383 "}\n";
7363 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 7384 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
7364 Dart_EnterScope(); 7385 Dart_EnterScope();
7365 7386
7366 Dart_Port port_id1 = 7387 Dart_Port port_id1 = Dart_NewNativePort(
7367 Dart_NewNativePort("PortNull", NewNativePort_nativeReceiveNull, true); 7388 "PortNull", NewNativePort_nativeReceiveNull, true, NULL);
7368 Dart_Handle send_port1 = Dart_NewSendPort(port_id1); 7389 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
7369 EXPECT_VALID(send_port1); 7390 EXPECT_VALID(send_port1);
7370 7391
7371 // Test first port. 7392 // Test first port.
7372 Dart_Handle dart_args[1]; 7393 Dart_Handle dart_args[1];
7373 dart_args[0] = send_port1; 7394 dart_args[0] = send_port1;
7374 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args); 7395 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
7375 EXPECT_VALID(result); 7396 EXPECT_VALID(result);
7376 result = Dart_RunLoop(); 7397 result = Dart_RunLoop();
7377 EXPECT(Dart_IsError(result)); 7398 EXPECT(Dart_IsError(result));
7378 EXPECT(Dart_ErrorHasException(result)); 7399 EXPECT(Dart_ErrorHasException(result));
7379 EXPECT_SUBSTRING("Exception: 123\n", Dart_GetError(result)); 7400 EXPECT_SUBSTRING("Exception: 123\n", Dart_GetError(result));
7380 7401
7381 Dart_ExitScope(); 7402 Dart_ExitScope();
7382 7403
7383 // Delete the native ports. 7404 // Delete the native ports.
7384 EXPECT(Dart_CloseNativePort(port_id1)); 7405 EXPECT(Dart_CloseNativePort(port_id1));
7385 } 7406 }
7386 7407
7387 7408
7388 void NewNativePort_nativeReceiveInteger(Dart_Port dest_port_id, 7409 void NewNativePort_nativeReceiveInteger(Dart_Port dest_port_id,
7389 Dart_CObject* message) { 7410 Dart_CObject* message,
7411 void* peer) {
7390 EXPECT_NOTNULL(message); 7412 EXPECT_NOTNULL(message);
7391 7413
7392 if ((message->type == Dart_CObject_kArray) && 7414 if ((message->type == Dart_CObject_kArray) &&
7393 (message->value.as_array.values[0]->type == Dart_CObject_kSendPort)) { 7415 (message->value.as_array.values[0]->type == Dart_CObject_kSendPort)) {
7394 // Post integer value. 7416 // Post integer value.
7395 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id, 7417 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
7396 123); 7418 123);
7397 } else { 7419 } else {
7398 EXPECT_EQ(message->type, Dart_CObject_kInt32); 7420 EXPECT_EQ(message->type, Dart_CObject_kInt32);
7399 EXPECT_EQ(message->value.as_int32, 321); 7421 EXPECT_EQ(message->value.as_int32, 321);
(...skipping 10 matching lines...) Expand all
7410 " port.send(321);\n" 7432 " port.send(321);\n"
7411 " port.send([replyPort]);\n" 7433 " port.send([replyPort]);\n"
7412 " receivePort.handler = (message) {\n" 7434 " receivePort.handler = (message) {\n"
7413 " receivePort.close();\n" 7435 " receivePort.close();\n"
7414 " throw new Exception(message);\n" 7436 " throw new Exception(message);\n"
7415 " };\n" 7437 " };\n"
7416 "}\n"; 7438 "}\n";
7417 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 7439 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
7418 Dart_EnterScope(); 7440 Dart_EnterScope();
7419 7441
7420 Dart_Port port_id1 = 7442 Dart_Port port_id1 = Dart_NewNativePort(
7421 Dart_NewNativePort("PortNull", NewNativePort_nativeReceiveInteger, true); 7443 "PortNull", NewNativePort_nativeReceiveInteger, true, NULL);
7422 Dart_Handle send_port1 = Dart_NewSendPort(port_id1); 7444 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
7423 EXPECT_VALID(send_port1); 7445 EXPECT_VALID(send_port1);
7424 7446
7425 // Test first port. 7447 // Test first port.
7426 Dart_Handle dart_args[1]; 7448 Dart_Handle dart_args[1];
7427 dart_args[0] = send_port1; 7449 dart_args[0] = send_port1;
7428 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args); 7450 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
7429 EXPECT_VALID(result); 7451 EXPECT_VALID(result);
7430 result = Dart_RunLoop(); 7452 result = Dart_RunLoop();
7431 EXPECT(Dart_IsError(result)); 7453 EXPECT(Dart_IsError(result));
(...skipping 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after
9909 EXPECT_VALID(result); 9931 EXPECT_VALID(result);
9910 result = Dart_FinalizeLoading(false); 9932 result = Dart_FinalizeLoading(false);
9911 EXPECT_VALID(result); 9933 EXPECT_VALID(result);
9912 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL); 9934 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL);
9913 EXPECT(Dart_IsError(result)); 9935 EXPECT(Dart_IsError(result));
9914 } 9936 }
9915 9937
9916 #endif // !PRODUCT 9938 #endif // !PRODUCT
9917 9939
9918 } // namespace dart 9940 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698