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

Unified Diff: runtime/vm/handles_test.cc

Issue 2640573003: Resolution for issue #5092: Unit test handle checks consider dangling handles to be valid. (Closed)
Patch Set: Created 3 years, 11 months 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
Index: runtime/vm/handles_test.cc
diff --git a/runtime/vm/handles_test.cc b/runtime/vm/handles_test.cc
index 8a05fb750af0db59d9dc811f43dd6739a6394f46..fd07721effbf79efddd7f2981674413952c5f504 100644
--- a/runtime/vm/handles_test.cc
+++ b/runtime/vm/handles_test.cc
@@ -77,4 +77,19 @@ TEST_CASE(AllocateScopeHandle) {
EXPECT_EQ(handle_count, VMHandles::ScopedHandleCount());
}
+
+// Unit test for Zone handle allocation.
+TEST_CASE(CheckHandleValidity) {
+#if defined(DEBUG)
+ FLAG_trace_handles = true;
+#endif
+ Dart_Handle handle = NULL;
+ {
+ StackZone sz(Thread::Current());
+ handle = reinterpret_cast<Dart_Handle>(&Smi::ZoneHandle(Smi::New(1)));
+ EXPECT_VALID(handle);
+ }
+ EXPECT_INVALID(handle);
siva 2017/01/18 23:27:06 EXPECT(!Api::IsValid(handle));
bkonyi 2017/01/19 01:05:13 Done.
+}
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698