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

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

Issue 11412239: Delay determination of why a synced disabled extension was disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing file Created 8 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_disabled_ui_browsertest.cc
diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
index f2fea1901fc6064448521e5ac473fe38ebe77827..1f88dd9167ffbf52b42c880b94b05a1116219a47 100644
--- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
@@ -5,20 +5,30 @@
#include "base/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/extensions/autoupdate_interceptor.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/global_error/global_error.h"
#include "chrome/browser/ui/global_error/global_error_service.h"
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
+#include "net/url_request/url_fetcher.h"
using extensions::Extension;
class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest {
protected:
+ void SetUpCommandLine(CommandLine* command_line) {
+ ExtensionBrowserTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitchASCII(switches::kAppsGalleryUpdateURL,
+ "http://localhost/autoupdate/updates.xml");
+ }
+
void SetUpOnMainThread() {
EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
service_ = browser()->profile()->GetExtensionService();
@@ -161,3 +171,49 @@ IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest,
ASSERT_TRUE(extension);
ASSERT_TRUE(GetExtensionDisabledGlobalError());
}
+
+// Test that an error appears if the extension gets disabled because a
+// version with higher permissions was installed by sync.
+IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest,
+ HigherPermissionsFromSync) {
+ // Get data for extension v2 (disabled) into sync.
+ const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension();
+ std::string extension_id = extension->id();
+ // service_->GrantPermissionsAndEnableExtension(extension, false);
+ extensions::ExtensionSyncData sync_data =
+ service_->GetExtensionSyncData(*extension);
+ UninstallExtension(extension_id);
+ extension = NULL;
+
+ // Install extension v1.
+ InstallIncreasingPermissionExtensionV1();
+
+ // Note: This interceptor gets requests on the IO thread.
+ scoped_refptr<extensions::AutoUpdateInterceptor> interceptor(
+ new extensions::AutoUpdateInterceptor());
+ net::URLFetcher::SetEnableInterceptionForTests(true);
+ interceptor->SetResponseOnIOThread(
+ "http://localhost/autoupdate/updates.xml",
+ test_data_dir_.AppendASCII("permissions_increase")
+ .AppendASCII("updates.xml"));
+ interceptor->SetResponseOnIOThread(
+ "http://localhost/autoupdate/v2.crx",
+ scoped_temp_dir_.path().AppendASCII("permissions2.crx"));
+
+ extensions::ExtensionUpdater::CheckParams params;
+ params.check_blacklist = false;
+ service_->updater()->set_default_check_params(params);
+
+ // Sync is replacing an older version, so it pends.
+ EXPECT_FALSE(service_->ProcessExtensionSyncData(sync_data));
+
+ WaitForExtensionInstall();
+
+ extension = service_->GetExtensionById(extension_id, true);
+ ASSERT_TRUE(extension);
+ EXPECT_EQ("2", extension->VersionString());
+ EXPECT_EQ(1u, service_->disabled_extensions()->size());
+ EXPECT_EQ(Extension::DISABLE_PERMISSIONS_INCREASE,
+ service_->extension_prefs()->GetDisableReasons(extension_id));
+ EXPECT_TRUE(GetExtensionDisabledGlobalError());
+}
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698