Index: runtime/vm/dart_api_impl_test.cc |
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc |
index 9e9a4e3764d46675313a060c4cd5f0323624beeb..67ee0c412c9aad69c74410ed36803cf4d16b9384 100644 |
--- a/runtime/vm/dart_api_impl_test.cc |
+++ b/runtime/vm/dart_api_impl_test.cc |
@@ -9020,6 +9020,44 @@ TEST_CASE(DartAPI_LoadLibraryPatch_Error3) { |
EXPECT(Dart_IsError(result)); |
} |
+void NotifyIdleNative(Dart_NativeArguments args) { |
+ Dart_NotifyIdle(Dart_TimelineGetMicros() + 10 * kMicrosecondsPerMillisecond); |
+} |
+ |
+static Dart_NativeFunction NotifyIdle_native_lookup(Dart_Handle name, |
+ int argument_count, |
+ bool* auto_setup_scope) { |
+ ASSERT(auto_setup_scope != NULL); |
+ *auto_setup_scope = true; |
+ return reinterpret_cast<Dart_NativeFunction>(&NotifyIdleNative); |
+} |
+ |
+TEST_CASE(DartAPI_NotifyIdle) { |
+ const char* kScriptChars = |
+ "void notifyIdle() native 'Test_nativeFunc';\n" |
+ "void main() {\n" |
+ " var v;\n" |
+ " for (var i = 0; i < 100; i++) {\n" |
+ " var t = new List();\n" |
+ " for (var j = 0; j < 10000; j++) {\n" |
+ " t.add(new List(100));\n" |
+ " }\n" |
+ " v = t;\n" |
+ " notifyIdle();\n" |
+ " }\n" |
+ "}\n"; |
+ Dart_Handle lib = |
+ TestCase::LoadTestScript(kScriptChars, &NotifyIdle_native_lookup); |
+ Dart_Handle result; |
+ |
+ // Use Dart_PropagateError to propagate the error. |
+ use_throw_exception = false; |
+ use_set_return = false; |
+ |
+ result = Dart_Invoke(lib, NewString("main"), 0, NULL); |
+ EXPECT_VALID(result); |
+} |
+ |
#endif // !PRODUCT |
} // namespace dart |