function simulateGrecaptchaLoaded(widgetId) {
  goog.global['grecaptcha'] = {
    render: goog.testing.recordFunction(function() {
      return widgetId;
    }),
    getResponse: goog.testing.recordFunction(),
    reset: goog.testing.recordFunction()
  };
}
Mocks grecaptcha API.
@param {number} widgetId The expected reCAPTCHA widget ID.