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

Unified Diff: chrome/browser/browsing_data/browsing_data_remover_unittest.cc

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
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data/browsing_data_remover_unittest.cc
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 223fd0cd9a0824d4ae4aa76db0df698b3a80c376..a96654745cc01b761a7841216721e0abccf797ca 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -76,6 +76,10 @@
#include "ui/gfx/favicon_size.h"
#include "url/origin.h"
+#if BUILDFLAG(ANDROID_JAVA_UI)
+#include "chrome/browser/android/webapps/webapp_registry.h"
+#endif
+
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/mock_user_manager.h"
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
@@ -260,6 +264,19 @@ class TestStoragePartition : public StoragePartition {
DISALLOW_COPY_AND_ASSIGN(TestStoragePartition);
};
+#if BUILDFLAG(ANDROID_JAVA_UI)
+class TestWebappRegistry : public WebappRegistry {
+ public:
+ TestWebappRegistry() : WebappRegistry() { }
+
+ void UnregisterWebapps(const base::Closure& callback) override {
+ // Mocks out a JNI call and runs the callback as a delayed task.
+ BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, callback,
+ base::TimeDelta::FromMilliseconds(10));
+ }
+};
+#endif
+
// Custom matcher to test the equivalence of two URL filters. Since those are
// blackbox predicates, we can only approximate the equivalence by testing
// whether the filter give the same answer for several URLs. This is currently
@@ -942,6 +959,13 @@ class BrowsingDataRemoverTest : public testing::Test {
BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback(
base::Bind(&BrowsingDataRemoverTest::NotifyWithDetails,
base::Unretained(this)));
+
+#if BUILDFLAG(ANDROID_JAVA_UI)
+ BrowsingDataRemover* remover =
+ BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get());
+ remover->OverrideWebappRegistryForTesting(
+ scoped_ptr<WebappRegistry>(new TestWebappRegistry()));
+#endif
}
~BrowsingDataRemoverTest() override {}
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698