Add test coverage for ResourceCounter.

Reviewed at https://reviews.apache.org/r/22942/