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

Unified Diff: chrome/browser/browsing_data/browsing_data_remover.h

Issue 1776903002: Refactor BrowsingDataRemover to mock out WebappRegistry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use PostDelayedTask Created 4 years, 9 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/browsing_data/browsing_data_remover.h
diff --git a/chrome/browser/browsing_data/browsing_data_remover.h b/chrome/browser/browsing_data/browsing_data_remover.h
index f0c74328aad0f069b8360c8883c0968a44263e5b..fc2dfd9de6788b7a54997f921b6ddde80e7230e0 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.h
+++ b/chrome/browser/browsing_data/browsing_data_remover.h
@@ -52,6 +52,10 @@ namespace net {
class URLRequestContextGetter;
}
+#if BUILDFLAG(ANDROID_JAVA_UI)
+class WebappRegistry;
+#endif
+
// BrowsingDataRemover is responsible for removing data related to browsing:
// visits in url database, downloads, cookies ...
class BrowsingDataRemover : public KeyedService
@@ -253,6 +257,11 @@ class BrowsingDataRemover : public KeyedService
void OverrideStoragePartitionForTesting(
content::StoragePartition* storage_partition);
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ void OverrideWebappRegistryForTesting(
+ scoped_ptr<WebappRegistry> webapp_registry);
+#endif
+
private:
// The clear API needs to be able to toggle removing_ in order to test that
// only one BrowsingDataRemover instance can be called at a time.
@@ -472,6 +481,12 @@ class BrowsingDataRemover : public KeyedService
// We do not own this.
content::StoragePartition* storage_partition_for_testing_ = nullptr;
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ // WebappRegistry makes calls across the JNI. In unit tests, the Java side is
+ // not initialised, so the registry must be mocked out.
+ scoped_ptr<WebappRegistry> webapp_registry_;
+#endif
+
base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
« no previous file with comments | « chrome/browser/android/webapps/webapp_registry.cc ('k') | chrome/browser/browsing_data/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698