Add ReferenceQueue test

Also cleaned up reference queue.
TODO: Add tests for missing functionality.

Bug: 10808403

Change-Id: I182f9cb69022fe542ea9e53d4c6d35cff90af332
Merge "Add ReferenceQueue test"