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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
7 #include "include/dart_debugger_api.h" | 7 #include "include/dart_debugger_api.h" |
8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 7056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7067 Dart_ExitScope(); | 7067 Dart_ExitScope(); |
7068 | 7068 |
7069 // Delete the native ports. | 7069 // Delete the native ports. |
7070 EXPECT(Dart_CloseNativePort(port_id1)); | 7070 EXPECT(Dart_CloseNativePort(port_id1)); |
7071 EXPECT(Dart_CloseNativePort(port_id2)); | 7071 EXPECT(Dart_CloseNativePort(port_id2)); |
7072 } | 7072 } |
7073 | 7073 |
7074 | 7074 |
7075 static Dart_Isolate RunLoopTestCallback(const char* script_name, | 7075 static Dart_Isolate RunLoopTestCallback(const char* script_name, |
7076 const char* main, | 7076 const char* main, |
| 7077 const char* package_root, |
7077 void* data, | 7078 void* data, |
7078 char** error) { | 7079 char** error) { |
7079 const char* kScriptChars = | 7080 const char* kScriptChars = |
7080 "import 'builtin';\n" | 7081 "import 'builtin';\n" |
7081 "import 'dart:isolate';\n" | 7082 "import 'dart:isolate';\n" |
7082 "void entry(message) {\n" | 7083 "void entry(message) {\n" |
7083 " var data = message[0];\n" | 7084 " var data = message[0];\n" |
7084 " var replyTo = message[1];\n" | 7085 " var replyTo = message[1];\n" |
7085 " if (data) {\n" | 7086 " if (data) {\n" |
7086 " throw new Exception('MakeChildExit');\n" | 7087 " throw new Exception('MakeChildExit');\n" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7136 EXPECT_VALID(result); | 7137 EXPECT_VALID(result); |
7137 } | 7138 } |
7138 | 7139 |
7139 | 7140 |
7140 // Common code for RunLoop_Success/RunLoop_Failure. | 7141 // Common code for RunLoop_Success/RunLoop_Failure. |
7141 static void RunLoopTest(bool throw_exception_child, | 7142 static void RunLoopTest(bool throw_exception_child, |
7142 bool throw_exception_parent) { | 7143 bool throw_exception_parent) { |
7143 Dart_IsolateCreateCallback saved = Isolate::CreateCallback(); | 7144 Dart_IsolateCreateCallback saved = Isolate::CreateCallback(); |
7144 Isolate::SetCreateCallback(RunLoopTestCallback); | 7145 Isolate::SetCreateCallback(RunLoopTestCallback); |
7145 Isolate::SetUnhandledExceptionCallback(RunLoopUnhandledExceptionCallback); | 7146 Isolate::SetUnhandledExceptionCallback(RunLoopUnhandledExceptionCallback); |
7146 Dart_Isolate isolate = RunLoopTestCallback(NULL, NULL, NULL, NULL); | 7147 Dart_Isolate isolate = RunLoopTestCallback(NULL, NULL, NULL, NULL, NULL); |
7147 | 7148 |
7148 Dart_EnterIsolate(isolate); | 7149 Dart_EnterIsolate(isolate); |
7149 Dart_EnterScope(); | 7150 Dart_EnterScope(); |
7150 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url())); | 7151 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url())); |
7151 EXPECT_VALID(lib); | 7152 EXPECT_VALID(lib); |
7152 | 7153 |
7153 Dart_Handle result; | 7154 Dart_Handle result; |
7154 Dart_Handle args[2]; | 7155 Dart_Handle args[2]; |
7155 args[0] = (throw_exception_child ? Dart_True() : Dart_False()); | 7156 args[0] = (throw_exception_child ? Dart_True() : Dart_False()); |
7156 args[1] = (throw_exception_parent ? Dart_True() : Dart_False()); | 7157 args[1] = (throw_exception_parent ? Dart_True() : Dart_False()); |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8692 NewString("main"), | 8693 NewString("main"), |
8693 1, | 8694 1, |
8694 dart_args); | 8695 dart_args); |
8695 int64_t value = 0; | 8696 int64_t value = 0; |
8696 result = Dart_IntegerToInt64(result, &value); | 8697 result = Dart_IntegerToInt64(result, &value); |
8697 EXPECT_VALID(result); | 8698 EXPECT_VALID(result); |
8698 EXPECT_EQ(6, value); | 8699 EXPECT_EQ(6, value); |
8699 } | 8700 } |
8700 | 8701 |
8701 } // namespace dart | 8702 } // namespace dart |
OLD | NEW |