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

Side by Side Diff: components/history/core/test/history_service_test_util.cc

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/history/core/test/history_service_test_util.h" 5 #include "components/history/core/test/history_service_test_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "components/history/core/browser/history_backend.h" 9 #include "components/history/core/browser/history_backend.h"
10 #include "components/history/core/browser/history_database.h" 10 #include "components/history/core/browser/history_database.h"
(...skipping 23 matching lines...) Expand all
34 base::Closure task_; 34 base::Closure task_;
35 35
36 DISALLOW_COPY_AND_ASSIGN(QuitTask); 36 DISALLOW_COPY_AND_ASSIGN(QuitTask);
37 }; 37 };
38 38
39 } // namespace 39 } // namespace
40 40
41 namespace history { 41 namespace history {
42 42
43 scoped_ptr<HistoryService> CreateHistoryService( 43 scoped_ptr<HistoryService> CreateHistoryService(
44 const base::FilePath& history_dir, 44 const base::FilePath& history_dir, bool create_db) {
45 const std::string& accept_languages,
46 bool create_db) {
47 scoped_ptr<HistoryService> history_service(new HistoryService()); 45 scoped_ptr<HistoryService> history_service(new HistoryService());
48 if (!history_service->Init( 46 if (!history_service->Init(
49 !create_db, accept_languages, 47 !create_db, history::TestHistoryDatabaseParamsForPath(history_dir))) {
50 history::TestHistoryDatabaseParamsForPath(history_dir))) {
51 return nullptr; 48 return nullptr;
52 } 49 }
53 50
54 if (create_db) 51 if (create_db)
55 BlockUntilHistoryProcessesPendingRequests(history_service.get()); 52 BlockUntilHistoryProcessesPendingRequests(history_service.get());
56 return history_service; 53 return history_service;
57 } 54 }
58 55
59 void BlockUntilHistoryProcessesPendingRequests( 56 void BlockUntilHistoryProcessesPendingRequests(
60 HistoryService* history_service) { 57 HistoryService* history_service) {
61 base::RunLoop run_loop; 58 base::RunLoop run_loop;
62 base::CancelableTaskTracker tracker; 59 base::CancelableTaskTracker tracker;
63 history_service->ScheduleDBTask( 60 history_service->ScheduleDBTask(
64 scoped_ptr<history::HistoryDBTask>(new QuitTask(run_loop.QuitClosure())), 61 scoped_ptr<history::HistoryDBTask>(new QuitTask(run_loop.QuitClosure())),
65 &tracker); 62 &tracker);
66 run_loop.Run(); 63 run_loop.Run();
67 64
68 // Spin the runloop again until idle. The QuitTask above is destroyed via a 65 // Spin the runloop again until idle. The QuitTask above is destroyed via a
69 // task posted to the current message loop, so spinning allows the task to be 66 // task posted to the current message loop, so spinning allows the task to be
70 // properly destroyed. 67 // properly destroyed.
71 base::RunLoop().RunUntilIdle(); 68 base::RunLoop().RunUntilIdle();
72 } 69 }
73 70
74 } // namespace history 71 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/test/history_service_test_util.h ('k') | components/nacl/browser/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698