'Runs a fake client and worker until both have empty queues.
Args:
client_mock: The MockClient object whose queue we\'ll grab tasks from.
worker_mock: Used to mock run the flows.
This function will run in a background thread while the tests run, and
will end when self.done is True.'

def RunFakeWorkerAndClient(self, client_mock, worker_mock):

    while True:
        if self.done:
            break
        if client_mock:
            client_processed = client_mock.Next()
        else:
            client_processed = 0
        flows_run = []
        for flow_run in worker_mock.Next():
            self.total_flows.add(flow_run)
            flows_run.append(flow_run)
        if ((client_processed == 0) and (not flows_run)):
            if self.done:
                break
