[Extensions] Remove ExtensionService::set_extensions_enabled()

ExtensionService::set_extensions_enabled() is only called from tests,
and can easily lead to representing invalid state or confusion. In many
places, callers are using this with the argument of "true", which is the
default (and thus unnecessary). In others, callers are using this to
retroactively disable/enable extensions after profile initialization.
However, this is state that can't actually happen in production, and
thus leads to tests not really testing what they want to be testing.

Remove the set_extensions_enabled() method and update tests to either
a) Not call it (because they didn't need to) or
b) Disable extensions properly (e.g. by passing the --disable-extensions
   flag during setup) so that the profile is valid.

BUG=434465
[email protected] (removing unnecessary code from device_cloud_policy_browsertest.cc)

Review-Url: https://codereview.chromium.org/2764753005
Cr-Commit-Position: refs/heads/master@{#459544}
diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc
index b1049e7a..f775635 100644
--- a/chrome/browser/extensions/test_extension_system.cc
+++ b/chrome/browser/extensions/test_extension_system.cc
@@ -51,7 +51,8 @@
 ExtensionService* TestExtensionSystem::CreateExtensionService(
     const base::CommandLine* command_line,
     const base::FilePath& install_directory,
-    bool autoupdate_enabled) {
+    bool autoupdate_enabled,
+    bool extensions_enabled) {
   state_store_.reset(new StateStore(
       profile_, store_factory_, ValueStoreFrontend::BackendType::RULES, false));
   management_policy_.reset(new ManagementPolicy());
@@ -59,14 +60,10 @@
       ExtensionManagementFactory::GetForBrowserContext(profile_)
           ->GetProviders());
   runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_)));
-  extension_service_.reset(new ExtensionService(profile_,
-                                                command_line,
-                                                install_directory,
-                                                ExtensionPrefs::Get(profile_),
-                                                Blacklist::Get(profile_),
-                                                autoupdate_enabled,
-                                                true,
-                                                &ready_));
+  extension_service_.reset(new ExtensionService(
+      profile_, command_line, install_directory, ExtensionPrefs::Get(profile_),
+      Blacklist::Get(profile_), autoupdate_enabled, extensions_enabled,
+      &ready_));
   extension_service_->ClearProvidersForTesting();
   return extension_service_.get();
 }