the cl does not delete it earlier  making it a member means it is deleted at end of  urlloaderfactoryimpltest scope and it being the first member means it is deleted last by c rules  this is usually the paradigm for testbrowserthreadbundle  make it the first member so it outlives everything explicitly managing it via unique ptr here merely resulted in it being destroyed before resourcemessagefilter  which tries to post tasks in it is tear down  