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/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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 | 1488 |
1489 // Invoke a function which returns an object of type NativeFields. | 1489 // Invoke a function which returns an object of type NativeFields. |
1490 result = Dart_InvokeStatic(lib, | 1490 result = Dart_InvokeStatic(lib, |
1491 Dart_NewString("NativeFieldsTest"), | 1491 Dart_NewString("NativeFieldsTest"), |
1492 Dart_NewString("testMain"), | 1492 Dart_NewString("testMain"), |
1493 0, | 1493 0, |
1494 NULL); | 1494 NULL); |
1495 // We expect the test script to fail finalization with the error below: | 1495 // We expect the test script to fail finalization with the error below: |
1496 EXPECT(Dart_IsError(result)); | 1496 EXPECT(Dart_IsError(result)); |
1497 Dart_Handle expected_error = Dart_Error( | 1497 Dart_Handle expected_error = Dart_Error( |
1498 "'dart:test-lib': Error: class 'NativeFields' is trying to extend a " | 1498 "'dart:test-lib': Error: line 1 pos 38: class 'NativeFields' is trying"); |
1499 "native fields class, but library '%s' has no native resolvers", | 1499 EXPECT_SUBSTRING(Dart_GetError(expected_error), Dart_GetError(result)); |
1500 TestCase::url()); | |
1501 EXPECT_STREQ(Dart_GetError(expected_error), Dart_GetError(result)); | |
1502 } | 1500 } |
1503 | 1501 |
1504 | 1502 |
1505 static void TestNativeFields(Dart_Handle retobj) { | 1503 static void TestNativeFields(Dart_Handle retobj) { |
1506 // Access and set various instance fields of the object. | 1504 // Access and set various instance fields of the object. |
1507 Dart_Handle result = Dart_GetInstanceField(retobj, Dart_NewString("fld3")); | 1505 Dart_Handle result = Dart_GetInstanceField(retobj, Dart_NewString("fld3")); |
1508 EXPECT(Dart_IsError(result)); | 1506 EXPECT(Dart_IsError(result)); |
1509 result = Dart_GetInstanceField(retobj, Dart_NewString("fld0")); | 1507 result = Dart_GetInstanceField(retobj, Dart_NewString("fld0")); |
1510 EXPECT_VALID(result); | 1508 EXPECT_VALID(result); |
1511 EXPECT(Dart_IsNull(result)); | 1509 EXPECT(Dart_IsNull(result)); |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3223 // We should have received the expected number of interrupts. | 3221 // We should have received the expected number of interrupts. |
3224 EXPECT_EQ(kInterruptCount, interrupt_count); | 3222 EXPECT_EQ(kInterruptCount, interrupt_count); |
3225 | 3223 |
3226 // Give the spawned thread enough time to properly exit. | 3224 // Give the spawned thread enough time to properly exit. |
3227 Isolate::SetInterruptCallback(saved); | 3225 Isolate::SetInterruptCallback(saved); |
3228 } | 3226 } |
3229 | 3227 |
3230 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3228 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
3231 | 3229 |
3232 } // namespace dart | 3230 } // namespace dart |
OLD | NEW |