| OLD | NEW |
| 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/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
| (...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 " final int fld2;\n" | 2820 " final int fld2;\n" |
| 2821 " static int fld3;\n" | 2821 " static int fld3;\n" |
| 2822 " static final int fld4 = 10;\n" | 2822 " static final int fld4 = 10;\n" |
| 2823 "}\n" | 2823 "}\n" |
| 2824 "class NativeFieldsTest {\n" | 2824 "class NativeFieldsTest {\n" |
| 2825 " static NativeFields testMain() {\n" | 2825 " static NativeFields testMain() {\n" |
| 2826 " NativeFields obj = new NativeFields(10, 20);\n" | 2826 " NativeFields obj = new NativeFields(10, 20);\n" |
| 2827 " return obj;\n" | 2827 " return obj;\n" |
| 2828 " }\n" | 2828 " }\n" |
| 2829 "}\n"; | 2829 "}\n"; |
| 2830 Dart_Handle result; | |
| 2831 const int kNumNativeFields = 4; | 2830 const int kNumNativeFields = 4; |
| 2832 | 2831 |
| 2833 // Create a test library. | 2832 // Create a test library. |
| 2834 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, | 2833 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, |
| 2835 native_field_lookup); | 2834 native_field_lookup); |
| 2836 | 2835 |
| 2837 // Create a native wrapper class with native fields. | 2836 // Create a native wrapper class with native fields. |
| 2838 result = Dart_CreateNativeWrapperClass( | 2837 Dart_Handle result = Dart_CreateNativeWrapperClass( |
| 2839 lib, | 2838 lib, |
| 2840 Dart_NewString("NativeFieldsWrapper"), | 2839 Dart_NewString("NativeFieldsWrapper"), |
| 2841 kNumNativeFields); | 2840 kNumNativeFields); |
| 2841 EXPECT_VALID(result); |
| 2842 | 2842 |
| 2843 // Load up a test script in it. | 2843 // Load up a test script in it. |
| 2844 | 2844 |
| 2845 // Invoke a function which returns an object of type NativeFields. | 2845 // Invoke a function which returns an object of type NativeFields. |
| 2846 Dart_Handle retobj = Dart_InvokeStatic(lib, | 2846 Dart_Handle retobj = Dart_InvokeStatic(lib, |
| 2847 Dart_NewString("NativeFieldsTest"), | 2847 Dart_NewString("NativeFieldsTest"), |
| 2848 Dart_NewString("testMain"), | 2848 Dart_NewString("testMain"), |
| 2849 0, | 2849 0, |
| 2850 NULL); | 2850 NULL); |
| 2851 EXPECT_VALID(retobj); | 2851 EXPECT_VALID(retobj); |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4736 // We should have received the expected number of interrupts. | 4736 // We should have received the expected number of interrupts. |
| 4737 EXPECT_EQ(kInterruptCount, interrupt_count); | 4737 EXPECT_EQ(kInterruptCount, interrupt_count); |
| 4738 | 4738 |
| 4739 // Give the spawned thread enough time to properly exit. | 4739 // Give the spawned thread enough time to properly exit. |
| 4740 Isolate::SetInterruptCallback(saved); | 4740 Isolate::SetInterruptCallback(saved); |
| 4741 } | 4741 } |
| 4742 | 4742 |
| 4743 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 4743 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 4744 | 4744 |
| 4745 } // namespace dart | 4745 } // namespace dart |
| OLD | NEW |