| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/scoped_temp_dir.h" | 6 #include "base/scoped_temp_dir.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 // Tests the process of updating an extension to one that requires higher | 93 // Tests the process of updating an extension to one that requires higher |
| 94 // permissions, and accepting the permissions. | 94 // permissions, and accepting the permissions. |
| 95 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, AcceptPermissions) { | 95 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, AcceptPermissions) { |
| 96 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); | 96 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); |
| 97 ASSERT_TRUE(extension); | 97 ASSERT_TRUE(extension); |
| 98 ASSERT_TRUE(GetExtensionDisabledGlobalError()); | 98 ASSERT_TRUE(GetExtensionDisabledGlobalError()); |
| 99 const size_t size_before = service_->extensions()->size(); | 99 const size_t size_before = service_->extensions()->size(); |
| 100 | 100 |
| 101 service_->GrantPermissionsAndEnableExtension(extension); | 101 service_->GrantPermissionsAndEnableExtension(extension, false); |
| 102 EXPECT_EQ(size_before + 1, service_->extensions()->size()); | 102 EXPECT_EQ(size_before + 1, service_->extensions()->size()); |
| 103 EXPECT_EQ(0u, service_->disabled_extensions()->size()); | 103 EXPECT_EQ(0u, service_->disabled_extensions()->size()); |
| 104 ASSERT_FALSE(GetExtensionDisabledGlobalError()); | 104 ASSERT_FALSE(GetExtensionDisabledGlobalError()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Tests uninstalling an extension that was disabled due to higher permissions. | 107 // Tests uninstalling an extension that was disabled due to higher permissions. |
| 108 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, Uninstall) { | 108 IN_PROC_BROWSER_TEST_F(ExtensionDisabledGlobalErrorTest, Uninstall) { |
| 109 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); | 109 const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); |
| 110 ASSERT_TRUE(extension); | 110 ASSERT_TRUE(extension); |
| 111 ASSERT_TRUE(GetExtensionDisabledGlobalError()); | 111 ASSERT_TRUE(GetExtensionDisabledGlobalError()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 GlobalErrorServiceFactory::GetForProfile(browser()->profile())-> | 154 GlobalErrorServiceFactory::GetForProfile(browser()->profile())-> |
| 155 RemoveGlobalError(error); | 155 RemoveGlobalError(error); |
| 156 delete error; | 156 delete error; |
| 157 // Upgrade to version 3, with even higher permissions. Infer from | 157 // Upgrade to version 3, with even higher permissions. Infer from |
| 158 // version 2 having higher-than-granted permissions that it was disabled | 158 // version 2 having higher-than-granted permissions that it was disabled |
| 159 // for permissions increase. | 159 // for permissions increase. |
| 160 extension = UpdateIncreasingPermissionExtension(extension, path_v3_, 0); | 160 extension = UpdateIncreasingPermissionExtension(extension, path_v3_, 0); |
| 161 ASSERT_TRUE(extension); | 161 ASSERT_TRUE(extension); |
| 162 ASSERT_TRUE(GetExtensionDisabledGlobalError()); | 162 ASSERT_TRUE(GetExtensionDisabledGlobalError()); |
| 163 } | 163 } |
| OLD | NEW |