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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 3001423002: Initial idle GC logic. (Closed)
Patch Set: divide-by-zero Created 3 years, 4 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
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/heap.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
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
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698