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

Unified Diff: chrome/test/base/testing_profile.cc

Issue 2322793003: [Offline Pages] Fix flaky test due to actual loading of database. (Closed)
Patch Set: Make include guarded by build flag check. 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
« no previous file with comments | « no previous file | components/offline_pages/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/testing_profile.cc
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 90bab6b3f4592402c216e505f624fc4d430ebc44..4ce5e35944355d5f59bfeac29ab0e6ebdcd5b338 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -49,6 +49,7 @@
#include "chrome/browser/web_data_service_factory.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/features.h"
Lei Zhang 2016/09/08 19:12:11 Is this needed?
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
@@ -124,6 +125,11 @@
#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
#endif
+#if BUILDFLAG(ANDROID_JAVA_UI)
+#include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
+#include "components/offline_pages/stub_offline_page_model.h"
+#endif
+
using base::Time;
using bookmarks::BookmarkModel;
using content::BrowserThread;
@@ -244,6 +250,13 @@ std::unique_ptr<KeyedService> BuildWebDataService(
&TestProfileErrorCallback));
}
+#if BUILDFLAG(ANDROID_JAVA_UI)
+std::unique_ptr<KeyedService> BuildOfflinePageModel(
+ content::BrowserContext* context) {
+ return base::MakeUnique<offline_pages::StubOfflinePageModel>();
+}
+#endif
+
} // namespace
// static
@@ -610,6 +623,10 @@ void TestingProfile::CreateBookmarkModel(bool delete_file) {
base::FilePath path = GetPath().Append(bookmarks::kBookmarksFileName);
base::DeleteFile(path, false);
}
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ offline_pages::OfflinePageModelFactory::GetInstance()->SetTestingFactory(
+ this, BuildOfflinePageModel);
+#endif
ManagedBookmarkServiceFactory::GetInstance()->SetTestingFactory(
this, ManagedBookmarkServiceFactory::GetDefaultFactory());
// This creates the BookmarkModel.
« no previous file with comments | « no previous file | components/offline_pages/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698