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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover_test_util.cc

Issue 2613833004: Split BrowsingDataRemover into an abstract interface and implementation. (Closed)
Patch Set: Removed unnecessary instantiations. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" 5 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
6 6
7 BrowsingDataRemoverCompletionObserver::BrowsingDataRemoverCompletionObserver( 7 BrowsingDataRemoverCompletionObserver::BrowsingDataRemoverCompletionObserver(
8 BrowsingDataRemover* remover) 8 BrowsingDataRemover* remover)
9 : message_loop_runner_(new content::MessageLoopRunner), observer_(this) { 9 : message_loop_runner_(new content::MessageLoopRunner), observer_(this) {
10 observer_.Add(remover); 10 observer_.Add(remover);
11 } 11 }
12 12
13 BrowsingDataRemoverCompletionObserver:: 13 BrowsingDataRemoverCompletionObserver::
14 ~BrowsingDataRemoverCompletionObserver() {} 14 ~BrowsingDataRemoverCompletionObserver() {}
15 15
16 void BrowsingDataRemoverCompletionObserver::BlockUntilCompletion() { 16 void BrowsingDataRemoverCompletionObserver::BlockUntilCompletion() {
17 message_loop_runner_->Run(); 17 message_loop_runner_->Run();
18 } 18 }
19 19
20 void BrowsingDataRemoverCompletionObserver::OnBrowsingDataRemoverDone() { 20 void BrowsingDataRemoverCompletionObserver::OnBrowsingDataRemoverDone() {
21 observer_.RemoveAll(); 21 observer_.RemoveAll();
22 message_loop_runner_->Quit(); 22 message_loop_runner_->Quit();
23 } 23 }
24 24
25 BrowsingDataRemoverCompletionInhibitor::BrowsingDataRemoverCompletionInhibitor() 25 BrowsingDataRemoverCompletionInhibitor::BrowsingDataRemoverCompletionInhibitor()
26 : message_loop_runner_(new content::MessageLoopRunner) { 26 : message_loop_runner_(new content::MessageLoopRunner) {
27 BrowsingDataRemover::set_completion_inhibitor_for_testing(this); 27 BrowsingDataRemoverImpl::set_completion_inhibitor_for_testing(this);
28 } 28 }
29 29
30 BrowsingDataRemoverCompletionInhibitor:: 30 BrowsingDataRemoverCompletionInhibitor::
31 ~BrowsingDataRemoverCompletionInhibitor() { 31 ~BrowsingDataRemoverCompletionInhibitor() {
32 BrowsingDataRemover::set_completion_inhibitor_for_testing(nullptr); 32 BrowsingDataRemoverImpl::set_completion_inhibitor_for_testing(nullptr);
33 } 33 }
34 34
35 void BrowsingDataRemoverCompletionInhibitor::BlockUntilNearCompletion() { 35 void BrowsingDataRemoverCompletionInhibitor::BlockUntilNearCompletion() {
36 message_loop_runner_->Run(); 36 message_loop_runner_->Run();
37 message_loop_runner_ = new content::MessageLoopRunner; 37 message_loop_runner_ = new content::MessageLoopRunner;
38 } 38 }
39 39
40 void BrowsingDataRemoverCompletionInhibitor::ContinueToCompletion() { 40 void BrowsingDataRemoverCompletionInhibitor::ContinueToCompletion() {
41 DCHECK(!continue_to_completion_callback_.is_null()); 41 DCHECK(!continue_to_completion_callback_.is_null());
42 continue_to_completion_callback_.Run(); 42 continue_to_completion_callback_.Run();
43 continue_to_completion_callback_.Reset(); 43 continue_to_completion_callback_.Reset();
44 } 44 }
45 45
46 void BrowsingDataRemoverCompletionInhibitor::OnBrowsingDataRemoverWouldComplete( 46 void BrowsingDataRemoverCompletionInhibitor::OnBrowsingDataRemoverWouldComplete(
47 BrowsingDataRemover* remover, 47 BrowsingDataRemoverImpl* remover,
48 const base::Closure& continue_to_completion) { 48 const base::Closure& continue_to_completion) {
49 DCHECK(continue_to_completion_callback_.is_null()); 49 DCHECK(continue_to_completion_callback_.is_null());
50 continue_to_completion_callback_ = continue_to_completion; 50 continue_to_completion_callback_ = continue_to_completion;
51 message_loop_runner_->Quit(); 51 message_loop_runner_->Quit();
52 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698