| Index: chrome/browser/browsing_data/browsing_data_remover_test_util.cc
|
| diff --git a/chrome/browser/browsing_data/browsing_data_remover_test_util.cc b/chrome/browser/browsing_data/browsing_data_remover_test_util.cc
|
| index 9bdc5a399774bed2d039ade83657402c2fa234a9..676d539887956eb84eee7a2a9e1d26694720f829 100644
|
| --- a/chrome/browser/browsing_data/browsing_data_remover_test_util.cc
|
| +++ b/chrome/browser/browsing_data/browsing_data_remover_test_util.cc
|
| @@ -22,14 +22,25 @@ void BrowsingDataRemoverCompletionObserver::OnBrowsingDataRemoverDone() {
|
| message_loop_runner_->Quit();
|
| }
|
|
|
| -BrowsingDataRemoverCompletionInhibitor::BrowsingDataRemoverCompletionInhibitor()
|
| +BrowsingDataRemoverCompletionInhibitor::BrowsingDataRemoverCompletionInhibitor(
|
| + BrowsingDataRemover* remover)
|
| : message_loop_runner_(new content::MessageLoopRunner) {
|
| - BrowsingDataRemoverImpl::set_completion_inhibitor_for_testing(this);
|
| + DCHECK(remover);
|
| + remover_ = remover->GetWeakPtr();
|
| + remover_->SetWouldCompleteCallbackForTesting(
|
| + base::Bind(&BrowsingDataRemoverCompletionInhibitor::
|
| + OnBrowsingDataRemoverWouldComplete,
|
| + base::Unretained(this)));
|
| }
|
|
|
| BrowsingDataRemoverCompletionInhibitor::
|
| ~BrowsingDataRemoverCompletionInhibitor() {
|
| - BrowsingDataRemoverImpl::set_completion_inhibitor_for_testing(nullptr);
|
| + // BrowsingDataRemoverCompletionInhibitor might outlive BrowsingDataRemover
|
| + // in some tests.
|
| + if (!remover_)
|
| + return;
|
| + remover_->SetWouldCompleteCallbackForTesting(
|
| + base::Callback<void(const base::Closure&)>());
|
| }
|
|
|
| void BrowsingDataRemoverCompletionInhibitor::BlockUntilNearCompletion() {
|
| @@ -44,7 +55,6 @@ void BrowsingDataRemoverCompletionInhibitor::ContinueToCompletion() {
|
| }
|
|
|
| void BrowsingDataRemoverCompletionInhibitor::OnBrowsingDataRemoverWouldComplete(
|
| - BrowsingDataRemoverImpl* remover,
|
| const base::Closure& continue_to_completion) {
|
| DCHECK(continue_to_completion_callback_.is_null());
|
| continue_to_completion_callback_ = continue_to_completion;
|
|
|