onAuthStateChanged(nextOrObserver, opt_error, opt_completed) {
    // Simplified version of the observer for testing purpose only.
    var observer = (typeof nextOrObserver === 'function' && nextOrObserver) ||
        nextOrObserver['next'];
    if (!observer) {
      throw 'onAuthStateChanged must be called with an Observer or up to three ' +
          'functions: next, error and completed.';
    }
    this.authObservers_.push(observer);
    var self = this;
    // This will allow the subscriber to remove the observer.
    var unsubscribe = function() {
      // Removes the observer.
      array.removeAllIf(self.authObservers_, function(obs) {
        return obs == observer;
      });
    };
    return unsubscribe;
  }
Adds an observer for auth state user changes.
@param {!Object|function(?Object)}
    nextOrObserver An observer object or a function triggered on change.
@param {function(!Object)=} opt_error Optional A function
    triggered on auth error.
@param {function()=} opt_completed Optional A function triggered when the
    observer is removed.
@return {function()} The unsubscribe function for the observer.