0

Make rlz_lib_test use GetSafeWeakWrapper.

Calling GetSafeWeakWrapper() is preferable to explictly constructing a
WeakWrapperSharedURLLoaderFactory, because GetSafeWeakWrapper guarantees
that Detach() will be called when the underlying TestURLLoaderFactory is
destructed.

Bug: 924960
Change-Id: I9e61c0b098a50972a189c1cdac56fc661f455e0d
Reviewed-on: https://chromium-review.googlesource.com/c/1475448
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Lowell Manners <lowell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635112}
This commit is contained in:
Lowell Manners
2019-02-25 15:11:18 +00:00
committed by Commit Bot
parent 80b00c0f71
commit d0194602bb

@ -579,12 +579,9 @@ TEST_F(RlzLibTest, SendFinancialPing) {
#endif
network::TestURLLoaderFactory test_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory>
test_shared_url_loader_factory =
base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
&test_url_loader_factory);
URLLoaderFactoryRAII set_factory(test_shared_url_loader_factory.get());
URLLoaderFactoryRAII set_factory(
test_url_loader_factory.GetSafeWeakWrapper().get());
#endif
MachineDealCodeHelper::Clear();
@ -639,11 +636,8 @@ TEST_F(RlzLibTest, SendFinancialPingDuringShutdown) {
ASSERT_TRUE(io_thread.StartWithOptions(options));
network::TestURLLoaderFactory test_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory>
test_shared_url_loader_factory =
base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
&test_url_loader_factory);
URLLoaderFactoryRAII set_factory(test_shared_url_loader_factory.get());
URLLoaderFactoryRAII set_factory(
test_url_loader_factory.GetSafeWeakWrapper().get());
rlz_lib::AccessPoint points[] =
{rlz_lib::IETB_SEARCH_BOX, rlz_lib::NO_ACCESS_POINT,