Remove dependency of FaviconService on //chrome, //content & //extensions

Inject the HistoryService through the FaviconServiceFactory and abstract
ChromeWebUIControllerFactory dependency through the FaviconClient.

Use ThreadTaskRunnerHandle instead of MessageLoopProxy as it has better
error reporting when there is no MessageLoop initialized for the current
thread.

BUG=378208, 391770, 377505, 359591, 359539, 359506

Review URL: https://codereview.chromium.org/985083002

Cr-Commit-Position: refs/heads/master@{#320520}
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 55986c304..a2c5cd1 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -213,10 +213,11 @@
 }
 #endif
 
-KeyedService* BuildFaviconService(content::BrowserContext* profile) {
-  FaviconClient* favicon_client =
-      ChromeFaviconClientFactory::GetForProfile(static_cast<Profile*>(profile));
-  return new FaviconService(static_cast<Profile*>(profile), favicon_client);
+KeyedService* BuildFaviconService(content::BrowserContext* context) {
+  Profile* profile = Profile::FromBrowserContext(context);
+  return new FaviconService(ChromeFaviconClientFactory::GetForProfile(profile),
+                            HistoryServiceFactory::GetForProfile(
+                                profile, ServiceAccessType::EXPLICIT_ACCESS));
 }
 
 KeyedService* BuildHistoryService(content::BrowserContext* context) {