| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 EXPECT_EQ(0, state->ZoneSizeInBytes()); | 759 EXPECT_EQ(0, state->ZoneSizeInBytes()); |
| 760 EXPECT(scope == state->top_scope()); | 760 EXPECT(scope == state->top_scope()); |
| 761 Dart_ShutdownIsolate(); | 761 Dart_ShutdownIsolate(); |
| 762 } | 762 } |
| 763 | 763 |
| 764 | 764 |
| 765 UNIT_TEST_CASE(Isolates) { | 765 UNIT_TEST_CASE(Isolates) { |
| 766 // This test currently assumes that the Dart_Isolate type is an opaque | 766 // This test currently assumes that the Dart_Isolate type is an opaque |
| 767 // representation of Isolate*. | 767 // representation of Isolate*. |
| 768 Dart_Isolate iso_1 = TestCase::CreateTestIsolate(); | 768 Dart_Isolate iso_1 = TestCase::CreateTestIsolate(); |
| 769 EXPECT_EQ(iso_1, Isolate::Current()); | 769 EXPECT_EQ(iso_1, Api::CastIsolate(Isolate::Current())); |
| 770 Dart_Isolate isolate = Dart_CurrentIsolate(); | 770 Dart_Isolate isolate = Dart_CurrentIsolate(); |
| 771 EXPECT_EQ(iso_1, isolate); | 771 EXPECT_EQ(iso_1, isolate); |
| 772 Dart_ExitIsolate(); | 772 Dart_ExitIsolate(); |
| 773 EXPECT(NULL == Isolate::Current()); | |
| 774 EXPECT(NULL == Dart_CurrentIsolate()); | 773 EXPECT(NULL == Dart_CurrentIsolate()); |
| 775 Dart_Isolate iso_2 = TestCase::CreateTestIsolate(); | 774 Dart_Isolate iso_2 = TestCase::CreateTestIsolate(); |
| 776 EXPECT_EQ(iso_2, Isolate::Current()); | 775 EXPECT_EQ(iso_2, Dart_CurrentIsolate()); |
| 777 Dart_ExitIsolate(); | 776 Dart_ExitIsolate(); |
| 778 EXPECT(NULL == Isolate::Current()); | 777 EXPECT(NULL == Dart_CurrentIsolate()); |
| 779 Dart_EnterIsolate(iso_2); | 778 Dart_EnterIsolate(iso_2); |
| 780 EXPECT_EQ(iso_2, Isolate::Current()); | 779 EXPECT_EQ(iso_2, Dart_CurrentIsolate()); |
| 781 Dart_ShutdownIsolate(); | 780 Dart_ShutdownIsolate(); |
| 782 EXPECT(NULL == Isolate::Current()); | 781 EXPECT(NULL == Dart_CurrentIsolate()); |
| 783 Dart_EnterIsolate(iso_1); | 782 Dart_EnterIsolate(iso_1); |
| 784 EXPECT_EQ(iso_1, Isolate::Current()); | 783 EXPECT_EQ(iso_1, Dart_CurrentIsolate()); |
| 785 Dart_ShutdownIsolate(); | 784 Dart_ShutdownIsolate(); |
| 786 EXPECT(NULL == Isolate::Current()); | 785 EXPECT(NULL == Dart_CurrentIsolate()); |
| 787 } | 786 } |
| 788 | 787 |
| 789 | 788 |
| 790 static bool MyPostMessageCallback(Dart_Isolate dest_isolate, | 789 static bool MyPostMessageCallback(Dart_Isolate dest_isolate, |
| 791 Dart_Port send_port, | 790 Dart_Port send_port, |
| 792 Dart_Port reply_port, | 791 Dart_Port reply_port, |
| 793 Dart_Message message) { | 792 Dart_Message message) { |
| 794 return true; | 793 return true; |
| 795 } | 794 } |
| 796 | 795 |
| (...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2705 } | 2704 } |
| 2706 | 2705 |
| 2707 | 2706 |
| 2708 UNIT_TEST_CASE(RunLoop_Exception) { | 2707 UNIT_TEST_CASE(RunLoop_Exception) { |
| 2709 RunLoopTest(true); | 2708 RunLoopTest(true); |
| 2710 } | 2709 } |
| 2711 | 2710 |
| 2712 #endif // TARGET_ARCH_IA32. | 2711 #endif // TARGET_ARCH_IA32. |
| 2713 | 2712 |
| 2714 } // namespace dart | 2713 } // namespace dart |
| OLD | NEW |