resolve_(state, x) {
    if (this.state_ != mr.MockPromise.State_.PENDING) {
      return;
    }

    if (this === x) {
      state = mr.MockPromise.State_.REJECTED;
      x = new TypeError('Promise cannot resolve to itself');
    }

    this.state_ = mr.MockPromise.State_.BLOCKED;

    if (x instanceof mr.MockPromise) {
      x.addCallbackEntry_(mr.MockPromise.getCallbackEntry_(
          this.unblockAndFulfill_.bind(this),
          this.unblockAndReject_.bind(this)));
      return;
    }

    this.result_ = x;
    this.state_ = state;
    this.scheduleCallbacks_();

    if (state == mr.MockPromise.State_.REJECTED) {
      mr.MockPromise.addUnhandledRejection_(this, x);
    }
  }
/**
   * Attempts to resolve a Promise with a given resolution state and value. This
   * is a no-op if the given Promise has already been resolved.
   *
   * If the given result is a Promise, the Promise will be settled with the same
   * state and result as the Thenable once it is itself settled.
   *
   * If the given result is not a Promise, the Promise will be settled
   * (fulfilled or rejected) with that result based on the given state.
   *
   * @param {mr.MockPromise.State_} state
   * @param {*} x The result to apply to the Promise.
   * @private
   */
Attempts to resolve a Promise with a given resolution state and value. This
is a no-op if the given Promise has already been resolved.

If the given result is a Promise, the Promise will be settled with the same
state and result as the Thenable once it is itself settled.

If the given result is not a Promise, the Promise will be settled
(fulfilled or rejected) with that result based on the given state.

@param {mr.MockPromise.State_} state
@param {*} x The result to apply to the Promise.
@private
Attempts to resolve a Promise with a given resolution state and value . This is a no - op if the given Promise has already been resolved . If the given result is a Promise the Promise will be settled with the same state and result as the Thenable once it is itself settled . If the given result is not a Promise the Promise will be settled ( fulfilled or rejected ) with that result based on the given state . @param { mr . MockPromise . State_ } state @param { * } x The result to apply to the Promise . @private
resolve_(state, x) {
    if (this.state_ != mr.MockPromise.State_.PENDING) {
      return;
    }
    if (this === x) {
      state = mr.MockPromise.State_.REJECTED;
      x = new TypeError('Promise cannot resolve to itself');
    }
    this.state_ = mr.MockPromise.State_.BLOCKED;
    if (x instanceof mr.MockPromise) {
      x.addCallbackEntry_(mr.MockPromise.getCallbackEntry_(
          this.unblockAndFulfill_.bind(this),
          this.unblockAndReject_.bind(this)));
      return;
    }
    this.result_ = x;
    this.state_ = state;
    this.scheduleCallbacks_();
    if (state == mr.MockPromise.State_.REJECTED) {
      mr.MockPromise.addUnhandledRejection_(this, x);
    }
  }
resolve_ ( state , x ) { if ( this . state_ != mr . MockPromise . State_ . PENDING ) { return ; } if ( this === x ) { state = mr . MockPromise . State_ . REJECTED ; x = new TypeError ( 'Promise cannot resolve to itself' ) ; } this . state_ = mr . MockPromise . State_ . BLOCKED ; if ( x instanceof mr . MockPromise ) { x . addCallbackEntry_ ( mr . MockPromise . getCallbackEntry_ ( this . unblockAndFulfill_ . bind ( this ) , this . unblockAndReject_ . bind ( this ) ) ) ; return ; } this . result_ = x ; this . state_ = state ; this . scheduleCallbacks_ ( ) ; if ( state == mr . MockPromise . State_ . REJECTED ) { mr . MockPromise . addUnhandledRejection_ ( this , x ) ; } }
Attempts to resolve a Promise with a given resolution state and value.
Attempts to resolve a Promise with a given resolution state and value .