-TEST_F(ServiceWorkerVersionTest, AddAndRemoveProcesses) {
- // Preparation (to reset the process count to 0).
- ASSERT_TRUE(version_->HasProcessToRun());
- version_->RemoveProcessFromWorker(kRenderProcessId);
- ASSERT_FALSE(version_->HasProcessToRun());
-
- // Add another process to the worker twice, and then remove process once.
- const int another_process_id = kRenderProcessId + 1;
- version_->AddProcessToWorker(another_process_id);
- version_->AddProcessToWorker(another_process_id);
- version_->RemoveProcessFromWorker(another_process_id);
-
- // We're ref-counting the process internally, so adding the same process
- // multiple times should be handled correctly.
- ASSERT_TRUE(version_->HasProcessToRun());
-
- // Removing the process again (so that # of AddProcess == # of RemoveProcess
- // for the process) should remove all process references.
- version_->RemoveProcessFromWorker(another_process_id);
- ASSERT_FALSE(version_->HasProcessToRun());
-}
-