Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Unified Diff: chrome/browser/browsing_data/browsing_data_remover_test_util.cc

Issue 2802013002: Move BrowsingDataRemoverImpl:: CompletionInhibitor to the public interface (Closed)
Patch Set: Fix profile tests. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
Bernhard Bauer 2017/04/10 23:29:37 So sometimes this class outlives the BrowsingDataR
msramek 2017/04/11 13:13:03 The unittest contains a testcase specifically abou
Bernhard Bauer 2017/04/11 15:58:41 (Which BTW was just a workaround for the fact that
msramek 2017/04/11 19:46:19 Huh. I remember seeing it now, but I guess I wasn'
Bernhard Bauer 2017/04/12 00:12:55 No, only in the instances where the BrowsingDataRe
msramek 2017/04/12 12:18:35 I see. I though you meant the other way around, be
+ 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;

Powered by Google App Engine
This is Rietveld 408576698