[] cleans up extensions api and add extension test.

Change-Id: I4f0691b5dfd2302c3414b3c8d4b881b1624063e6