summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 05:34:05 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 05:34:05 +0000
commitf0e524cb492503bd20513e11bd379df98c97bb3a (patch)
treec91777e4e6b5247399a0dec9269efd3efb56fc53 /chrome/browser/extensions/extension_disabled_ui_browsertest.cc
parentedf74b4dad463aec31499fa9b05df616d9bfa787 (diff)
downloadchromium_src-f0e524cb492503bd20513e11bd379df98c97bb3a.zip
chromium_src-f0e524cb492503bd20513e11bd379df98c97bb3a.tar.gz
chromium_src-f0e524cb492503bd20513e11bd379df98c97bb3a.tar.bz2
Revert 127887 - Replace extension disabled infobar with a global error.
Move disabled-extension interface to namespace extensions. It looks like this: http://dl.dropbox.com/u/27111995/Mocks/disable-dialog.png http://dl.dropbox.com/u/27111995/Mocks/disable-menu.png BUG=108202 TEST=install extension, update to version that requires additional permissions. Accept upgrade. Uninstall manually from chrome://extensions. Don't crash. Review URL: http://codereview.chromium.org/9718008 TBR=yoz@chromium.org Review URL: https://chromiumcodereview.appspot.com/9802007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_disabled_ui_browsertest.cc')
-rw-r--r--chrome/browser/extensions/extension_disabled_ui_browsertest.cc81
1 files changed, 0 insertions, 81 deletions
diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
deleted file mode 100644
index d908fa0..0000000
--- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/extensions/extension_browsertest.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/global_error_service.h"
-#include "chrome/browser/ui/global_error_service_factory.h"
-#include "chrome/common/extensions/extension.h"
-
-class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest {
- protected:
- void SetUpOnMainThread() {
- service_ = browser()->profile()->GetExtensionService();
- }
-
- // Returns the ExtensionDisabledGlobalError, if present.
- // Caution: currently only supports one error at a time.
- GlobalError* GetExtensionDisabledGlobalError() {
- return GlobalErrorServiceFactory::GetForProfile(browser()->profile())->
- GetGlobalErrorByMenuItemCommandID(IDC_EXTENSION_DISABLED_FIRST);
- }
-
- // Helper function to install an extension and upgrade it to a version
- // requiring additional permissions. Returns the new disabled Extension.
- const Extension* InstallAndUpdateIncreasingPermissionsExtension() {
- size_t size_before = service_->extensions()->size();
-
- // Install the initial version, which should happen just fine.
- const Extension* extension = InstallExtension(
- test_data_dir_.AppendASCII("permissions-low-v1.crx"), 1);
- if (!extension)
- return NULL;
- if (service_->extensions()->size() != size_before + 1)
- return NULL;
-
- // Upgrade to a version that wants more permissions. We should disable the
- // extension and prompt the user to reenable.
- if (UpdateExtension(
- extension->id(),
- test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1))
- return NULL;
- EXPECT_EQ(size_before, service_->extensions()->size());
- if (service_->disabled_extensions()->size() != 1u)
- return NULL;
-
- return *service_->disabled_extensions()->begin();
- }
-
- ExtensionService* service_;
-};
-
-// Tests the process of updating an extension to one that requires higher
-// permissions, and accepting the permissions.
-IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, AcceptPermissions) {
- const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension();
- ASSERT_TRUE(extension);
- ASSERT_TRUE(GetExtensionDisabledGlobalError());
- const size_t size_before = service_->extensions()->size();
-
- service_->GrantPermissionsAndEnableExtension(extension);
- EXPECT_EQ(size_before + 1, service_->extensions()->size());
- EXPECT_EQ(0u, service_->disabled_extensions()->size());
- ASSERT_FALSE(GetExtensionDisabledGlobalError());
-}
-
-// Tests uninstalling an extension that was disabled due to higher permissions.
-IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, Uninstall) {
- const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension();
- ASSERT_TRUE(extension);
- ASSERT_TRUE(GetExtensionDisabledGlobalError());
- const size_t size_before = service_->extensions()->size();
-
- UninstallExtension(extension->id());
- EXPECT_EQ(size_before, service_->extensions()->size());
- EXPECT_EQ(0u, service_->disabled_extensions()->size());
- ASSERT_FALSE(GetExtensionDisabledGlobalError());
-}