Refactor browser_thread_unittest.cc

No need for the complicated constructor params if all can be done in the
constructor itself.

Change-Id: I75db0a61665923706f7b4b2b0f3f9ee792db1123
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1569906
Auto-Submit: Carlos Caballero <carlscab@google.com>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653160}
diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc
index 7763d78..37489b3 100644
--- a/content/browser/browser_thread_unittest.cc
+++ b/content/browser/browser_thread_unittest.cc
@@ -32,12 +32,21 @@
 
 class SequenceManagerTaskEnvironment : public base::Thread::TaskEnvironment {
  public:
-  SequenceManagerTaskEnvironment(
-      std::unique_ptr<base::sequence_manager::SequenceManager> sequence_manager,
-      scoped_refptr<base::SingleThreadTaskRunner> default_task_runner)
-      : sequence_manager_(std::move(sequence_manager)),
-        default_task_runner_(std::move(default_task_runner)) {
+  SequenceManagerTaskEnvironment() {
+    sequence_manager_ =
+        base::sequence_manager::internal::SequenceManagerImpl::CreateUnbound(
+            base::sequence_manager::SequenceManager::Settings());
+    auto browser_ui_thread_scheduler =
+        BrowserUIThreadScheduler::CreateForTesting(
+            sequence_manager_.get(), sequence_manager_->GetRealTimeDomain());
+
+    default_task_runner_ = browser_ui_thread_scheduler->GetTaskRunnerForTesting(
+        BrowserUIThreadScheduler::QueueType::kDefault);
+
     sequence_manager_->SetDefaultTaskRunner(default_task_runner_);
+
+    BrowserTaskExecutor::CreateWithBrowserUIThreadSchedulerForTesting(
+        std::move(browser_ui_thread_scheduler));
   }
 
   ~SequenceManagerTaskEnvironment() override {
@@ -80,22 +89,8 @@
  protected:
   void SetUp() override {
     ui_thread_ = std::make_unique<BrowserProcessSubThread>(BrowserThread::UI);
-    std::unique_ptr<base::sequence_manager::internal::SequenceManagerImpl>
-        sequence_manager = base::sequence_manager::internal::
-            SequenceManagerImpl::CreateUnbound(
-                base::sequence_manager::SequenceManager::Settings());
-    std::unique_ptr<BrowserUIThreadScheduler> browser_ui_thread_scheduler =
-        BrowserUIThreadScheduler::CreateForTesting(
-            sequence_manager.get(), sequence_manager->GetRealTimeDomain());
-
     base::Thread::Options ui_options;
-    ui_options.task_environment = new SequenceManagerTaskEnvironment(
-        std::move(sequence_manager),
-        browser_ui_thread_scheduler->GetTaskRunnerForTesting(
-            BrowserUIThreadScheduler::QueueType::kDefault));
-
-    BrowserTaskExecutor::CreateWithBrowserUIThreadSchedulerForTesting(
-        std::move(browser_ui_thread_scheduler));
+    ui_options.task_environment = new SequenceManagerTaskEnvironment();
     ui_thread_->StartWithOptions(ui_options);
 
     io_thread_ = std::make_unique<BrowserProcessSubThread>(BrowserThread::IO);