function createMockCredential(credentialObject) {
  var copy = goog.object.clone(credentialObject);
   goog.object.extend(credentialObject, {
     'toJSON': function() {
       return copy;
     }
   });
   return credentialObject;
}
Returns a mock credential object with toJSON method.
@param {!Object} credentialObject
@return {!Object} The fake Auth credential.