Index: runtime/vm/zone_test.cc |
diff --git a/runtime/vm/zone_test.cc b/runtime/vm/zone_test.cc |
index ba0a25b188c922647cdcb3ba0896a6849aecaa13..21b50c0076cd2c4efc69e2011678f226092c406c 100644 |
--- a/runtime/vm/zone_test.cc |
+++ b/runtime/vm/zone_test.cc |
@@ -228,4 +228,20 @@ UNIT_TEST_CASE(PrintZoneMemoryInfoToJSON) { |
} |
#endif |
+ |
+UNIT_TEST_CASE(NativeScopeZoneAllocation) { |
+ ASSERT(ApiNativeScope::Current() == NULL); |
+ ASSERT(Thread::Current() == NULL); |
+ EXPECT_EQ(0, ApiNativeScope::current_memory_usage()); |
+ { |
+ ApiNativeScope scope; |
+ EXPECT_EQ(scope.zone()->CapacityInBytes(), |
+ ApiNativeScope::current_memory_usage()); |
+ (void)Dart_ScopeAllocate(2048); |
+ EXPECT_EQ(scope.zone()->CapacityInBytes(), |
+ ApiNativeScope::current_memory_usage()); |
+ } |
+ EXPECT_EQ(0, ApiNativeScope::current_memory_usage()); |
+} |
+ |
} // namespace dart |