testUnsubscribeWhilePublishing() {
    mockHTML5LocalStorageCtor().$returns(mockHtml5LocalStorage);
    // It's OK for a subscriber to unsubscribe another subscriber from its
    // own topic, but the subscriber in question won't actually be removed
    // until after publishing is complete.

    const fn1 = mockControl.createFunctionMock();
    const fn2 = mockControl.createFunctionMock();
    const fn3 = mockControl.createFunctionMock();

    fn1().$does(/**
                   @suppress {checkTypes} suppression added to enable type
                   checking
                 */
                () => {
                  assertTrue(
                      'unsubscribe() must return true when removing a topic',
                      broadcastPubSub.unsubscribe('X', fn2));
                  assertEquals(
                      'Topic "X" must still have 3 subscribers', 3,
                      broadcastPubSub.getCount('X'));
                });
    fn2().$times(0);
    fn3().$does(/**
                   @suppress {checkTypes} suppression added to enable type
                   checking
                 */
                () => {
                  assertTrue(
                      'unsubscribe() must return true when removing a topic',
                      broadcastPubSub.unsubscribe('X', fn1));
                  assertEquals(
                      'Topic "X" must still have 3 subscribers', 3,
                      broadcastPubSub.getCount('X'));
                });

    mockControl.$replayAll();
    broadcastPubSub = new BroadcastPubSub();
    log.setLevel(broadcastPubSub.logger_, Level.OFF);

    broadcastPubSub.subscribe('X', fn1);
    broadcastPubSub.subscribe('X', fn2);
    broadcastPubSub.subscribe('X', fn3);

    assertEquals(
        'Topic "X" must have 3 subscribers', 3, broadcastPubSub.getCount('X'));

    broadcastPubSub.publish('X');
    mockClock.tick();

    assertEquals(
        'Topic "X" must have 1 subscriber after publishing', 1,
        broadcastPubSub.getCount('X'));
    assertEquals(
        'BroadcastChannel must not have any subscriptions pending removal', 0,
        broadcastPubSub.pubSub_.pendingKeys_.length);
    broadcastPubSub.dispose();
    mockControl.$verifyAll();
  }
@suppress {checkTypes,visibility,strictMissingProperties} suppression
     added to enable type checking