change way env is detected

- look for cordova instead of using user-agent
- update unit test
- haven't found good way to test native=true; can't write provider for
window, since it's readonly