Index: components/history/core/test/history_service_test_util.h |
diff --git a/components/history/core/test/history_service_test_util.h b/components/history/core/test/history_service_test_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c0a4a282b9a2c74e7287941cb56b96611233b664 |
--- /dev/null |
+++ b/components/history/core/test/history_service_test_util.h |
@@ -0,0 +1,38 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_HISTORY_CORE_TEST_HISTORY_SERVICE_TEST_UTIL_H_ |
+#define COMPONENTS_HISTORY_CORE_TEST_HISTORY_SERVICE_TEST_UTIL_H_ |
+ |
+#include <string> |
+ |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+ |
+namespace base { |
+class FilePath; |
+} |
+ |
+namespace history { |
+class HistoryService; |
+ |
+// Creates a new HistoryService that stores its data in |history_dir|. If |
+// |create_db| is false, the HistoryService will fail to initialize its |
+// database; this is useful for testing error conditions. This method spins the |
+// runloop before returning to ensure that any initialization-related tasks are |
+// run. |
+scoped_ptr<HistoryService> CreateHistoryService( |
+ const base::FilePath& history_dir, |
+ const std::string& accept_languages, |
+ bool create_db); |
+ |
+// Schedules a task on the history backend and runs a nested loop until the task |
+// is processed. This blocks the caller until the history service processes all |
+// pending requests. |
+void BlockUntilHistoryProcessesPendingRequests( |
+ HistoryService* history_service); |
+ |
+} // namespace history |
+ |
+#endif // COMPONENTS_HISTORY_CORE_TEST_HISTORY_SERVICE_TEST_UTIL_H_ |