Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Unified Diff: chrome/browser/extensions/extension_reenabler_unittest.cc

Issue 1148323007: [Extensions] Introduce a ScopedExtensionDialogAutoConfirm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_reenabler_unittest.cc
diff --git a/chrome/browser/extensions/extension_reenabler_unittest.cc b/chrome/browser/extensions/extension_reenabler_unittest.cc
index 9e5d8831f8a678fd2dd7498fb4a6ab0b6b7e349f..3c6f7c1819929120051bfaef79fd0d396c07af9c 100644
--- a/chrome/browser/extensions/extension_reenabler_unittest.cc
+++ b/chrome/browser/extensions/extension_reenabler_unittest.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/testing_profile.h"
#include "components/crx_file/id_util.h"
+#include "extensions/browser/extension_dialog_auto_confirm.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/management_policy.h"
#include "extensions/browser/test_extensions_browser_client.h"
@@ -160,8 +161,8 @@ TEST_F(ExtensionReenablerUnitTest, TestReenablingDisabledExtension) {
EXPECT_TRUE(registry()->disabled_extensions().Contains(extension->id()));
// Automatically confirm install prompts.
- ExtensionInstallPrompt::g_auto_confirm_for_tests =
- ExtensionInstallPrompt::ACCEPT;
+ ScopedTestDialogAutoConfirm auto_confirm(
+ ScopedTestDialogAutoConfirm::ACCEPT);
// Run the ExtensionReenabler.
scoped_ptr<ExtensionReenabler> extension_reenabler =
@@ -181,6 +182,9 @@ TEST_F(ExtensionReenablerUnitTest, TestReenablingDisabledExtension) {
// Check that we don't re-enable extensions that must remain disabled, and
// that the re-enabler reports failure correctly.
{
+ ScopedTestDialogAutoConfirm auto_confirm(
+ ScopedTestDialogAutoConfirm::ACCEPT);
+
ManagementPolicy* management_policy =
ExtensionSystem::Get(browser_context())->management_policy();
ASSERT_TRUE(management_policy);
@@ -210,8 +214,8 @@ TEST_F(ExtensionReenablerUnitTest, TestReenablingDisabledExtension) {
// Disable it again, and try canceling the prompt.
service()->DisableExtension(extension->id(),
Extension::DISABLE_PERMISSIONS_INCREASE);
- ExtensionInstallPrompt::g_auto_confirm_for_tests =
- ExtensionInstallPrompt::CANCEL;
+ ScopedTestDialogAutoConfirm auto_confirm(
+ ScopedTestDialogAutoConfirm::CANCEL);
scoped_ptr<ExtensionReenabler> extension_reenabler =
ExtensionReenabler::PromptForReenable(extension,
profile(),
@@ -229,9 +233,6 @@ TEST_F(ExtensionReenablerUnitTest, TestReenablingDisabledExtension) {
// Test that if the extension is re-enabled while the prompt is active, the
// prompt exits and reports success.
{
- // Don't auto-confirm, so that the prompt "stays around".
- ExtensionInstallPrompt::g_auto_confirm_for_tests =
- ExtensionInstallPrompt::NONE;
base::RunLoop run_loop;
scoped_ptr<ExtensionReenabler> extension_reenabler =
ExtensionReenabler::PromptForReenableWithPromptForTest(
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698