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

Unified Diff: components/history/core/browser/history_service.cc

Issue 2732653002: Add favicon integration tests for FaviconDriverImpl (Closed)
Patch Set: Added verification of color Created 3 years, 10 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
« no previous file with comments | « components/history/core/browser/history_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/core/browser/history_service.cc
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc
index b154b3237e19b1373d1c0ba522aefc8229a51861..bb3339dcd5bcb3babf9b512bf1991d64ce30be90 100644
--- a/components/history/core/browser/history_service.cc
+++ b/components/history/core/browser/history_service.cc
@@ -318,6 +318,13 @@ base::CancelableTaskTracker::TaskId HistoryService::ScheduleDBTask(
return task_id;
}
+bool HistoryService::InitForTest(
+ const HistoryDatabaseParams& history_database_params,
+ scoped_refptr<base::SequencedTaskRunner> task_runner) {
+ return InitWithTaskRunner(/*no_db=*/false, history_database_params,
+ task_runner);
+}
+
void HistoryService::FlushForTest(const base::Closure& flushed) {
backend_task_runner_->PostTaskAndReply(FROM_HERE,
base::Bind(&base::DoNothing), flushed);
@@ -870,8 +877,6 @@ bool HistoryService::Init(
const HistoryDatabaseParams& history_database_params) {
TRACE_EVENT0("browser,startup", "HistoryService::Init")
SCOPED_UMA_HISTOGRAM_TIMER("History.HistoryServiceInitTime");
- DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(!backend_task_runner_);
if (thread_) {
base::Thread::Options options;
@@ -880,15 +885,29 @@ bool HistoryService::Init(
Cleanup();
return false;
}
- backend_task_runner_ = thread_->task_runner();
+ return InitWithTaskRunner(no_db, history_database_params,
+ thread_->task_runner());
} else {
- backend_task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
- base::TaskTraits()
- .WithPriority(base::TaskPriority::USER_BLOCKING)
- .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN)
- .MayBlock()
- .WithBaseSyncPrimitives());
+ return InitWithTaskRunner(
+ no_db, history_database_params,
+ base::CreateSequencedTaskRunnerWithTraits(
+ base::TaskTraits()
+ .WithPriority(base::TaskPriority::USER_BLOCKING)
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN)
+ .MayBlock()
+ .WithBaseSyncPrimitives()));
}
+}
+
+bool HistoryService::InitWithTaskRunner(
+ bool no_db,
+ const HistoryDatabaseParams& history_database_params,
+ scoped_refptr<base::SequencedTaskRunner> task_runner) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(!backend_task_runner_);
+
+ backend_task_runner_ = task_runner;
// Create the history backend.
scoped_refptr<HistoryBackend> backend(new HistoryBackend(
« no previous file with comments | « components/history/core/browser/history_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698