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

Unified Diff: chrome/browser/android/offline_pages/offline_page_model_factory.cc

Issue 2322793003: [Offline Pages] Fix flaky test due to actual loading of database. (Closed)
Patch Set: fixing build. Created 4 years, 3 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
Index: chrome/browser/android/offline_pages/offline_page_model_factory.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_model_factory.cc b/chrome/browser/android/offline_pages/offline_page_model_factory.cc
index 6201cc2d1194ebc55757dab6a6eb33c22beb7c2e..c5c8720b5ad92801f513ab7517e5f6ca3568a005 100644
--- a/chrome/browser/android/offline_pages/offline_page_model_factory.cc
+++ b/chrome/browser/android/offline_pages/offline_page_model_factory.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "base/sequenced_task_runner.h"
#include "chrome/browser/profiles/incognito_helpers.h"
@@ -15,8 +16,16 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/offline_pages/offline_page_metadata_store_sql.h"
#include "components/offline_pages/offline_page_model_impl.h"
+#include "components/offline_pages/stub_offline_page_model.h"
#include "content/public/browser/browser_thread.h"
+namespace {
+std::unique_ptr<KeyedService> BuildMockOfflinePageModelFactory(
fgorski 2016/09/08 17:18:57 how about moving this to testing_profile and appro
+ content::BrowserContext* context) {
+ return base::MakeUnique<offline_pages::StubOfflinePageModel>();
+}
+}
+
namespace offline_pages {
OfflinePageModelFactory::OfflinePageModelFactory()
@@ -37,6 +46,12 @@ OfflinePageModel* OfflinePageModelFactory::GetForBrowserContext(
GetInstance()->GetServiceForBrowserContext(context, true));
}
+// static
+BrowserContextKeyedServiceFactory::TestingFactoryFunction
+OfflinePageModelFactory::GetMockFactory() {
+ return &BuildMockOfflinePageModelFactory;
+}
+
KeyedService* OfflinePageModelFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_model_factory.h ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698