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

Side by Side Diff: chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/location.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h"
10 #include "base/test/test_timeouts.h" 11 #include "base/test/test_timeouts.h"
11 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
12 #include "chrome/browser/browsing_data/browsing_data_remover.h" 13 #include "chrome/browser/browsing_data/browsing_data_remover.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 15 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 16 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
16 #include "chrome/browser/sync/test/integration/preferences_helper.h" 17 #include "chrome/browser/sync/test/integration/preferences_helper.h"
17 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 18 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
18 #include "chrome/browser/sync/test/integration/sync_test.h" 19 #include "chrome/browser/sync/test/integration/sync_test.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (ProfileSyncService::IDLE == pss_->backend_mode()) { 88 if (ProfileSyncService::IDLE == pss_->backend_mode()) {
88 done_ = true; 89 done_ = true;
89 run_loop_.Quit(); 90 run_loop_.Quit();
90 } 91 }
91 } 92 }
92 93
93 bool Wait() { 94 bool Wait() {
94 pss_->AddObserver(this); 95 pss_->AddObserver(this);
95 if (ProfileSyncService::IDLE == pss_->backend_mode()) 96 if (ProfileSyncService::IDLE == pss_->backend_mode())
96 return true; 97 return true;
97 base::MessageLoop::current()->PostDelayedTask( 98 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
98 FROM_HERE, 99 FROM_HERE, run_loop_.QuitClosure(), timeout_);
99 run_loop_.QuitClosure(),
100 timeout_);
101 run_loop_.Run(); 100 run_loop_.Run();
102 pss_->RemoveObserver(this); 101 pss_->RemoveObserver(this);
103 return done_; 102 return done_;
104 } 103 }
105 104
106 private: 105 private:
107 106
108 ProfileSyncService* const pss_; 107 ProfileSyncService* const pss_;
109 const base::TimeDelta timeout_; 108 const base::TimeDelta timeout_;
110 base::RunLoop run_loop_; 109 base::RunLoop run_loop_;
(...skipping 23 matching lines...) Expand all
134 void OnBrowsingDataRemoverDone() override { 133 void OnBrowsingDataRemoverDone() override {
135 clear_done_ = true; 134 clear_done_ = true;
136 if (rollback_started_) { 135 if (rollback_started_) {
137 run_loop_.Quit(); 136 run_loop_.Quit();
138 } 137 }
139 } 138 }
140 139
141 bool Wait() { 140 bool Wait() {
142 pss_->AddObserver(this); 141 pss_->AddObserver(this);
143 pss_->SetBrowsingDataRemoverObserverForTesting(this); 142 pss_->SetBrowsingDataRemoverObserverForTesting(this);
144 base::MessageLoop::current()->PostDelayedTask( 143 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
145 FROM_HERE, 144 FROM_HERE, run_loop_.QuitClosure(), timeout_);
146 run_loop_.QuitClosure(),
147 timeout_);
148 run_loop_.Run(); 145 run_loop_.Run();
149 pss_->RemoveObserver(this); 146 pss_->RemoveObserver(this);
150 return rollback_started_ && clear_done_; 147 return rollback_started_ && clear_done_;
151 } 148 }
152 149
153 ProfileSyncService* const pss_; 150 ProfileSyncService* const pss_;
154 const base::TimeDelta timeout_; 151 const base::TimeDelta timeout_;
155 base::RunLoop run_loop_; 152 base::RunLoop run_loop_;
156 bool rollback_started_; 153 bool rollback_started_;
157 bool clear_done_; 154 bool clear_done_;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 ASSERT_TRUE(rollback_checker.Wait()); 431 ASSERT_TRUE(rollback_checker.Wait());
435 SyncBackendStoppedChecker shutdown_checker(GetSyncService(0)); 432 SyncBackendStoppedChecker shutdown_checker(GetSyncService(0));
436 ASSERT_TRUE(shutdown_checker.Wait()); 433 ASSERT_TRUE(shutdown_checker.Wait());
437 434
438 // Verify bookmarks are unchanged. 435 // Verify bookmarks are unchanged.
439 ASSERT_EQ(3, sub_folder->child_count()); 436 ASSERT_EQ(3, sub_folder->child_count());
440 ASSERT_EQ(GURL(kUrl1), sub_folder->GetChild(0)->url()); 437 ASSERT_EQ(GURL(kUrl1), sub_folder->GetChild(0)->url());
441 ASSERT_EQ(GURL(kUrl2), sub_folder->GetChild(1)->url()); 438 ASSERT_EQ(GURL(kUrl2), sub_folder->GetChild(1)->url());
442 ASSERT_EQ(GURL(kUrl3), sub_folder->GetChild(2)->url()); 439 ASSERT_EQ(GURL(kUrl3), sub_folder->GetChild(2)->url());
443 } 440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698