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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/globals.h" | 6 #include "vm/globals.h" |
7 #include "vm/isolate.h" | 7 #include "vm/isolate.h" |
8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 10 matching lines...) Expand all Loading... |
21 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 21 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
22 // Test to ensure that an exception is thrown if no isolate creation | 22 // Test to ensure that an exception is thrown if no isolate creation |
23 // callback has been set by the embedder when an isolate is spawned. | 23 // callback has been set by the embedder when an isolate is spawned. |
24 TEST_CASE(IsolateSpawn) { | 24 TEST_CASE(IsolateSpawn) { |
25 const char* kScriptChars = | 25 const char* kScriptChars = |
26 "#import('dart:isolate');\n" | 26 "#import('dart:isolate');\n" |
27 "void entry() {}\n" | 27 "void entry() {}\n" |
28 "int testMain() {\n" | 28 "int testMain() {\n" |
29 " try {\n" | 29 " try {\n" |
30 " spawnFunction(entry);\n" | 30 " spawnFunction(entry);\n" |
31 " } catch (var e) {\n" | 31 " } catch (e) {\n" |
32 " throw;\n" | 32 " throw;\n" |
33 " }\n" | 33 " }\n" |
34 " return 0;\n" | 34 " return 0;\n" |
35 "}\n"; | 35 "}\n"; |
36 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 36 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
37 Dart_Handle result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL); | 37 Dart_Handle result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL); |
38 EXPECT_ERROR(result, "Null callback specified for isolate creation"); | 38 EXPECT_ERROR(result, "Null callback specified for isolate creation"); |
39 EXPECT(Dart_ErrorHasException(result)); | 39 EXPECT(Dart_ErrorHasException(result)); |
40 Dart_Handle exception_result = Dart_ErrorGetException(result); | 40 Dart_Handle exception_result = Dart_ErrorGetException(result); |
41 EXPECT_VALID(exception_result); | 41 EXPECT_VALID(exception_result); |
42 } | 42 } |
43 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 43 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
44 | 44 |
45 } // namespace dart | 45 } // namespace dart |
OLD | NEW |