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

Reland "Fix ExtensionPolicyTest.ExtensionRecommendedInstallationMode browsertest"

This is a reland of f9ad6770

In the previous commit, the flag was overriden only for Windows.
But the flag is set to true in case of MacOS too.

Original change's description:
> 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/+/2537641
> Reviewed-by: Sergey Poromov <poromov@chromium.org>
> Commit-Queue: Swapnil Gupta <swapnilgupta@google.com>
> Cr-Commit-Position: refs/heads/master@{#828093}

Bug: 1006342
Change-Id: If01e0d818a2b0a1e0f8704852aee5ac478c301ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2544292Reviewed-by: default avatarSergey Poromov <poromov@chromium.org>
Commit-Queue: Swapnil Gupta <swapnilgupta@google.com>
Cr-Commit-Position: refs/heads/master@{#828205}
parent 47ceef80
......@@ -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"
......@@ -1646,6 +1647,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionPolicyTest,
// Verifies that extensions that are recommended-installed by policies are
// installed, can be disabled but not uninstalled.
// External extensions are initially disabled for windows and MacOS. 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);
ExtensionRequestInterceptor interceptor;
// Extensions that are force-installed come from an update URL, which defaults
......@@ -1680,19 +1687,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