Add M.define() and M.require() + tests

This should make sharing code between different JS files easier and more
consistent.

Names taken from CommonJS AMD specs.
Deprecate M.registerModule() and M.getModule().

Change-Id: I0d9ff1dc6af9028f76424269c9460feddc0051ac
Add api module + tests

Also fix getToken() cache and add Sinon.JS to our test suite
for easy spies, mocks and stubs.

Change-Id: I9d9b3c996cb8ab7a9638a130d654802cb7482116
Merge changes I9d9b3c99,I0d9ff1dc

* changes:
  Add api module + tests
  Add M.define() and M.require() + tests