anchor.diff:              clear_rows(Consumer),
               {ok, _Rev3_4} = save_doc(Db, {[{<<"_id">>, <<"doc3">>},
                                              {<<"_rev">>, Rev3_3}]}),
  +            reset_row_notifications(),
               ok = unpause(Consumer),
  -            timer:sleep(100),
  +            ?assertEqual(ok, wait_row_notifications(1)),
               ok = pause(Consumer),
   
               FinalRows = get_rows(Consumer),
  
positive.code:                 Seq = couch_util:get_value(<<"seq">>, Change),
                  Del = couch_util:get_value(<<"deleted">>, Change, false),
                  Doc = couch_util:get_value(doc, Change, nil),
                  [#row{id = Id, seq = Seq, deleted = Del, doc = Doc} | Acc];
              ({stop, LastSeq}, _, Acc) ->
                  Parent ! {consumer_finished, lists:reverse(Acc), LastSeq},
  
negative.code:         ]})
      end.
  
  
  reset_row_notifications() ->
      receive
          row ->
              reset_row_notifications()
      after 0 ->
          ok
      end.
  
  
  wait_row_notifications(N) ->
      receive
          row when N == 1 ->
              ok;
          row when N > 1 ->
              wait_row_notifications(N - 1)
      after ?TIMEOUT ->
          timeout
      end.
  
  
  spawn_consumer(DbName, ChangesArgs0, Req) ->
      Parent = self(),
      spawn_monitor(fun() ->
  