| OLD | NEW |
| 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/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 EXPECT_EQ(iso_2, Isolate::Current()); | 441 EXPECT_EQ(iso_2, Isolate::Current()); |
| 442 Dart_ShutdownIsolate(); | 442 Dart_ShutdownIsolate(); |
| 443 EXPECT(NULL == Isolate::Current()); | 443 EXPECT(NULL == Isolate::Current()); |
| 444 Dart_EnterIsolate(iso_1); | 444 Dart_EnterIsolate(iso_1); |
| 445 EXPECT_EQ(iso_1, Isolate::Current()); | 445 EXPECT_EQ(iso_1, Isolate::Current()); |
| 446 Dart_ShutdownIsolate(); | 446 Dart_ShutdownIsolate(); |
| 447 EXPECT(NULL == Isolate::Current()); | 447 EXPECT(NULL == Isolate::Current()); |
| 448 } | 448 } |
| 449 | 449 |
| 450 | 450 |
| 451 static bool MyPostMessageCallback(Dart_Isolate dest_isolate, |
| 452 Dart_Port send_port, |
| 453 Dart_Port reply_port, |
| 454 Dart_Message message) { |
| 455 return true; |
| 456 } |
| 457 |
| 458 |
| 459 static void MyClosePortCallback(Dart_Isolate dest_isolate, |
| 460 Dart_Port port) { |
| 461 } |
| 462 |
| 463 |
| 464 UNIT_TEST_CASE(SetMessageCallbacks) { |
| 465 Dart_Isolate dart_isolate = Dart_CreateIsolate(NULL, NULL); |
| 466 Dart_SetMessageCallbacks(&MyPostMessageCallback, &MyClosePortCallback); |
| 467 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); |
| 468 EXPECT_EQ(&MyPostMessageCallback, isolate->post_message_callback()); |
| 469 EXPECT_EQ(&MyClosePortCallback, isolate->close_port_callback()); |
| 470 Dart_ShutdownIsolate(); |
| 471 } |
| 472 |
| 473 |
| 451 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. | 474 #if defined(TARGET_ARCH_IA32) // only ia32 can run execution tests. |
| 452 | 475 |
| 453 UNIT_TEST_CASE(FieldAccess) { | 476 UNIT_TEST_CASE(FieldAccess) { |
| 454 const char* kScriptChars = | 477 const char* kScriptChars = |
| 455 "class Fields {\n" | 478 "class Fields {\n" |
| 456 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n" | 479 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n" |
| 457 " int fld1;\n" | 480 " int fld1;\n" |
| 458 " final int fld2;\n" | 481 " final int fld2;\n" |
| 459 " static int fld3;\n" | 482 " static int fld3;\n" |
| 460 " static final int fld4 = 10;\n" | 483 " static final int fld4 = 10;\n" |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 retobj = Dart_GetResult(result); | 1416 retobj = Dart_GetResult(result); |
| 1394 EXPECT(Dart_ExceptionOccurred(retobj)); */ | 1417 EXPECT(Dart_ExceptionOccurred(retobj)); */ |
| 1395 } | 1418 } |
| 1396 Dart_ExitScope(); // Exit the Dart API scope. | 1419 Dart_ExitScope(); // Exit the Dart API scope. |
| 1397 Dart_ShutdownIsolate(); | 1420 Dart_ShutdownIsolate(); |
| 1398 } | 1421 } |
| 1399 | 1422 |
| 1400 #endif // TARGET_ARCH_IA32. | 1423 #endif // TARGET_ARCH_IA32. |
| 1401 | 1424 |
| 1402 } // namespace dart | 1425 } // namespace dart |
| OLD | NEW |