| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index dcb11be19d1c84a377b2381a7d3929aff4bbe3a1..9b8be0a7a139b7ee39872437ad6fc2205beac468 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -15722,30 +15722,10 @@ static void CreateGarbageInOldSpace() {
|
| }
|
|
|
|
|
| -// Test that idle notification can be handled and eventually returns true.
|
| -TEST(IdleNotification) {
|
| - const intptr_t MB = 1024 * 1024;
|
| - const int IdlePauseInMs = 1000;
|
| - LocalContext env;
|
| - v8::HandleScope scope(env->GetIsolate());
|
| - intptr_t initial_size = CcTest::heap()->SizeOfObjects();
|
| - CreateGarbageInOldSpace();
|
| - intptr_t size_with_garbage = CcTest::heap()->SizeOfObjects();
|
| - CHECK_GT(size_with_garbage, initial_size + MB);
|
| - bool finished = false;
|
| - for (int i = 0; i < 200 && !finished; i++) {
|
| - finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
|
| - }
|
| - intptr_t final_size = CcTest::heap()->SizeOfObjects();
|
| - CHECK(finished);
|
| - CHECK_LT(final_size, initial_size + 1);
|
| -}
|
| -
|
| -
|
| // Test that idle notification can be handled and eventually collects garbage.
|
| TEST(IdleNotificationWithSmallHint) {
|
| const intptr_t MB = 1024 * 1024;
|
| - const int IdlePauseInMs = 900;
|
| + const double IdlePauseInSeconds = 0.9;
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
| intptr_t initial_size = CcTest::heap()->SizeOfObjects();
|
| @@ -15754,7 +15734,10 @@ TEST(IdleNotificationWithSmallHint) {
|
| CHECK_GT(size_with_garbage, initial_size + MB);
|
| bool finished = false;
|
| for (int i = 0; i < 200 && !finished; i++) {
|
| - finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
|
| + finished = env->GetIsolate()->IdleNotificationDeadline(
|
| + (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() /
|
| + static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) +
|
| + IdlePauseInSeconds);
|
| }
|
| intptr_t final_size = CcTest::heap()->SizeOfObjects();
|
| CHECK(finished);
|
| @@ -15765,7 +15748,7 @@ TEST(IdleNotificationWithSmallHint) {
|
| // Test that idle notification can be handled and eventually collects garbage.
|
| TEST(IdleNotificationWithLargeHint) {
|
| const intptr_t MB = 1024 * 1024;
|
| - const int IdlePauseInMs = 900;
|
| + const double IdlePauseInSeconds = 1.0;
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
| intptr_t initial_size = CcTest::heap()->SizeOfObjects();
|
| @@ -15774,7 +15757,10 @@ TEST(IdleNotificationWithLargeHint) {
|
| CHECK_GT(size_with_garbage, initial_size + MB);
|
| bool finished = false;
|
| for (int i = 0; i < 200 && !finished; i++) {
|
| - finished = env->GetIsolate()->IdleNotification(IdlePauseInMs);
|
| + finished = env->GetIsolate()->IdleNotificationDeadline(
|
| + (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() /
|
| + static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) +
|
| + IdlePauseInSeconds);
|
| }
|
| intptr_t final_size = CcTest::heap()->SizeOfObjects();
|
| CHECK(finished);
|
|
|