Fix invalid access to weak_ptr in TransportSecurityPersister

ImportantFileWriter calls its callback on a background thread. To avoid
accessing the WeakPtr on the wrong sequence, use the task runner
directly.

Bug: 1077202
Change-Id: Id9c4bf46d8366f551e3f42bc72e95d0b55af30d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2178892
Commit-Queue: Christian Dullweber <[email protected]>
Reviewed-by: Ryan Sleevi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#767881}
diff --git a/net/http/transport_security_persister_unittest.cc b/net/http/transport_security_persister_unittest.cc
index 1645ea0..db95259 100644
--- a/net/http/transport_security_persister_unittest.cc
+++ b/net/http/transport_security_persister_unittest.cc
@@ -38,8 +38,12 @@
   void SetUp() override {
     ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
     ASSERT_TRUE(base::MessageLoopCurrentForIO::IsSet());
+    scoped_refptr<base::SequencedTaskRunner> background_runner(
+        base::ThreadPool::CreateSequencedTaskRunner(
+            {base::MayBlock(), base::TaskPriority::BEST_EFFORT,
+             base::TaskShutdownBehavior::BLOCK_SHUTDOWN}));
     persister_ = std::make_unique<TransportSecurityPersister>(
-        &state_, temp_dir_.GetPath(), base::ThreadTaskRunnerHandle::Get());
+        &state_, temp_dir_.GetPath(), std::move(background_runner));
   }
 
  protected: