[RunLoop] Remove unused RunLoop::OverrideDelegateForCurrentThreadForTesting().

This is effectively a revert of r521228 while keeping the improvements
of r524097.

This was intended to be used to allow ScopedTaskEnvironment::MOCK_TIME
on top of MessageLoopForUI/ForIO but this turned out harder than
expected and we're now going with a different approach.

[email protected]

Bug: 708584
Change-Id: I6951ac7fc1bf6b6eac0f269e0dec9f677ea29543
Reviewed-on: https://chromium-review.googlesource.com/1066456
Reviewed-by: kylechar <[email protected]>
Reviewed-by: danakj <[email protected]>
Commit-Queue: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#560695}
diff --git a/base/run_loop.cc b/base/run_loop.cc
index 1385a8631..3882f64 100644
--- a/base/run_loop.cc
+++ b/base/run_loop.cc
@@ -33,12 +33,7 @@
 
 }  // namespace
 
-RunLoop::Delegate::Delegate()
-    : should_quit_when_idle_callback_(base::BindRepeating(
-          [](Delegate* self) {
-            return self->active_run_loops_.top()->quit_when_idle_received_;
-          },
-          Unretained(this))) {
+RunLoop::Delegate::Delegate() {
   // The Delegate can be created on another thread. It is only bound in
   // RegisterDelegateForCurrentThread().
   DETACH_FROM_THREAD(bound_thread_checker_);
@@ -54,7 +49,7 @@
 }
 
 bool RunLoop::Delegate::ShouldQuitWhenIdle() {
-  return should_quit_when_idle_callback_.Run();
+  return active_run_loops_.top()->quit_when_idle_received_;
 }
 
 // static
@@ -72,30 +67,6 @@
   delegate->bound_ = true;
 }
 
-// static
-RunLoop::Delegate* RunLoop::OverrideDelegateForCurrentThreadForTesting(
-    Delegate* delegate,
-    Delegate::ShouldQuitWhenIdleCallback
-        overriding_should_quit_when_idle_callback) {
-  // Bind |delegate| to this thread.
-  DCHECK(!delegate->bound_);
-  DCHECK_CALLED_ON_VALID_THREAD(delegate->bound_thread_checker_);
-
-  // Overriding cannot be performed while running.
-  DCHECK(!IsRunningOnCurrentThread());
-
-  // Override the current Delegate (there must be one).
-  Delegate* overridden_delegate = tls_delegate.Get().Get();
-  DCHECK(overridden_delegate);
-  DCHECK(overridden_delegate->bound_);
-  overridden_delegate->should_quit_when_idle_callback_ =
-      std::move(overriding_should_quit_when_idle_callback);
-  tls_delegate.Get().Set(delegate);
-  delegate->bound_ = true;
-
-  return overridden_delegate;
-}
-
 RunLoop::RunLoop(Type type)
     : delegate_(tls_delegate.Get().Get()),
       type_(type),