Read Connector policies from profile prefs instead of local_state prefs

This refactor is only the first step to getting Connectors policies to
work on a profile basis, as the CBCM DM token is still read even when
the policy is set at the user level.

This refactor breaks a few assumptions of the previous implementation:
- SetUpForTesting, TearDownForTesting and ClearCacheForTesting are no
  longer needed by ConnectorsManager since it is no longer a global
  singleton.
- Extra null checks are added for ConnectorsService and
  SafeBrowsingPrivateEventRouter since they can be null in tests. This
  wasn't a problem before since ConnectorsManager::GetInstance never
  returned null and SafeBrowsingPrivateEventRouter::context_ wasn't
  read by test not using those classes, but that is no longer the case.
- kEnterpriseConnectorsEnabled is moving to ConnectorsService since
  it will be used by future code outside of ConnectorsManager.
- policy_test_cases.json is updated since the policies are now read from
  profile prefs, but the policies are not truly per-profile since they
  depend on the CBCM DM token so they are not marked as such in
  policy_templates.json.


Bug: 1147464
Change-Id: Ifacd55555ef6a5edab796dacbd336d971b9ae1ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2529613
Reviewed-by: David Trainor <[email protected]>
Reviewed-by: Daniel Rubery <[email protected]>
Reviewed-by: Roger Tawa <[email protected]>
Reviewed-by: Owen Min <[email protected]>
Commit-Queue: Dominique Fauteux-Chapleau <[email protected]>
Cr-Commit-Position: refs/heads/master@{#834298}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index d922c9c..1ebb6408 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -3515,6 +3515,8 @@
       "enterprise/connectors/connectors_manager.h",
       "enterprise/connectors/connectors_prefs.cc",
       "enterprise/connectors/connectors_prefs.h",
+      "enterprise/connectors/connectors_service.cc",
+      "enterprise/connectors/connectors_service.h",
       "enterprise/connectors/content_analysis_delegate.cc",
       "enterprise/connectors/content_analysis_delegate.h",
       "enterprise/connectors/content_analysis_dialog.cc",