Finished unit tests for upstreaming

Change-Id: I632da54475193db298be0e08be36d644af3501dd