Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 8918028: If an unhandled exception occurs in Dart_RunLoop, pass it out to the caller. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
===================================================================
--- runtime/vm/dart_api_impl_test.cc (revision 2436)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -2766,7 +2766,7 @@
" void main() {\n"
" port.receive((message, replyTo) {\n"
" if (message) {\n"
- " throw new Exception('MakeVMExit');\n"
+ " throw new Exception('MakeChildExit');\n"
" } else {\n"
" replyTo.call('hello');\n"
" port.close();\n"
@@ -2775,10 +2775,11 @@
" }\n"
"}\n"
"\n"
- "void main(message) {\n"
+ "void main(exc_child, exc_parent) {\n"
" new MyIsolate().spawn().then((port) {\n"
- " port.call(message).receive((message, replyTo) {\n"
+ " port.call(exc_child).receive((message, replyTo) {\n"
" if (message != 'hello') throw new Exception('ShouldNotHappen');\n"
+ " if (exc_parent) throw new Exception('MakeParentExit');\n"
" });\n"
" });\n"
"}\n";
@@ -2799,7 +2800,8 @@
// Common code for RunLoop_Success/RunLoop_Failure.
-static void RunLoopTest(bool throw_exception) {
+static void RunLoopTest(bool throw_exception_child,
+ bool throw_exception_parent) {
Dart_IsolateCreateCallback saved = Isolate::CreateCallback();
Isolate::SetCreateCallback(RunLoopTestCallback);
RunLoopTestCallback(NULL, NULL);
@@ -2809,16 +2811,22 @@
EXPECT_VALID(lib);
Dart_Handle result;
- Dart_Handle args[1];
- args[0] = (throw_exception ? Dart_True() : Dart_False());
+ Dart_Handle args[2];
+ args[0] = (throw_exception_child ? Dart_True() : Dart_False());
+ args[1] = (throw_exception_parent ? Dart_True() : Dart_False());
result = Dart_InvokeStatic(lib,
Dart_NewString(""),
Dart_NewString("main"),
- 1,
+ 2,
args);
EXPECT_VALID(result);
result = Dart_RunLoop();
- EXPECT_VALID(result);
+ if (throw_exception_parent) {
+ EXPECT(Dart_IsError(result));
+ // TODO(turnidge): Once EXPECT_SUBSTRING is submitted use it here.
+ } else {
+ EXPECT_VALID(result);
+ }
Dart_ExitScope();
Dart_ShutdownIsolate();
@@ -2828,14 +2836,20 @@
UNIT_TEST_CASE(RunLoop_Success) {
- RunLoopTest(false);
+ RunLoopTest(false, false);
}
-UNIT_TEST_CASE(RunLoop_Exception) {
- RunLoopTest(true);
+// This test exits the vm. Listed as FAIL in vm.status.
+UNIT_TEST_CASE(RunLoop_ExceptionChild) {
+ RunLoopTest(true, false);
}
+
+UNIT_TEST_CASE(RunLoop_ExceptionParent) {
+ RunLoopTest(false, true);
+}
+
#endif // TARGET_ARCH_IA32.
} // namespace dart
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698