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

Side by Side Diff: runtime/vm/exceptions_test.cc

Issue 8501034: Deal with unhandled exceptions the same way in all Dart api functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/unit_test.h" 9 #include "vm/unit_test.h"
10 10
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 30
31 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { 31 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) {
32 // Invoke the specified entry point. 32 // Invoke the specified entry point.
33 Dart_Handle result = Dart_InvokeStatic(TestCase::lib(), 33 Dart_Handle result = Dart_InvokeStatic(TestCase::lib(),
34 Dart_NewString("Second"), 34 Dart_NewString("Second"),
35 Dart_NewString("method2"), 35 Dart_NewString("method2"),
36 0, 36 0,
37 NULL); 37 NULL);
38 ASSERT(Dart_IsValid(result)); 38 ASSERT(Dart_IsError(result));
39 ASSERT(Dart_ExceptionOccurred(result)); 39 ASSERT(Dart_IsUnhandledException(result));
40 return; 40 return;
41 } 41 }
42 42
43 43
44 void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) { 44 void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) {
45 // Invoke the specified entry point. 45 // Invoke the specified entry point.
46 Dart_Handle result = Dart_InvokeStatic(TestCase::lib(), 46 Dart_Handle result = Dart_InvokeStatic(TestCase::lib(),
47 Dart_NewString("Second"), 47 Dart_NewString("Second"),
48 Dart_NewString("method2"), 48 Dart_NewString("method2"),
49 0, 49 0,
50 NULL); 50 NULL);
51 ASSERT(Dart_IsValid(result)); 51 ASSERT(Dart_IsError(result));
52 ASSERT(Dart_ExceptionOccurred(result)); 52 ASSERT(Dart_IsUnhandledException(result));
53 Dart_Handle exception = Dart_GetException(result); 53 Dart_Handle exception = Dart_GetException(result);
54 ASSERT(Dart_IsValid(exception)); 54 ASSERT(!Dart_IsError(exception));
55 Dart_ThrowException(exception); 55 Dart_ThrowException(exception);
56 UNREACHABLE(); 56 UNREACHABLE();
57 return; 57 return;
58 } 58 }
59 59
60 60
61 // List all native functions implemented in the vm or core boot strap dart 61 // List all native functions implemented in the vm or core boot strap dart
62 // libraries so that we can resolve the native function to it's entry 62 // libraries so that we can resolve the native function to it's entry
63 // point. 63 // point.
64 #define UNHANDLED_NATIVE_LIST(V) \ 64 #define UNHANDLED_NATIVE_LIST(V) \
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); 130 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
131 Dart_InvokeStatic(lib, 131 Dart_InvokeStatic(lib,
132 Dart_NewString("UnhandledExceptionTest"), 132 Dart_NewString("UnhandledExceptionTest"),
133 Dart_NewString("testMain"), 133 Dart_NewString("testMain"),
134 0, 134 0,
135 NULL); 135 NULL);
136 } 136 }
137 #endif // TARGET_ARCH_IA32. 137 #endif // TARGET_ARCH_IA32.
138 138
139 } // namespace dart 139 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698