anchor.diff:        });
   
         schedule(() {
  -        return testRef.push(value: 3);
  -      });
  -
  -      schedule(() {
  -        expect(eventCount, 3);
  +        Future waitFuture = subscription.cancel();
  +        if (waitFuture == null) {
  +          return testRef.push(value: 3);
  +        }
  +        else waitFuture.then((_) {
  +          return testRef.push(value: 3);
  +        });
         });
       });
   
       test('onChildChanged', () {
         Firebase testRef;
  +      StreamSubscription<Event> subscription;
         var eventCount = 0;
   
         schedule(() {
           testRef = f.child('onChildChanged');
  -        testRef.onChildChanged.listen((event) {
  +        subscription = testRef.onChildChanged.listen((event) {
             var ss = event.snapshot;
             expect(ss.name, 'key');
             eventCount++;
  
positive.code:       });
  
        schedule(() {
          return testRef.set({'key': 3});
        });
  
        schedule(() {
          expect(eventCount, 3);
        });
      });
  
      test('onChildRemoved & onValue', () {
        int valueCount = 0;
  
        schedule(() {
          Firebase testRef = f.child('onChildRemoved');
          testRef.onValue.listen((event) {
            var ss = event.snapshot;
            if (valueCount++ == 0) {
              expect(ss.name, 'onChildRemoved');
              expect(ss.val(), {'key': 1});
            }
            else {
              expect(ss.name, 'onChildRemoved');
              expect(ss.val(), isNull);
            }
            testRef.onChildRemoved.listen((event) {
              var ss = event.snapshot;
              expect(ss.name, 'key');
            });
            return testRef.child('key').remove();
          });
          return testRef.set({'key': 1});
        });
  
        schedule(() {
          expect(valueCount, 2);
        });
      });
    });
  
    group('once', () {
  
negative.code:     });
    });
  
    group('on & off', () {
  
      List<String> addedKeys = [];
      test('onChildAdded', () {
        Firebase testRef;
        StreamSubscription<Event> subscription;
        var eventCount = 0;
  
        schedule(() {
          testRef = f.child('onChildAdded');
          subscription = testRef.onChildAdded.listen((event) {
            var ss = event.snapshot;
            addedKeys.add(ss.name);
            expect(++eventCount, lessThan(3));
            expect(ss.val(), eventCount);
          });
  
  