Commit f9ad6770 authored by Swapnil's avatar Swapnil Committed by Commit Bot

Fix ExtensionPolicyTest.ExtensionRecommendedInstallationMode browsertest

We check the list of enabled and disabled extensions in
ExtensionPolicyTest.ExtensionRecommendedInstallationMode browsertest.
In Windows, the extension is disabled by default as the user is
prompted before enabling the extension. On other platforms, the
extension is enabled by default. This CL overrides the prompting
flag to false.

Bug: 1006342
Change-Id: I1d783a8fc381b50e84e5ba85b5c9f37e58b7a986
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537641Reviewed-by: default avatarSergey Poromov <poromov@chromium.org>
Commit-Queue: Swapnil Gupta <swapnilgupta@google.com>
Cr-Commit-Position: refs/heads/master@{#828093}
parent d52e465b
......@@ -56,6 +56,7 @@
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/browser/updater/extension_cache_fake.h"
#include "extensions/common/constants.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest.h"
......@@ -1658,6 +1659,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionPolicyTest,
// Mark as enterprise managed.
#if defined(OS_WIN)
base::win::ScopedDomainStateForTesting scoped_domain(true);
// External extensions are initially disabled for windows. The users are
// prompted before enabling them. Explicitly override the flag with 'false' to
// disable prompting.
extensions::FeatureSwitch::ScopedOverride external_prompt_override(
extensions::FeatureSwitch::prompt_for_external_extensions(), false);
#endif
extensions::ExtensionService* service = extension_service();
......@@ -1680,19 +1686,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionPolicyTest,
extensions::TestExtensionRegistryObserver observer(registry);
UpdateProviderPolicy(policies);
observer.WaitForExtensionWillBeInstalled();
// TODO(crbug.com/1006342): There is a race condition here where the extension
// may or may not be enabled by the time we get here.
EXPECT_TRUE(registry->GetExtensionById(
kGoodCrxId, extensions::ExtensionRegistry::ENABLED |
extensions::ExtensionRegistry::DISABLED));
kGoodCrxId, extensions::ExtensionRegistry::ENABLED));
// The user is not allowed to uninstall recommended-installed extensions.
UninstallExtension(kGoodCrxId, false);
// Explicitly re-enables the extension.
service->EnableExtension(kGoodCrxId);
// But the user is allowed to disable them.
EXPECT_TRUE(service->IsExtensionEnabled(kGoodCrxId));
DisableExtension(kGoodCrxId);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment