| 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 7030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7041 Dart_ExitScope(); | 7041 Dart_ExitScope(); |
| 7042 | 7042 |
| 7043 // Delete the native ports. | 7043 // Delete the native ports. |
| 7044 EXPECT(Dart_CloseNativePort(port_id1)); | 7044 EXPECT(Dart_CloseNativePort(port_id1)); |
| 7045 EXPECT(Dart_CloseNativePort(port_id2)); | 7045 EXPECT(Dart_CloseNativePort(port_id2)); |
| 7046 } | 7046 } |
| 7047 | 7047 |
| 7048 | 7048 |
| 7049 static Dart_Isolate RunLoopTestCallback(const char* script_name, | 7049 static Dart_Isolate RunLoopTestCallback(const char* script_name, |
| 7050 const char* main, | 7050 const char* main, |
| 7051 const char* package_root, |
| 7051 void* data, | 7052 void* data, |
| 7052 char** error) { | 7053 char** error) { |
| 7053 const char* kScriptChars = | 7054 const char* kScriptChars = |
| 7054 "import 'builtin';\n" | 7055 "import 'builtin';\n" |
| 7055 "import 'dart:isolate';\n" | 7056 "import 'dart:isolate';\n" |
| 7056 "void entry(message) {\n" | 7057 "void entry(message) {\n" |
| 7057 " var data = message[0];\n" | 7058 " var data = message[0];\n" |
| 7058 " var replyTo = message[1];\n" | 7059 " var replyTo = message[1];\n" |
| 7059 " if (data) {\n" | 7060 " if (data) {\n" |
| 7060 " throw new Exception('MakeChildExit');\n" | 7061 " throw new Exception('MakeChildExit');\n" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7110 EXPECT_VALID(result); | 7111 EXPECT_VALID(result); |
| 7111 } | 7112 } |
| 7112 | 7113 |
| 7113 | 7114 |
| 7114 // Common code for RunLoop_Success/RunLoop_Failure. | 7115 // Common code for RunLoop_Success/RunLoop_Failure. |
| 7115 static void RunLoopTest(bool throw_exception_child, | 7116 static void RunLoopTest(bool throw_exception_child, |
| 7116 bool throw_exception_parent) { | 7117 bool throw_exception_parent) { |
| 7117 Dart_IsolateCreateCallback saved = Isolate::CreateCallback(); | 7118 Dart_IsolateCreateCallback saved = Isolate::CreateCallback(); |
| 7118 Isolate::SetCreateCallback(RunLoopTestCallback); | 7119 Isolate::SetCreateCallback(RunLoopTestCallback); |
| 7119 Isolate::SetUnhandledExceptionCallback(RunLoopUnhandledExceptionCallback); | 7120 Isolate::SetUnhandledExceptionCallback(RunLoopUnhandledExceptionCallback); |
| 7120 Dart_Isolate isolate = RunLoopTestCallback(NULL, NULL, NULL, NULL); | 7121 Dart_Isolate isolate = RunLoopTestCallback(NULL, NULL, NULL, NULL, NULL); |
| 7121 | 7122 |
| 7122 Dart_EnterIsolate(isolate); | 7123 Dart_EnterIsolate(isolate); |
| 7123 Dart_EnterScope(); | 7124 Dart_EnterScope(); |
| 7124 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url())); | 7125 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url())); |
| 7125 EXPECT_VALID(lib); | 7126 EXPECT_VALID(lib); |
| 7126 | 7127 |
| 7127 Dart_Handle result; | 7128 Dart_Handle result; |
| 7128 Dart_Handle args[2]; | 7129 Dart_Handle args[2]; |
| 7129 args[0] = (throw_exception_child ? Dart_True() : Dart_False()); | 7130 args[0] = (throw_exception_child ? Dart_True() : Dart_False()); |
| 7130 args[1] = (throw_exception_parent ? Dart_True() : Dart_False()); | 7131 args[1] = (throw_exception_parent ? Dart_True() : Dart_False()); |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8666 NewString("main"), | 8667 NewString("main"), |
| 8667 1, | 8668 1, |
| 8668 dart_args); | 8669 dart_args); |
| 8669 int64_t value = 0; | 8670 int64_t value = 0; |
| 8670 result = Dart_IntegerToInt64(result, &value); | 8671 result = Dart_IntegerToInt64(result, &value); |
| 8671 EXPECT_VALID(result); | 8672 EXPECT_VALID(result); |
| 8672 EXPECT_EQ(6, value); | 8673 EXPECT_EQ(6, value); |
| 8673 } | 8674 } |
| 8674 | 8675 |
| 8675 } // namespace dart | 8676 } // namespace dart |
| OLD | NEW |