Index: test/unittests/heap/gc-idle-time-handler-unittest.cc |
diff --git a/test/unittests/heap/gc-idle-time-handler-unittest.cc b/test/unittests/heap/gc-idle-time-handler-unittest.cc |
index b5f59bd5108f1792c24a70ece5499d97f3954c8d..76424627c5572e2eeb114de7e589801c102de5c3 100644 |
--- a/test/unittests/heap/gc-idle-time-handler-unittest.cc |
+++ b/test/unittests/heap/gc-idle-time-handler-unittest.cc |
@@ -27,6 +27,7 @@ class GCIdleTimeHandlerTest : public ::testing::Test { |
result.incremental_marking_stopped = false; |
result.can_start_incremental_marking = true; |
result.sweeping_in_progress = false; |
+ result.sweeping_completed = false; |
result.mark_compact_speed_in_bytes_per_ms = kMarkCompactSpeed; |
result.incremental_marking_speed_in_bytes_per_ms = kMarkingSpeed; |
result.scavenge_speed_in_bytes_per_ms = kScavengeSpeed; |
@@ -303,6 +304,30 @@ TEST_F(GCIdleTimeHandlerTest, NotEnoughTime) { |
} |
+TEST_F(GCIdleTimeHandlerTest, FinalizeSweeping) { |
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
+ heap_state.incremental_marking_stopped = true; |
+ heap_state.can_start_incremental_marking = false; |
+ heap_state.sweeping_in_progress = true; |
+ heap_state.sweeping_completed = true; |
+ double idle_time_ms = 10.0; |
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); |
+ EXPECT_EQ(DO_FINALIZE_SWEEPING, action.type); |
+} |
+ |
+ |
+TEST_F(GCIdleTimeHandlerTest, CannotFinalizeSweeping) { |
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
+ heap_state.incremental_marking_stopped = true; |
+ heap_state.can_start_incremental_marking = false; |
+ heap_state.sweeping_in_progress = true; |
+ heap_state.sweeping_completed = false; |
+ double idle_time_ms = 10.0; |
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); |
+ EXPECT_EQ(DO_NOTHING, action.type); |
+} |
+ |
+ |
TEST_F(GCIdleTimeHandlerTest, StopEventually1) { |
GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
heap_state.incremental_marking_stopped = true; |