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

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

Issue 352913002: Port HistoryService::ScheduleDBTask to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix lifetime of base::CancelableTaskTracker for HistoryModelWorker Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sync/test/integration/bookmarks_helper.h" 5 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "base/task/cancelable_task_tracker.h"
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 17 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
17 #include "chrome/browser/favicon/favicon_service.h" 18 #include "chrome/browser/favicon/favicon_service.h"
18 #include "chrome/browser/favicon/favicon_service_factory.h" 19 #include "chrome/browser/favicon/favicon_service_factory.h"
19 #include "chrome/browser/history/history_db_task.h" 20 #include "chrome/browser/history/history_db_task.h"
20 #include "chrome/browser/history/history_service_factory.h" 21 #include "chrome/browser/history/history_service_factory.h"
21 #include "chrome/browser/history/history_types.h" 22 #include "chrome/browser/history/history_types.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/sync/glue/bookmark_change_processor.h" 24 #include "chrome/browser/sync/glue/bookmark_change_processor.h"
24 #include "chrome/browser/sync/test/integration/multi_client_status_change_checke r.h" 25 #include "chrome/browser/sync/test/integration/multi_client_status_change_checke r.h"
25 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 26 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 sync_datatype_helper::test()->verifier()); 260 sync_datatype_helper::test()->verifier());
260 for (int i = 0; i < sync_datatype_helper::test()->num_clients(); ++i) 261 for (int i = 0; i < sync_datatype_helper::test()->num_clients(); ++i)
261 profiles_which_need_to_wait.push_back( 262 profiles_which_need_to_wait.push_back(
262 sync_datatype_helper::test()->GetProfile(i)); 263 sync_datatype_helper::test()->GetProfile(i));
263 264
264 for (size_t i = 0; i < profiles_which_need_to_wait.size(); ++i) { 265 for (size_t i = 0; i < profiles_which_need_to_wait.size(); ++i) {
265 Profile* profile = profiles_which_need_to_wait[i]; 266 Profile* profile = profiles_which_need_to_wait[i];
266 HistoryService* history_service = 267 HistoryService* history_service =
267 HistoryServiceFactory::GetForProfileWithoutCreating(profile); 268 HistoryServiceFactory::GetForProfileWithoutCreating(profile);
268 base::WaitableEvent done(false, false); 269 base::WaitableEvent done(false, false);
269 CancelableRequestConsumer request_consumer; 270 base::CancelableTaskTracker task_tracker;
270 history_service->ScheduleDBTask(new HistoryEmptyTask(&done), 271 history_service->ScheduleDBTask(new HistoryEmptyTask(&done), &task_tracker);
271 &request_consumer);
272 done.Wait(); 272 done.Wait();
273 } 273 }
274 // Wait such that any notifications broadcast from one of the history threads 274 // Wait such that any notifications broadcast from one of the history threads
275 // to the UI thread are processed. 275 // to the UI thread are processed.
276 content::RunAllPendingInMessageLoop(); 276 content::RunAllPendingInMessageLoop();
277 } 277 }
278 278
279 // Checks if the favicon in |node_a| from |model_a| matches that of |node_b| 279 // Checks if the favicon in |node_a| from |model_a| matches that of |node_b|
280 // from |model_b|. Returns true if they match. 280 // from |model_b|. Returns true if they match.
281 bool FaviconsMatch(BookmarkModel* model_a, 281 bool FaviconsMatch(BookmarkModel* model_a,
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 812
813 std::string IndexedSubfolderName(int i) { 813 std::string IndexedSubfolderName(int i) {
814 return base::StringPrintf("Subfolder Name %d", i); 814 return base::StringPrintf("Subfolder Name %d", i);
815 } 815 }
816 816
817 std::string IndexedSubsubfolderName(int i) { 817 std::string IndexedSubsubfolderName(int i) {
818 return base::StringPrintf("Subsubfolder Name %d", i); 818 return base::StringPrintf("Subsubfolder Name %d", i);
819 } 819 }
820 820
821 } // namespace bookmarks_helper 821 } // namespace bookmarks_helper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698