Add tests and instrumentation.

Change-Id: I67aeba833f9a8e4fb2892c9678fd9a0c7fd95125